-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Strange Issue with Blazor WebAssembly in .Net 5.0 & DataContractSerializer #25909
Comments
I came across this which might be related: dotnet/runtime#41525 ? |
@LaughingJohn the linked bug does appear to be related. @eerhardt would you happen to know what's a workaround for this? Would configuring the trim mode for |
@pranavkm Thank you so much, I was pulling out what little hair I have left! :) I added I will try excluding System.Runtime.Serialization.Xml and let you know. |
Hi @pranavkm, after trying a variety of different assemblies for exclusion, the one that seemed to do the trick is System.Private.DataContractSerialization:
Thank you! |
FYI - the underlying issue above is being tracked with dotnet/runtime#42754. |
Thank you @eerhardt ! |
Should be fixed in final release. |
Hi Apologies in advance as I'm not sure exactly what this is related to, Blazor, .Net 5.0, Azure or what, but it has me bamboozled and I'm just hoping someone might have a clue!
I have a Blazor webassembly application which has the usual 3 projects, Client, Server and Shared. It was all running fine under .Net Core 3.1. I have managed to convert it to .Net 5.0 RC1 (all 3 projects) and it's all running fine locally. I have also been able to publish it to Azure successfully.
Because I have some complex types in my webapi that the JSON serializer doesn't like, I use XML instead. Which has been working fine.
However since upgrading, and ONLY on the version published to Azure, the DataContractSerializer is throwing an exception when deserializing the result of any call the webassembly client makes to the webapi. It works fine when I run it locally both in Debug & Release. I have tried publishing using as framework dependant and as Self contained (out of desperation - the failure is happening in the webassembly so the method of publishing shouldn't make any difference). I have also tried turning off linking just in case it was something to do with that...
The error I get is this:
The failing code is:
The type that's being serialized looks like this:
I can see both from the Network tab of the browser and from debugging that the XML is being returned OK from the webapi and looks like this:
<AuthState xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MyApplication.Blazor.Shared.Types"> <GivenName>Admin User</GivenName> <IsAuthenticated>true</IsAuthenticated> <Name>admin@fmdevsql.onmicrosoft.com</Name> </AuthState>
I appreciate this is a bit of an odd circumstance - but just wondered if anyone might have a clue?
The text was updated successfully, but these errors were encountered: