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.PlatformNotSupportedException when using ContentDisposition #42576

Closed
pureggerstefan opened this issue Sep 22, 2020 · 9 comments
Closed
Assignees
Labels
arch-wasm WebAssembly architecture area-System.Net
Milestone

Comments

@pureggerstefan
Copy link

pureggerstefan commented Sep 22, 2020

Greetings,

since the .NET5 RC1 update on a Blazor WASM, following lines lead to a System.PlatformNotSupportedException

 private static string GetFilename(IReadOnlyDictionary<string, IEnumerable<string>> headers)
        {
            if (headers.ContainsKey("Content-Disposition"))
            {
                //Exception throws at:
                var contentDisposition = new ContentDisposition(headers["Content-Disposition"].First());

                return contentDisposition.FileName;
            }

            return string.Empty;
        }

I think this is a bug, since the ContentDisposition class documentation says it applies to .NET RC1.

Best regards,
Stefan

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Net.Http untriaged New issue has not been triaged by the area owner labels Sep 22, 2020
@ghost
Copy link

ghost commented Sep 22, 2020

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@stephentoub
Copy link
Member

stephentoub commented Sep 22, 2020

cc: @akoeplinger, @marek-safar

@ghost
Copy link

ghost commented Sep 22, 2020

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@marek-safar marek-safar added arch-wasm WebAssembly architecture and removed untriaged New issue has not been triaged by the area owner labels Sep 22, 2020
@MaximLipnin
Copy link
Contributor

JFR - System.Net.Mail has been modified to throw PNSE at assembly level on Browser (see #38207)

@marek-safar
Copy link
Contributor

Yes, we will probably have to exclude ContentDisposition from that if it's also used by System.Net.Http headers

@LaughingJohn
Copy link

LaughingJohn commented Sep 30, 2020

I've just stumbled over this as well. Different scenario - I was using MailAddress in Blazor webassembly to validate an email address and it stopped working when I converted it to .Net 5.0. It used to work with .Net core.

            try
            {
                new MailAddress(emailAdddress);
            }
            catch
            {
                return false;
            }

@kjpou1
Copy link
Contributor

kjpou1 commented Oct 1, 2020

Looking into this. Thanks for the report.

@kjpou1
Copy link
Contributor

kjpou1 commented Oct 14, 2020

Closed by #42974

@kjpou1 kjpou1 closed this as completed Oct 14, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
@karelz
Copy link
Member

karelz commented Jan 26, 2021

Fixed in 6.0/master (PR #42974) and in 5.0 (PR #43213).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-System.Net
Projects
None yet
Development

No branches or pull requests

8 participants