needle-console icon indicating copy to clipboard operation
needle-console copied to clipboard

Compilation errors in Unity 6 with .NET Standard

Open laicasaane opened this issue 1 year ago • 4 comments

Steps to reproduce:

  1. Create a new project with Unity 6000.0.27f1
  2. Platform is Windows
  3. Install the latest version of Needle Console via OpenUPM
  4. In Project Settings > Player, set Editor Assemblies Compatibility Level to .NET Standard

image

Expected result:

No compilation error.

Actual result:

Multiple compilation errors:

Library\PackageCache\com.needle.console\Editor\CustomConsole\Patch_ConsoleWindowListView.cs(36,44):
error CS7069: Reference to type 'LocalBuilder' claims it is defined in 'mscorlib', but it could not be found
Library\PackageCache\com.needle.console\Editor\CustomConsole\Patch_ConsoleWindowListView.cs(59,12):
error CS7069: Reference to type 'Label' claims it is defined in 'mscorlib', but it could not be found
Library\PackageCache\com.needle.console\Editor\CustomConsole\Patch_ConsoleWindowListView.cs(59,23):
error CS1503: Argument 1: cannot convert from 'System.Reflection.Emit.Label [C:\Programs\Unity\Hub\Editor\6000.0.27f1\Editor\Data\NetStandard\ref\2.1.0\netstandard.dll]'
to 'System.Reflection.Emit.Label [C:\Programs\Unity\Hub\Editor\6000.0.27f1\Editor\Data\NetStandard\compat\2.1.0\shims\netfx\mscorlib.dll]'

laicasaane avatar Nov 28 '24 04:11 laicasaane

Thanks for reporting this. I will investigate as soon as possible. Please let me know if you purchased a license for Needle Console.

In the meantime you could try to update the harmony dependency used in the project and let me know if that changes anything

marwie avatar Dec 13 '24 01:12 marwie

Please let me know if you purchased a license for Needle Console.

I don't have one. I use Needle Console on open sourced projects only.

laicasaane avatar Dec 13 '24 01:12 laicasaane

Same here. Using Linux and also .NET Standard for editor. Cannot use it meanwhile (it does not compile).

brmassa avatar Apr 20 '25 21:04 brmassa

Finally got some time to reproduce the issue, sorry for the delay. The compilation error should be gone with version 2.4.3 but unfortunately I didn't find a way to allow using System.Reflection with .Net Standard in the time available so Needle Console will not be able to patch the Unity console in the meantime (this only affects cases where the Unity Editor assembly compilation level is set to .NET Standard. The default settings using .NET Framework will work as before)

If anyone has a workaround or fix to allow access to the System.Reflection.Emit namespace (to use e.g. LocalBuilder) i'd be happy to accept PRs

marwie avatar May 29 '25 15:05 marwie