Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

DbNull serialization with tests and forward #23897

Merged
merged 2 commits into from
Sep 11, 2017

Conversation

ViktorHofer
Copy link
Member

@ViktorHofer ViktorHofer commented Sep 8, 2017

Fixes https://github.com/dotnet/corefx/issues/23398

Waiting for new coreclr build ingestion: dotnet/coreclr#13845

@ViktorHofer ViktorHofer added * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) area-System.Runtime.Extensions labels Sep 8, 2017
@ViktorHofer ViktorHofer self-assigned this Sep 8, 2017
@danmoseley
Copy link
Member

@dotnet-bot test this please (new clr)

@danmoseley
Copy link
Member

danmoseley commented Sep 9, 2017

mscorlib.forwards.cs(23,73): error CS0234: The type or namespace name 'UnitySerializationHolder' does not exist in the namespace 'System' (are you missing an assembly reference?) [D:\j\workspace\windows-TGrou---c60886e1\src\shims\manual\mscorlib.csproj]

presumably because CoreRT changes have not reached here. You could put this behind #if UAP (if you modify the csproj) and you will need to do that anyway to port to 2.0.

@@ -20,6 +20,7 @@
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.ShortEnumEqualityComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.LongEnumEqualityComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.ListDictionaryInternal))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.UnitySerializationHolder))]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And any idea why I didn't need a TypeForwardedFrom attribute on the UnitySerializationHolder? Is it because it sets the type itself with SerializationInfo.SetType(Type)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I'm fine with this change as it is along the lines as the other ones here. As for the TypeForwardedFrom question I'm not sure I would expect if you serialize on core it would end up with System.Private.CoreLib as the assembly it is from, is that not what is happening?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what's so interesting about it. It doesn't contain the QualifiedAssemblyName, so it's the optimized version without the attribute:

�����ÿÿÿÿ��������������System.UnitySerializationHolder�����Data UnityType
AssemblyName����
����������

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting I don't know why that is. Your the expert here now :) My only guess is that the binary serializer omits assembly names for the core assembly? Not sure though. It is probably worth debugging though the code to understand further.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a guess but need to verify it. Thanks Wes :)

@ViktorHofer
Copy link
Member Author

ViktorHofer commented Sep 11, 2017

presumably because CoreRT changes have not reached here. You could put this behind #if UAP (if you modify the csproj) and you will need to do that anyway to port to 2.0.

Which corert version is release/2.0.0 taking again? I couldn't find a branch for it. Is it stored in vsts? I will disable the TypeForward and the UnitySerializationHolder test in the commit against the release branch. I expect the corert mirror changes now to be in (at least I hope so).

@@ -67,6 +67,14 @@ public void ValidateAgainstBlobs(object obj, string[] blobs)
}

[Fact]
public void UnitySerializationHolderWithAssemblySingleton()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to move this test to System.Runtime.Tests but I will wait with that until I commited my change into the release/2.0.0 branch because it requires the bigger change #23940 to handle "blobs" outside of S.R.Serialization.Formatters.

@ViktorHofer
Copy link
Member Author

@danmosemsft if Wes is ok with change in the mscorlib façade then I believe we can merge it into master. I will then create the release/2.0.0 PRs for both coreclr and corefx. The corefx one with the additional conditional compilation for uap/uapaot.

@ViktorHofer ViktorHofer removed the * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) label Sep 11, 2017
Copy link
Member

@danmoseley danmoseley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works, LGTM

you should mail shiproom today even if it's not ready to port until tomorrow

@ViktorHofer ViktorHofer merged commit 9ab8189 into dotnet:master Sep 11, 2017
@ViktorHofer ViktorHofer deleted the DbNullSerialization branch September 11, 2017 20:50
@danmoseley
Copy link
Member

Just occurred to me is it worth adding a test for a DataTable containing a DBNull (since that is what it is serializable for)

@karelz karelz added this to the 2.1.0 milestone Oct 11, 2017
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* DbNull tests and forward

* UnitySerializationHolder deserialization test added


Commit migrated from dotnet/corefx@9ab8189
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants