Skip to content

Fix-ups to get UWP test project building - #642

Merged
AArnott merged 2 commits into
MessagePack-CSharp:masterfrom
AArnott:fixuwp
Nov 17, 2019
Merged

AArnott merged 2 commits into
MessagePack-CSharp:masterfrom
AArnott:fixuwp

Conversation

@AArnott

@AArnott AArnott commented Nov 16, 2019

Copy link
Copy Markdown
Collaborator

This PR doesn't add the UWP test project, but it contains the changes necessary so that a local UWP project that referenced MessagePack (or more accurately, the test projects) could actually compile with the UWP .NET Native toolchain.

There are two key fixes here:

  1. Switch from auto-properties to public fields in the unity shims. .NET Native doesn't like the C# compiler-generated field names.
  2. Updated a nuget dependency chain that terminated with Microsoft.VisualStudio.Threading, which had one line of code that .NET Native couldn't handle. We update to a version of vs-threading that has this fix.

Also bump the vs-threading analyzer version
It breaks .NET Native compilation
@AArnott AArnott added this to the v2.0 milestone Nov 16, 2019
@AArnott
AArnott requested a review from neuecc November 16, 2019 21:04
@AArnott AArnott self-assigned this Nov 16, 2019

@neuecc neuecc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  1. In master, Nerdbank.Streams was removed so other projects also should remove Nerdbank.Streams?
  2. What the reason of exists MessagePack.Internal proj?
  3. Unity shims is for Unity's shim.
    3.1 Unity's Bounds(or other properties) is property so should follow. https://github.com/Unity-Technologies/UnityCsReference/blob/86305f755ec65987bd8de18f3e38bc608adc0ba3/Runtime/Export/Geometry/Bounds.cs
    However, since it is only a receiving point for deserialization, it is acceptable to change to the field.
    3.2 UnityShims is only for server from accept Unity data. In other words, it is not necessary for UWP. We can remove compile target from UWP.

@AArnott

AArnott commented Nov 17, 2019

Copy link
Copy Markdown
Collaborator Author
  1. Test projects require a reference to Nerdbank.Streams because they need access to Sequence<T> (and perhaps other types), but Sequence<T> is (appropriately) internal to MessagePack so the test proejcts need to get it from somewhere else.
  2. It exists in MessagePack.Internal.csproj because when @pranavkm contributed it, he didn't object to the reference, and he didn't build the project to include the repo-local Sequence.cs file. He factored this project to model how he needs it to work in the git superproject that pulls messagepack sources in. So I left it alone. I think I tried removing the reference a week or so ago just to see what would happen and hit a snag anyway.
  3. I'm glad to hear the change to unity shims won't break anyone. And I understand that Unity != UWP. The reason however that this change is necessary is because our test project references the shims and all the other extension projects. If we factored the tests out so that each extension and unity were tested by individual projects, we could leave it out of testing in UWP. But as the tests are factored today, we have to reference the shims too in order for the test project to compile.

@AArnott

AArnott commented Nov 17, 2019

Copy link
Copy Markdown
Collaborator Author

So I just tried again to replace the nerdbank.streams reference in MessagePack.Internal with inclusion of Sequence.cs and it worked. So if @pranavkm wants that, we can make that change (possibly as a distinct PR).

@AArnott
AArnott merged commit f829945 into MessagePack-CSharp:master Nov 17, 2019
@AArnott
AArnott deleted the fixuwp branch November 17, 2019 17:45
@pranavkm

Copy link
Copy Markdown
Contributor

Sure I'll give it a try. Any changes we make here aren't going to ship until ASP.NET Core 5.0, so that gives us plenty of runaway to figure things out 👍

@neuecc

neuecc commented Nov 18, 2019

Copy link
Copy Markdown
Member

The presence of MessagePack.Internal under src of master is confusing and should be deleted if possible.

@AArnott

AArnott commented Nov 18, 2019

Copy link
Copy Markdown
Collaborator Author

@pranavkm See #643 for removal of the dependency.

@neuecc The MessagePack.Internal project helps us keep a clean source dependency boundary so that ASP.NET Core can continue to pick up limited source drops. Would you rather we move it to sandbox?

@neuecc

neuecc commented Nov 18, 2019

Copy link
Copy Markdown
Member

Okay.
In Japanese idiom says shoganai.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants