Skip to content

MessagePack broken at runtime when compiled with .NET Native #159

Closed

Description

@opsidjflksdf

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.

Activity

  1. opsidjflksdf commented on Nov 8, 2017

    @opsidjflksdf
    ContributorAuthor

    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.

  2. AArnott commented on Dec 4, 2019

    @AArnott
    Collaborator

    nutc_driver.exe was running out of memory

    That is tracked by #440.

  3. added this to the v2.0 milestone on Dec 4, 2019
  4. self-assigned this
    on Dec 4, 2019
  5. changed the title [-]Code gen with .NET Native[/-] [+]MessagePack broken at runtime when compiled with .NET Native[/+] on Dec 4, 2019
  6. modified the milestones: v2.0, v2.1 on Dec 10, 2019
  7. modified the milestones: v2.1, v2.2 on Jan 10, 2020
  8. github-actions commented on Apr 10, 2020

    @github-actions
    Contributor

    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.

  9. github-actions commented on Jul 10, 2020

    @github-actions
    Contributor

    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.

  10. removed this from the v2.2 milestone on Aug 3, 2020
  11. github-actions commented on Nov 2, 2020

    @github-actions
    Contributor

    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.

  12. MuleaneEve commented on Apr 11, 2021

    @MuleaneEve

    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).

  13. AArnott commented on Apr 17, 2021

    @AArnott
    Collaborator

    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?

  14. MuleaneEve commented on Apr 17, 2021

    @MuleaneEve

    I see the nuances. Thanks.

    Will you re-open this issue?

  15. AArnott commented on Apr 17, 2021

    @AArnott
    Collaborator

    If someone provides a minimal repro of the problem, yes.

  16. MuleaneEve commented on Apr 17, 2021

    @MuleaneEve

    Should I submit a minimal UWP test app as a PR? Or something else?

  17. AArnott commented on Apr 17, 2021

    @AArnott
    Collaborator

    Let's start with zipping it up and pasting it into this github issue.

  18. MuleaneEve commented on May 27, 2021

    @MuleaneEve

    I forgot to post an update here earlier. I have decided to shelve this issue for two reasons:

    1. 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.
    2. .NET Native seems to be evolving into NativeAOT, so it may be best that any work done now is toward supporting that instead... Here is an interesting issue discussing that future and here is the branch where it is being developed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions