Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
This repository was archived by the owner on Aug 27, 2026. It is now read-only.

Port jnimarshalmethod-gen.exe to net5 #616

Closed

Description

@jonpryor

At present, tools/jnimarshalmethod-gen only builds against the net472 target framework. For .NET 5 support, we believe that we'd need to port this utility to run on .NET 5, and at present that would be by porting to the netcoreapp3.1 target framework.

Unfortunately, .NET Core currently doesn't support AssemblyBuilder.Save(): dotnet/runtime#15704

We will need to investigate if it's even possible to port jnimarshalmethod-gen.exe to .NET Core and .NET 5, assuming that the above issue is not fixed. (Note: above issue was opened in 2015…)

Activity

  1. added
    callable-wrappersIssues with Java Callable Wrappers
    enhancementProposed change to current functionality
    on Apr 6, 2020
  2. jonpryor commented on Jul 21, 2021

    @jonpryor
    ContributorAuthor

    While AssemblyBuilder.Save() and AssemblyBuilderAccess.Save no longer exist, there is an AssemblyBuilderAccess.RunAndSave value, and the AssemblyBuilder docs do mention the ability to save IL to disk:

    AssemblyBuilderAccess.RunAndSave is specified when the assembly is created. The assembly code is used immediately, and the assembly is also saved to disk so that it can be examined with Ildasm.exe (IL Disassembler) or used in another program.

    This suggests that we can migrate jnimarshalmethod-gen.exe to net5 or net6…

    …except their own example is using AssemblyBuilder.Save()! This is not particularly encouraging…

  3. jonpryor commented on Jul 21, 2021

    @jonpryor
    ContributorAuthor

    …oh, and AssemblyBuilderAccess.RunAndSave doesn't actually exist:

    error CS0117: 'AssemblyBuilderAccess' does not contain a definition for 'RunAndSave'
    

    Nope, still no workaround. Plus, obsolete docs!

  4. NickAcPT commented on Jul 22, 2021

    @NickAcPT

    When I faced this exact issue on another project, I did a bit of research and it appears that one of the few workarounds is to use something like https://github.com/Lokad/ILPack.

    Although I'm not quite sure if it can serve as a reliable drop-in workaround for jnimarshalmethod-gen

  5. locked and limited conversation to collaborators on Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    callable-wrappersIssues with Java Callable WrappersenhancementProposed change to current functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions