Repository navigation
Description
Describe the bug
"we are not using blazer server .We are using Blazor WebAssembly . and the issue that the dieselization is working in the local code but it does not work when we deployed the Blazor to IIS server."
Struct data(Color : IEquatable) cannot "deserialize" when deployed the Blazor to IIS server.
It worked fine working in the local code.
Error message......
Newtonsoft.Json.JsonSerializationException: Error converting value "12, 12" to type
'System.Nullable`1[System.Drawing.Size]'. Path 'mapLayers[0].marker.icon.size', line 1, position 1272.
---> System.ArgumentException: Could not cast or convert from System.String to System.Drawing.Size.
at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
Exception_EndOfInnerExceptionStack
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
To Reproduce
Exceptions (if any)
Further technical details
- ASP.NET Core version
- Include the output of
dotnet --info - The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
Activity
mkArtakMSFT commentedon Feb 11, 2021
Thanks for contacting us.
Can you try to disable linking and see whether that will resolve the issue: https://docs.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/configure-linker?view=aspnetcore-3.1#control-linking-with-an-msbuild-property
pranavkm commentedon Feb 11, 2021
It might be that a type converter is being trimmed. FYI @eerhardt
rogerge88 commentedon Feb 11, 2021
Thanks. We are using NET5 not NET core 3.1
IDE: VS 2019
rogerge88 commentedon Feb 11, 2021
we are already used false . but that did not fix the issue. Thanks
eerhardt commentedon Feb 11, 2021
@rogerge88 - can you provide a link to a project (or a .zip) that reproduces the issue?
rogerge88 commentedon Feb 11, 2021
@eerhardt OK and I will upload it. Thanks
rogerge88 commentedon Feb 11, 2021
@eerhardt Zip file is bigger than 10 MB(about 50 MB after zip) , how to upload it?Thanks
eerhardt commentedon Feb 11, 2021
Can you delete the
binandobjfolders before zipping?rogerge88 commentedon Feb 12, 2021
Struct.Issue.zip
@eerhardt Thank you and the zip file has been uploaded. Please let me know if you need more data.Thanks
18 remaining items
eerhardt commentedon Feb 16, 2021
Reopening, as we need to fix the product to support this out of the box.
rogerge88 commentedon Feb 17, 2021
@eerhardt Thank you for helps and we had it to work based on your "to workaround this for now, to unblock yourself 1 & 2..." . However, after implemented the fix you provided the Devop throw below error during build:
------------Error message below-----
021-02-16T16:18:53.3623358Z C:\Program Files\dotnet\sdk\5.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ILLink.targets(88,5): error MSB6006: "dotnet.exe" exited with code 255. [Client.csproj]
2021-02-16T16:18:53.3637813Z Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
2021-02-16T16:18:53.3654873Z C:\Program Files\dotnet\sdk\5.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ILLink.targets(41,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. [Client.csproj]
eerhardt commentedon Feb 17, 2021
It sounds like the linker is throwing an exception for some reason. Is that all the error logs you are getting? It should be printing out what exception occurred, which will point you to what is wrong.
I'm just guessing, but you might have the wrong file name in your .csproj. Make sure you are pointing to the right file in
And make sure the
ILLink.Descriptors.xmlfile exists on the machine and is next to the Client.csproj.rogerge88 commentedon Feb 17, 2021
@eerhardt The issues has been fixed and we can get the correct result coming from the server.
Thank you!
rogerge88 commentedon Mar 10, 2021
@eerhardt and all, The "same issue happened when getting the enum attribute. it works locally but not after deployment" . The following is the code for you to duplicate the issue. Thanks.
------------Code below----------
category local result = "category", after deployment result = "PropertyCategorycategory"
Please let me know if you need more info about this issue. Thanks!
rogerge88 commentedon Mar 12, 2021
-----Could you please give us some suggestion for above the new related issue? Thanks!
eerhardt commentedon Mar 12, 2021
@rogerge88 - This is a new issue. In the future, please open a new issue when you have a new scenario.
I've opened #49554 for this new issue.
To work around it until we can get a fix out, you can set:
in your .csproj.
rogerge88 commentedon Mar 12, 2021
@eerhardt Got it and thank you very much!
We will check this new issue at #49554. Thanks!
eerhardt commentedon May 11, 2021
This may be fixed by the work we've done for facades. Assigning to myself to re-test.
eerhardt commentedon May 21, 2021
This is now fixed with the latest bits. Closing.