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 Shader Graph editor: ExecutionEngineException: String conversion error: Illegal byte sequence

Discussion in 'Editor & General Support' started by shadowdragon0605, Jun 24, 2023.

  1. shadowdragon0605

    shadowdragon0605

    Joined:
    Mar 8, 2023
    Posts:
    2
    When I try to open any shader graph asset on my machine, no matter the unity version (I tried: 2023.2.0a8, 2021.38f1, 2022.9.f1), I get the following exception and a blank shader graph editor screen:
    Code (CSharp):
    1. ExecutionEngineException: String conversion error: Illegal byte sequence encounted in the input.
    2. System.Reflection.RuntimeAssembly.GetCodeBase (System.Reflection.Assembly a, System.Boolean escaped) (at <1fcdd967a2f7479a9b91a0637caa2e7c>:0)
    3. System.Reflection.RuntimeAssembly.get_CodeBase () (at <1fcdd967a2f7479a9b91a0637caa2e7c>:0)
    4. System.Reflection.AssemblyName.Create (System.Reflection.Assembly assembly, System.Boolean fillCodebase) (at <1fcdd967a2f7479a9b91a0637caa2e7c>:0)
    5. System.Reflection.RuntimeAssembly.GetName (System.Boolean copiedName) (at <1fcdd967a2f7479a9b91a0637caa2e7c>:0)
    6. System.Reflection.Assembly.GetName () (at <1fcdd967a2f7479a9b91a0637caa2e7c>:0)
    7. UnityEditor.ShaderGraph.Drawing.MaterialGraphView..ctor () (at ./Library/PackageCache/com.unity.shadergraph@16.0.0/Editor/Drawing/Views/MaterialGraphView.cs:41)
    8. UnityEditor.ShaderGraph.Drawing.MaterialGraphView..ctor (UnityEditor.ShaderGraph.GraphData graph, System.Action previewUpdateDelegate) (at ./Library/PackageCache/com.unity.shadergraph@16.0.0/Editor/Drawing/Views/MaterialGraphView.cs:67)
    9. UnityEditor.ShaderGraph.Drawing.GraphEditorView..ctor (UnityEditor.EditorWindow editorWindow, UnityEditor.ShaderGraph.GraphData graph, UnityEditor.Graphing.Util.MessageManager messageManager, System.String graphName) (at ./Library/PackageCache/com.unity.shadergraph@16.0.0/Editor/Drawing/Views/GraphEditorView.cs:207)
    10. UnityEditor.ShaderGraph.Drawing.MaterialGraphEditWindow.Initialize (System.String assetGuid) (at ./Library/PackageCache/com.unity.shadergraph@16.0.0/Editor/Drawing/MaterialGraphEditWindow.cs:1265)
    11. UnityEditor.ShaderGraph.Drawing.MaterialGraphEditWindow.Update () (at ./Library/PackageCache/com.unity.shadergraph@16.0.0/Editor/Drawing/MaterialGraphEditWindow.cs:277)
    12. UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
    Apparently, my user name, which is a string with hebrew letters, is the problem. I created an empty project inside of C:\temp and there everything works correctly.

    The following part from the constructor of UnityEditor.ShaderGraph.Drawing.MaterialGraphView causes the problem:

    Code (CSharp):
    1. Assembly graphViewAssembly = null;
    2. foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
    3. {
    4.     var assemblyName = assembly.GetName().ToString();
    5.     if (assemblyName.Contains("GraphView"))
    6.     {
    7.         graphViewAssembly = assembly;
    8.     }
    9. }
    The following screenshot shows a list of assemblies for which the evalution of CodeBase fails - those are the assemblies which are not dynamic and located in my user directory (containing hebrew letters).
    The implementation of RuntimeAssembly#GetName uses CodeBase which causes the error.

    upload_2023-6-24_22-56-45.png
     

    Attached Files:

    Nstdspace likes this.
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,560
    Yeah, alas, that's unfortunately a thing.

    Anytime you use characters outside of A-Z and 0-9 in a filename or a path name, you are now an unpaid test pilot for every single piece of software from the operating system down through the video drivers and Unity and every piece of the toolchain and every piece of middleware and software ever installed on your system. Every browser plugin and extension, every toolbar and antivirus solution, everything.

    Every single piece of software, every step of every operation must be coded to handle non-ascii characters. That is unfortunately just not going to be the case.

    Most of that software, probably the vast majority of it, especially the low-level driver stuff, was written by either an intern or a junior guy, or some guy who nobody liked and the tech lead just said "Hey, just have so-and-so finish the driver software, I don't wanna be bothered with it."

    It's just reality.

    And besides, most developers, regardless of locale, never test outside of their own locale.

    PS: underscore (_) you might get away with... space... yikes... space means so much to so many pieces of middleware... the entire default Posix command line relies on spaces to split data apart. Is 100% of all Posix software going to correctly escape it with quotes? What about once it passes it to the NEXT piece of software?

    I stand by my my recommendation: A-Z and 0-9 only for filenames and paths.
     
  3. shadowdragon0605

    shadowdragon0605

    Joined:
    Mar 8, 2023
    Posts:
    2
    I see your point, thanks for the reply. The point is, I do not think that creating a new user name without non-ASCII characters will help me here: My entire system is in Hebrew and windows translates "Desktop" to "שולחן עבודה" (inside of the path). I think Unity should not stop working only because you have non-English windows installed, should it? In this particular case, I am sure there is an easier way to find the correct assembly (which is the purpose of the code above) without using GetName() - maybe FullName is enough (which does not require the evaluation of CodeBase, even for RuntimeAssemblies) ?
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,560
    I totally agree. However, here we are. :)

    When I work in Windows I keep all my Unity projects in
    c:\unity


    You could try making that folder and copying your project over there. Based on your test with C:\Temp, It might work... I simply don't know enough about the tortured path that assemblies and packages go through to arrive at your project.

    Do you use source control? That's another handy way to copy projects without actually creating a separate unrelated instance... lets you keep both copies in perfect synchrony with history.

    PROPERLY CONFIGURING AND USING ENTERPRISE SOURCE CONTROL

    Please consider using proper industrial-grade enterprise-qualified source control in order to guard and protect your hard-earned work.

    Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).

    You can also push git repositories to other drives: thumb drives, USB drives, network drives, etc., effectively putting a complete copy of the repository there.

    As far as configuring Unity to play nice with git, keep this in mind:

    https://forum.unity.com/threads/prefab-links-keep-getting-dumped-on-git-pull.646600/#post-7142306

    I usually make a separate repository for each game, but I have some repositories with a bunch of smaller test games.

    Here is how I use git in one of my games, Jetpack Kurt:

    https://forum.unity.com/threads/2-steps-backwards.965048/#post-6282497

    Using fine-grained source control as you work to refine your engineering:

    https://forum.unity.com/threads/whe...grammer-example-in-text.1048739/#post-6783740

    Share/Sharing source code between projects:

    https://forum.unity.com/threads/your-techniques-to-share-code-between-projects.575959/#post-3835837

    Setting up an appropriate .gitignore file for Unity3D:

    https://forum.unity.com/threads/removing-il2cpp_cache-from-project.1084607/#post-6997067

    Generally the ONLY folders you should ever source control are:

    Assets/
    ProjectSettings/
    Packages/

    NEVER source control Library/ or Temp/ or Logs/
    NEVER source control anything from Visual Studio (.vs, .csproj, none of that noise)

    Setting git up with Unity (includes above .gitignore concepts):

    https://thoughtbot.com/blog/how-to-git-with-unity

    It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place. Digital storage is so unbelievably cheap today that you can buy gigabytes of flash drive storage for about the price of a cup of coffee. It's simply ridiculous not to back up.

    If you plan on joining the software industry, you will be required and expected to know how to use source control.

    "Use source control or you will be really sad sooner or later." - StarManta on the Unity3D forum boards