-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Internal error while xml serializing a byte[] property set to null #421
Comments
The issue is still present on the recently released .net core 3.1.0 . I have updated the example project in the repository. |
@lscorcia Thanks for reporting this, we will be investigating and will follow-up when we have more info. |
Moving this to .NET 6.0 milestone, if needed, we will consider to backport to 3.1. |
I have the same issue on 2.2, I have to pass an empty byte[] instead of null to bypass the problem |
I am facing same issue in 3.1.0. Is there any update on the fix or workaround? |
The issue is still present on .net core 5. I have updated the example project in the repository. |
@lscorcia are you willing to debug/investigate a little further to see why .NET Core is behaving differently? |
Sure, let me know what I can do! |
This isn't actually my area (that's @HongGit team see area-owners.md) but I was assuming you could attach a debugger and see what's going on. Often when there's a regression from .NET Framework it's quite fixable, although again I'm not familiar with this library. |
Instructions for building and debugging are linked from the README. |
So, if I understand correctly, the process would be to create a debug build from the current repo. This would mean preparing the build requirements (vs2019 c++ workload, cmake, etc), cloning the repo at the .net 5 tag, building the full runtime (not just the libraries), then find out how to connect a vs2019 debugger to the built environment and then finally try to understand where the crash comes from. It's going to be a very long process as I will need to do that in a VM as I can't risk borking my work environment, and my machine is a crappy laptop. I will try, but I can't guarantee I will be successful. If you know of any prebuilt debug build somewhere it's probably going to be much easier. |
@lscorcia I should not have said building. I was thinking you could simply attach Visual Studio (any recent version) choosing the ".NET 5" debugger engine, set a function breakpoint on @HongGit is there someone on your team who could give more specific pointers? It seems this is an upgrade blocker for @lscorcia . |
Hi @danmoseley , I did what you suggested and I was able to source-step inside the framework code. The exception is triggered at Lines 1160 to 1163 in 2f740ad
Now, at Line 1096 in 2f740ad
Formatter , so the code does not enter that path, and also atLines 1156 to 1159 in 2f740ad
there is a check for This latter if block has a comment that suggests that the Line 1039 in 2f740ad
I am not familiar with the design of this serialization logic, but maybe the issue is that those checks are being performed on the value instead of using the type descriptor |
What would be interesting is to now figure out what .NET Framework is doing differently. Again using a debugger but you might have to step some more or get creative with how you break in, to find the equivalent point (since it's not throwing) |
Never mind, it seems this codepath may be new in .NET Core: dotnet/corefx#11369 I think we need an area expert to advise now. |
Hi, I am evaluating the porting of some .net 4.7.2 code to .net core 3 and found this problem that I think is a compatibility issue in XML Serialization.
You can find the repro project at https://github.com/lscorcia/net-core-serialization-issue.
Basically we have a WCF Connected Service which takes a couple of objects as parameters. One of them contains a
byte[]
property, declared as nullable in the service definition. This is the relevant generated proxy snippet:When invoking the remote service, the request serialization is ok when the property is set to some value, but fails when the value is null: it throws a
System.ServiceModel.CommunicationException
inSystem.Private.ServiceModel.dll
. Here is the full stack trace:This type of call was working fine in the original .net 4.7.2 software.
I can supply the service WSDL if needed, but I don't think that's relevant - the WCF proxy class looks ok and the error is in the early request creation.
I tried source-stepping in the framework code, but it is heavily optimized and the debugger is not that helpful. It looks like the null value of the array prevents the recognition of the parameter as an array and that it ends up on the wrong code path, but I might be easily mistaken on this.
Please let me know if you need any additional information.
The text was updated successfully, but these errors were encountered: