You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MessagePack broken at runtime when compiled with .NET Native #159
I've been trying to compile a UWP application in Release mode with .NET Native enabled, I see there is a lot of effort to eliminate the dynamic resolvers via #ifdef UNITY_WSA, for Unity, would there be something similar for .NET Native? Defining UNITY_WSA in my project didn't get me anywhere.
Thanks.
I had to #ifdef out some more code and get rid of all [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] because they triggered a bug in MS's NET Native release build chain (nutc_driver.exe was running out of memory) so it finally worked for me, if anybody is interested I'll be happy to post the complete code changes.
When UWP moves to C#/WinRT and WinUI 3, will this issue be "implicitly" resolved? (Specifically, being able to use Contractless/dynamic resolvers.)
If not, please re-open it.
I can't imagine that MessagePack plans to never work with UWP (which is basically required for Windows 10X, Xbox, HoloLens, etc).
This isn't a problem with UWP per se. It's a problem with AOT environments, among which UWP is sometimes a member. Some AOT environments also allow JITting code. UWP is one of these, AFAIK. But it isn't UWP (which is just an app model) that might screw this up. It's .NET Native. And whether you compile for WinUI or UWP, if you're compiling for .NET Native, the limitations in the toolset's ability to predict and generate all the generic types still applies.
I just haven't used .NET Native enough to understand why it won't use the JIT at runtime as necessary to compile these dynamic types. I guess it is written to fail instead of bring in the JIT when necessary?
I forgot to post an update here earlier. I have decided to shelve this issue for two reasons:
Performance is not currently a concern for me, so I tried System.Text.Json (in binary mode), and it worked. So, for now, that will do. And when I need performance, I will annotate my classes, which should avoid contractless/dynamic resolvers and (hopefully) work on UWP.
Activity
opsidjflksdf commentedon Nov 8, 2017
I had to
#ifdefout some more code and get rid of all[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]because they triggered a bug in MS's NET Native release build chain (nutc_driver.exe was running out of memory) so it finally worked for me, if anybody is interested I'll be happy to post the complete code changes.AArnott commentedon Dec 4, 2019
That is tracked by #440.
[-]Code gen with .NET Native[/-][+]MessagePack broken at runtime when compiled with .NET Native[/+]github-actions commentedon Apr 10, 2020
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.
github-actions commentedon Jul 10, 2020
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.
github-actions commentedon Nov 2, 2020
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.
MuleaneEve commentedon Apr 11, 2021
When UWP moves to C#/WinRT and WinUI 3, will this issue be "implicitly" resolved? (Specifically, being able to use Contractless/dynamic resolvers.)
If not, please re-open it.
I can't imagine that MessagePack plans to never work with UWP (which is basically required for Windows 10X, Xbox, HoloLens, etc).
AArnott commentedon Apr 17, 2021
This isn't a problem with UWP per se. It's a problem with AOT environments, among which UWP is sometimes a member. Some AOT environments also allow JITting code. UWP is one of these, AFAIK. But it isn't UWP (which is just an app model) that might screw this up. It's .NET Native. And whether you compile for WinUI or UWP, if you're compiling for .NET Native, the limitations in the toolset's ability to predict and generate all the generic types still applies.
I just haven't used .NET Native enough to understand why it won't use the JIT at runtime as necessary to compile these dynamic types. I guess it is written to fail instead of bring in the JIT when necessary?
MuleaneEve commentedon Apr 17, 2021
I see the nuances. Thanks.
Will you re-open this issue?
AArnott commentedon Apr 17, 2021
If someone provides a minimal repro of the problem, yes.
MuleaneEve commentedon Apr 17, 2021
Should I submit a minimal UWP test app as a PR? Or something else?
AArnott commentedon Apr 17, 2021
Let's start with zipping it up and pasting it into this github issue.
MuleaneEve commentedon May 27, 2021
I forgot to post an update here earlier. I have decided to shelve this issue for two reasons:
Bump Microsoft.NET.Test.Sdk from 17.1.0 to 17.2.0 (MessagePack-CSharp…