-
Notifications
You must be signed in to change notification settings - Fork 585
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
Exception when creating SendGridAPIClient #465
Comments
Hello @dannythomas13, What version of Visual Studio are you using and on what OS? With Best Regards, Elmer |
@thinkingserious thanks for getting back to me, I am using VS2017 Professional on Windows 7 64 bit |
I have same problem, but I am using VS2017 Enterprise on Windows 10 64 bit |
Thanks for adding your voice to this issue. I've added your vote to this issue in our backlog to help increase its priority. |
@ShurikEv I desperately need to be able to send emails from an azure app for a current project if you find another solution before this is resolved can you let me know please? |
@dannythomas13 have you tried using the SendGrid addon within Azure? |
@dannythomas13 to work around the problem you are experiencing you could also consider StrongGrid |
@Jericho, do have an idea on what the problem could be? |
@thinkingserious just a wild guess: the problem seems to be regarding a missing assembly called System.Diagnostics.DiagnosticSource, so maybe add it to your package? |
Thanks @Jericho! Could you please try adding that assembly to your project to see if that resolves the issue? Also, I could not replicate this on Visual Studio 2015, so I will get 2017 going to try and replicate there. Thanks! |
@Jericho @thinkingserious difficult for me as when i add reference to 4.0.0 i get lots of warning that i am downgrading from 4.3.0 which is required from all of the 1.1.* asp core libraries |
@thinkingserious regarding the azure addon i assumed this is what i had but still needed to code to send messages? I was following this guide: |
Thanks @Jericho! It looks like the fix is to reference System.Net.Http 4.3.1. I'll give it a try. |
That is the correct approach; however, it looks like we have to fix some dependency issues for VS 2017 Core 1.1.* projects. |
@thinkingserious is this something that could be done within the next few weeks? If not is there a workaround? |
Hi @dannythomas13, It could be done within the next few weeks if we get a significant amount of people voting on this issue or best if someone submits a PR. Those things help push the item up our backlog queue. |
@thinkingserious Did this issue make the next release? :) |
Hi @dannythomas13, Unfortunately, this issue is still fairly low on our backlog. It can gain momentum with additional votes or a PR. Thanks for checking in! With Best Regards, Elmer |
Hi Elmer, do you have a public facing backlog so I can keep an eye on the priority of this issue please? |
Hi @dannythomas13, We do not right now, but I'm going to discuss this with my product manager today and see if we can come up with a better way to inform on our progress. With Best Regards, Elmer |
Since there has been no activity on this issue since March 1, 2020, we are closing this issue. Please feel free to reopen or create a new issue if you still require assistance. Thank you! |
Issue Summary
I get the following exception when attempting to use SendGrid:
An unhandled exception occurred while processing the request.
FileLoadException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
System.Net.Http.WinHttpHandler..cctor()
TypeInitializationException: The type initializer for 'System.Net.Http.WinHttpHandler' threw an exception.
System.Net.Http.WinHttpHandler..ctor()
Steps to Reproduce
var apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY"); var client = new SendGridClient(apiKey); var from = new EmailAddress("test@example.com", "Example User"); var subject = "Sending with SendGrid is Fun"; var to = new EmailAddress("test@example.com", "Example User"); var plainTextContent = "and easy to do anywhere, even with C#"; var htmlContent = "<strong>and easy to do anywhere, even with C#</strong>"; var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent); var response = await client.SendEmailAsync(msg);
Technical details:
This is from a .net core web application targeting the full framework as follows:
net461
Below are the full package references:
The text was updated successfully, but these errors were encountered: