-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[wasm][net] System.Net.Mail should not throw PNSE for full assembly. #42974
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ef38eb6
[wasm][net] System.Net.Mail should not throw PNSE for full assembly.
kjpou1 3ad3cf2
Address review comment. Remove comment line
kjpou1 0a256af
Address review comments. Remove redundant defs
kjpou1 e57bd98
Activate tests on CI
kjpou1 0d69fcb
Merge branch 'master' of https://github.com/dotnet/runtime into wasm-…
kjpou1 62999df
Add `[UnsupportedOSPlatform("browser")]` to SmtpClient
kjpou1 14e90dc
Add back System.Net.Mail Unit tests
kjpou1 74b6bbb
Remove redundant $(TargetsBrowser) from ItemGroup
kjpou1 2940c52
Merge branch 'master' of https://github.com/dotnet/runtime into wasm-…
kjpou1 34d4f77
Add `[UnsupportedOSPlatform("browser")]` to SmtpClient methods and pr…
kjpou1 df2ad24
Merge branch 'master' of https://github.com/dotnet/runtime into wasm-…
kjpou1 26df263
Remove unnecessary Unsupported attribute at the method level
kjpou1 528bf7d
Remove unnecessary Unsupported attribute at the method level
kjpou1 7e532db
Modify message on skipped test.
kjpou1 d90010f
Merge branch 'master' of https://github.com/dotnet/runtime into wasm-…
kjpou1 0e5d51f
Address review comments and remove string resource
kjpou1 aeff320
Remove redundant AssemblyInfo per review comment
kjpou1 0541b46
Merge branch 'master' of https://github.com/dotnet/runtime into wasm-…
kjpou1 ec6d9d8
Remove condition attribute
kjpou1 54d1068
Attribute is needed
kjpou1 87d1a61
Fix build issues
kjpou1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
160 changes: 160 additions & 0 deletions
160
src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.Browser.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,160 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
kjpou1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.ComponentModel; | ||
| using System.Runtime.Versioning; | ||
| using System.Security.Cryptography.X509Certificates; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace System.Net.Mail | ||
| { | ||
| public delegate void SendCompletedEventHandler(object sender, AsyncCompletedEventArgs e); | ||
|
|
||
| public enum SmtpDeliveryMethod | ||
| { | ||
| Network, | ||
| SpecifiedPickupDirectory, | ||
| PickupDirectoryFromIis | ||
| } | ||
|
|
||
| // EAI Settings | ||
| public enum SmtpDeliveryFormat | ||
| { | ||
| SevenBit = 0, // Legacy | ||
| International = 1, // SMTPUTF8 - Email Address Internationalization (EAI) | ||
| } | ||
|
|
||
| [UnsupportedOSPlatform("browser")] | ||
| public class SmtpClient : IDisposable | ||
| { | ||
| #pragma warning disable CS0067 // Field is not used | ||
| public event SendCompletedEventHandler? SendCompleted; | ||
| #pragma warning restore CS0067 | ||
| public SmtpClient() | ||
| { | ||
| Initialize(); | ||
| } | ||
|
|
||
| public SmtpClient(string? host) | ||
| { | ||
| Initialize(); | ||
| } | ||
|
|
||
| public SmtpClient(string? host, int port) | ||
| { | ||
| Initialize(); | ||
| } | ||
|
|
||
| private void Initialize() | ||
| { | ||
| throw new PlatformNotSupportedException(); | ||
| } | ||
|
|
||
| public string? Host | ||
| { | ||
| get => throw new PlatformNotSupportedException(); | ||
| set => throw new PlatformNotSupportedException(); | ||
| } | ||
|
|
||
| public int Port | ||
| { | ||
| get => throw new PlatformNotSupportedException(); | ||
| set => throw new PlatformNotSupportedException(); | ||
| } | ||
|
|
||
| public bool UseDefaultCredentials | ||
| { | ||
| get => throw new PlatformNotSupportedException(); | ||
| set => throw new PlatformNotSupportedException(); | ||
| } | ||
|
|
||
| public ICredentialsByHost? Credentials | ||
| { | ||
| get => throw new PlatformNotSupportedException(); | ||
| set => throw new PlatformNotSupportedException(); | ||
| } | ||
|
|
||
| public int Timeout | ||
| { | ||
| get => throw new PlatformNotSupportedException(); | ||
| set => throw new PlatformNotSupportedException(); | ||
| } | ||
|
|
||
| public ServicePoint ServicePoint | ||
| { | ||
| get => throw new PlatformNotSupportedException(); | ||
| } | ||
|
|
||
| public SmtpDeliveryMethod DeliveryMethod | ||
| { | ||
| get => throw new PlatformNotSupportedException(); | ||
| set => throw new PlatformNotSupportedException(); | ||
| } | ||
|
|
||
| public SmtpDeliveryFormat DeliveryFormat | ||
| { | ||
| get => throw new PlatformNotSupportedException(); | ||
| set => throw new PlatformNotSupportedException(); | ||
| } | ||
|
|
||
| public string? PickupDirectoryLocation | ||
| { | ||
| get => throw new PlatformNotSupportedException(); | ||
| set => throw new PlatformNotSupportedException(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// <para>Set to true if we need SSL</para> | ||
| /// </summary> | ||
| public bool EnableSsl | ||
| { | ||
| get => throw new PlatformNotSupportedException(); | ||
| set => throw new PlatformNotSupportedException(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Certificates used by the client for establishing an SSL connection with the server. | ||
| /// </summary> | ||
| public X509CertificateCollection ClientCertificates => throw new PlatformNotSupportedException(); | ||
|
|
||
| public string? TargetName | ||
| { | ||
| get => throw new PlatformNotSupportedException(); | ||
| set => throw new PlatformNotSupportedException(); | ||
| } | ||
|
|
||
| private bool ServerSupportsEai => throw new PlatformNotSupportedException(); | ||
|
|
||
| public void Send(string from, string recipients, string? subject, string? body) => throw new PlatformNotSupportedException(); | ||
|
|
||
| public void Send(MailMessage message) => throw new PlatformNotSupportedException(); | ||
|
|
||
| public void SendAsync(string from, string recipients, string? subject, string? body, object? userToken) => throw new PlatformNotSupportedException(); | ||
|
|
||
| public void SendAsync(MailMessage message, object? userToken) => throw new PlatformNotSupportedException(); | ||
|
|
||
| public void SendAsyncCancel() => throw new PlatformNotSupportedException(); | ||
|
|
||
| //************* Task-based async public methods ************************* | ||
| public Task SendMailAsync(string from, string recipients, string? subject, string? body) => throw new PlatformNotSupportedException(); | ||
|
|
||
| public Task SendMailAsync(MailMessage message) => throw new PlatformNotSupportedException(); | ||
|
|
||
| public Task SendMailAsync(string from, string recipients, string? subject, string? body, CancellationToken cancellationToken) => throw new PlatformNotSupportedException(); | ||
|
|
||
| public Task SendMailAsync(MailMessage message, CancellationToken cancellationToken) => throw new PlatformNotSupportedException(); | ||
|
|
||
| protected void OnSendCompleted(AsyncCompletedEventArgs e) => throw new PlatformNotSupportedException(); | ||
|
|
||
| public void Dispose() | ||
| { | ||
| Dispose(true); | ||
| GC.SuppressFinalize(this); | ||
| } | ||
|
|
||
| protected virtual void Dispose(bool disposing) | ||
| { } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.