mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-01-04 00:23:31 +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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -20,6 +19,7 @@ using UniverseLib.UI.Models;
|
|||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using UniverseLib.Runtime;
|
using UniverseLib.Runtime;
|
||||||
|
using Mono.CSharp;
|
||||||
|
|
||||||
namespace UnityExplorer.CSConsole
|
namespace UnityExplorer.CSConsole
|
||||||
{
|
{
|
||||||
@ -44,7 +44,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
public static bool EnableAutoIndent { get; private set; } = true;
|
public static bool EnableAutoIndent { get; private set; } = true;
|
||||||
public static bool EnableSuggestions { 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[]
|
internal static readonly string[] DefaultUsing = new string[]
|
||||||
{
|
{
|
||||||
@ -68,7 +68,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ResetConsole(false);
|
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");
|
Evaluator.Compile("0 == 0");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -165,7 +165,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
AddUsing(use);
|
AddUsing(use);
|
||||||
|
|
||||||
if (logSuccess)
|
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)
|
public static void AddUsing(string assemblyName)
|
||||||
@ -641,22 +641,34 @@ namespace UnityExplorer.CSConsole
|
|||||||
|
|
||||||
if (ex is NotSupportedException)
|
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:
|
Easy, dirty fix: (will likely break on game updates)
|
||||||
* Download the Unity Editor version that the game uses
|
* Download the corlibs for the game's Unity version from here: https://unity.bepinex.dev/corlibs/
|
||||||
* Navigate to the folder:
|
* Unzip and copy mscorlib.dll (and System.Reflection.Emit DLLs, if present) from the folder
|
||||||
- Editor\Data\PlaybackEngines\windowsstandalonesupport\Variations\mono\Managed
|
* Paste and overwrite the files into <Game>_Data/Managed/
|
||||||
- or, Editor\Data\MonoBleedingEdge\lib\mono\4.5
|
|
||||||
* Copy the mscorlib.dll and System.Reflection.Emit DLLs from the folder
|
With UnityDoorstop: (BepInEx only, or if you use UnityDoorstop + Standalone release):
|
||||||
* Make a subfolder in the folder that contains doorstop_config.ini
|
* Download the corlibs for the game's Unity version from here: https://unity.bepinex.dev/corlibs/
|
||||||
* Put the DLLs inside the subfolder
|
* Unzip and copy mscorlib.dll (and System.Reflection.Emit DLLs, if present) from the folder
|
||||||
* Set the 'dllSearchPathOverride' in doorstop_config.ini to the subfolder name";
|
* 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
|
else
|
||||||
{
|
{
|
||||||
Input.Text = $@"The C# Console has been disabled because of an unknown error.
|
Input.Text = $"The C# Console has been disabled. {ex}";
|
||||||
{ex}";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user