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

System.Net.NetworkInformation is not supported on this platform #1381

Closed
zonggang opened this issue May 27, 2022 · 1 comment
Closed

System.Net.NetworkInformation is not supported on this platform #1381

zonggang opened this issue May 27, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@zonggang
Copy link

Describe the bug
got System.Net.NetworkInformation is not supported on this platform when new SMTP client.

Platform (please complete the following information):

  • OS: Windows
  • .NET Runtime: [e.g. CoreCLR, Mono]
  • .NET Framework: .NET 6
  • MailKit Version: 3.2

Exception
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: The type initializer for 'MailKit.Net.Smtp.SmtpClient' threw an exception.
System.TypeInitializationException: The type initializer for 'MailKit.Net.Smtp.SmtpClient' threw an exception.
---> System.PlatformNotSupportedException: System.Net.NetworkInformation is not supported on this platform.

To Reproduce
Steps to reproduce the behavior:
new SmtpClient()

Expected behavior
new instance created.

@jstedfast
Copy link
Owner

Which platform are you on?

jstedfast added a commit that referenced this issue May 28, 2022
…WASM

Wrap SmtpClient static ctor logic in a try/catch and default to "localhost".

Fixes issue #1381
@jstedfast jstedfast added the bug Something isn't working label May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants