Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

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:
    36,153
    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?