Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET 8 support and "Could not load file or assembly 'System.Net.Http.Formatting, Version=6.0.0.0" #529

Closed
wlewis22 opened this issue Jul 26, 2024 · 5 comments
Assignees
Labels
question Someone is asking a question

Comments

@wlewis22
Copy link

wlewis22 commented Jul 26, 2024

Hi all,

UPDATE: I tried rolling back to v0.108.0, and experienced the same issue. I then tried 0.107.0 of StrongGrid and the issue did not occur. Parsing of the post body worked perfectly. So I am not sure what was introduced in v0.108.0 but it appears to have broken something. END UPDATE.

I have an Azure Functions project targeting .NET 8. The function is a standard HTTP function which will be receiving SendGrid Inbound Parse webhooks.

I am using Version 0.109.0 of Strong Grid.

var parser = new WebhookParser(); var inboundEmail = await parser.ParseInboundEmailWebhookAsync(request.Body);

When I run the above, I get the following error

Executed 'dataServiceInboundEmail' (Failed, Id=439fab89-72dd-4add-b347-6d4bf97d025d, Duration=412ms) [2024-07-26T02:22:15.142Z] System.Private.CoreLib: Exception while executing function: dataServiceInboundEmail. StrongGrid: Could not load file or assembly 'System.Net.Http.Formatting, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

I am wondering if this is due to a lack of .NET 8 support by StrongGrid, or something else?

If its due to .NET 8 support, is there any ETA on supporting .NET 8 with StrongGrid?

If it is something else, is anyone able to suggest why I might be getting this error and how I can resolve it?

Any help with this would be greatly appreciated. I have tried including System.Net.Http.Formatting, Version=6.0.0.0 in the csproj, but get errors saying that package cannot be found. Not sure where I am going wrong.

Regards,

@wlewis22
Copy link
Author

Update on this issue. Just to be sure, I created a new solution with only a single Azure Functions .NET 8 project.

I sent a standard SendGrid request from Postman to the function and the function picked up the POST request just fine. As soon as it ran:

var inboundEmail = await parser.ParseInboundEmailWebhookAsync(request.Body);

I got the same error.

[2024-07-26T05:39:17.751Z] Executed 'dataServiceInboundEmail' (Failed, Id=0c331241-e613-4e65-9d7d-63efade1c033, Duration=7492ms) [2024-07-26T05:39:17.752Z] System.Private.CoreLib: Exception while executing function: dataServiceInboundEmail. StrongGrid: Could not load file or assembly 'System.Net.Http.Formatting, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

I have seen other issues raised related to other problems by users running on Azure Functions V4 and .NET 8. So I am hoping that it is not a .NET 8 support issue. But if not, then I am quite stuck.

Again, any assistance much appreciated.

@Jericho
Copy link
Owner

Jericho commented Jul 26, 2024

What you are describing is a well-known problem with "in-process" Azure functions. Allow me to emphasize "in-process", this is a rather important detail which is at the heart of this issue. You haven't stated whether you are using in-process or not but I'm going to assume that you are.

I have explained the root of this problem before so I won't explain it again but simply summarize that you can make this problem go away by switching to "out-of-process" (AKA "isolated worker model") Azure functions.

Speaking of in-process vs out-of-process: my understanding is that Microsoft is phasing out "in-process" and is encouraging their customer to switch to out-of-process, as announced here.

@Jericho Jericho self-assigned this Jul 26, 2024
@Jericho Jericho added the question Someone is asking a question label Jul 26, 2024
@Jericho
Copy link
Owner

Jericho commented Aug 8, 2024

Haven't heard back therefore I will assume my suggestion was helpful

@Jericho Jericho closed this as completed Aug 8, 2024
@wlewis22
Copy link
Author

wlewis22 commented Aug 8, 2024

Haven't heard back therefore I will assume my suggestion was helpful

Hi,

Very sorry to not reply. Totally slipped my mind. Your assistance was very much appreciated and certainly helped to explain the issue a lot!

Sure enough it was exactly the cause of the issue and has now been resolved by movie to the isolated worker mode. Many thanks!

@Jericho
Copy link
Owner

Jericho commented Aug 8, 2024

You're welcome. Glad I could help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Someone is asking a question
Projects
None yet
Development

No branches or pull requests

2 participants