mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2024-12-23 01:59:40 +08:00
Update Emit exception message
This commit is contained in:
parent
96451477ee
commit
6110c59721
@ -1,5 +1,4 @@
|
||||
using Mono.CSharp;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@ -20,6 +19,7 @@ using UniverseLib.UI.Models;
|
||||
using UniverseLib.Utility;
|
||||
using HarmonyLib;
|
||||
using UniverseLib.Runtime;
|
||||
using Mono.CSharp;
|
||||
|
||||
namespace UnityExplorer.CSConsole
|
||||
{
|
||||
@ -44,7 +44,7 @@ namespace UnityExplorer.CSConsole
|
||||
public static bool EnableAutoIndent { get; private set; } = true;
|
||||
public static bool EnableSuggestions { get; private set; } = true;
|
||||
|
||||
internal static string ScriptsFolder => Path.Combine(ExplorerCore.Loader.ExplorerFolder, "Scripts");
|
||||
internal static string ScriptsFolder => Path.Combine(ExplorerCore.ExplorerFolder, "Scripts");
|
||||
|
||||
internal static readonly string[] DefaultUsing = new string[]
|
||||
{
|
||||
@ -68,7 +68,7 @@ namespace UnityExplorer.CSConsole
|
||||
try
|
||||
{
|
||||
ResetConsole(false);
|
||||
// ensure the compiler is supported (if this fails then SRE is probably stubbed)
|
||||
// ensure the compiler is supported (if this fails then SRE is probably stripped)
|
||||
Evaluator.Compile("0 == 0");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -165,7 +165,7 @@ namespace UnityExplorer.CSConsole
|
||||
AddUsing(use);
|
||||
|
||||
if (logSuccess)
|
||||
ExplorerCore.Log($"C# Console reset. Using directives:\r\n{Evaluator.GetUsing()}");
|
||||
ExplorerCore.Log($"C# Console reset");//. Using directives:\r\n{Evaluator.GetUsing()}");
|
||||
}
|
||||
|
||||
public static void AddUsing(string assemblyName)
|
||||
@ -641,22 +641,34 @@ namespace UnityExplorer.CSConsole
|
||||
|
||||
if (ex is NotSupportedException)
|
||||
{
|
||||
Input.Text = $@"The C# Console has been disabled because System.Reflection.Emit threw an exception: {ex.ReflectionExToString()}
|
||||
Input.Text = $@"The C# Console has been disabled because System.Reflection.Emit threw a NotSupportedException.
|
||||
|
||||
If the game was built with Unity's stubbed netstandard 2.0 runtime, you can fix this with UnityDoorstop:
|
||||
* Download the Unity Editor version that the game uses
|
||||
* Navigate to the folder:
|
||||
- Editor\Data\PlaybackEngines\windowsstandalonesupport\Variations\mono\Managed
|
||||
- or, Editor\Data\MonoBleedingEdge\lib\mono\4.5
|
||||
* Copy the mscorlib.dll and System.Reflection.Emit DLLs from the folder
|
||||
* Make a subfolder in the folder that contains doorstop_config.ini
|
||||
* Put the DLLs inside the subfolder
|
||||
* Set the 'dllSearchPathOverride' in doorstop_config.ini to the subfolder name";
|
||||
Easy, dirty fix: (will likely break on game updates)
|
||||
* Download the corlibs for the game's Unity version from here: https://unity.bepinex.dev/corlibs/
|
||||
* Unzip and copy mscorlib.dll (and System.Reflection.Emit DLLs, if present) from the folder
|
||||
* Paste and overwrite the files into <Game>_Data/Managed/
|
||||
|
||||
With UnityDoorstop: (BepInEx only, or if you use UnityDoorstop + Standalone release):
|
||||
* Download the corlibs for the game's Unity version from here: https://unity.bepinex.dev/corlibs/
|
||||
* Unzip and copy mscorlib.dll (and System.Reflection.Emit DLLs, if present) from the folder
|
||||
* Find the folder which contains doorstop_config.ini (the game folder, or your r2modman/ThunderstoreModManager profile folder)
|
||||
* Make a subfolder called 'corlibs' inside this folder.
|
||||
* Paste the DLLs inside the corlibs folder.
|
||||
* In doorstop_config.ini, set 'dllSearchPathOverride=corlibs'.
|
||||
|
||||
Doorstop example:
|
||||
- <Game>\
|
||||
- <Game>_Data\...
|
||||
- BepInEx\...
|
||||
- corlibs\
|
||||
- mscorlib.dll
|
||||
- doorstop_config.ini (with dllSearchPathOverride=corlibs)
|
||||
- <Game>.exe
|
||||
- winhttp.dll";
|
||||
}
|
||||
else
|
||||
{
|
||||
Input.Text = $@"The C# Console has been disabled because of an unknown error.
|
||||
{ex}";
|
||||
Input.Text = $"The C# Console has been disabled. {ex}";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user