Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Bug [2021.1.6f] Error "...mono.exe: The system cannot find the file specified." using reflection.emit

Discussion in 'Editor & General Support' started by emelrad12, Oct 1, 2021.

  1. emelrad12

    emelrad12

    Joined:
    Mar 16, 2018
    Posts:
    10
    Basically, I got some Reflection.Emit that emits some dynamic code. I am not using Il2cpp neither UWP just plain old windows. It works fine in the editor but errors in the build.

    The full error is

    SystemException: Error running ...projectDir...\mono\mini\mono.exe: The system cannot find the file specified.


    The build is in folder ...projectDir...\builds\build1

    So it is trying to find something using project specific path which is also bad.

    The place where the error is called is

    https://github.com/mono/mono/blob/main/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs
    line 128

    throw new SystemException (String.Format ("Error running {0}: {1}", mcs.StartInfo.FileName,
    Win32Exception.GetErrorMessage (exc.NativeErrorCode)));


    Does anyone have experience running Emit in build?
     
    tatsuuuuuuu likes this.
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,571
    That's nice but you didn't say if the mini mono.exe is also there, and if you can run it manually or not.

    If it is there it might need some kind of fancy new Windows permissions.

    It might not even be there.
     
  3. emelrad12

    emelrad12

    Joined:
    Mar 16, 2018
    Posts:
    10
    nope, no such folder exists
     
  4. severe-studios

    severe-studios

    Joined:
    Jan 6, 2020
    Posts:
    7
    Hi all, I'm having this exact situation as well. I am in need of figuring out how to get code to compile dynamically without getting the error: "Error running <projects_dir>\mono\mini\mono.exe: The system cannot find the file specified." All dynamic compilation works beautifully within the editor (ver 2021.3.15f1) but fails when running as a standalone. Does anyone else have experience with this?