Cysharp / ZLogger

Zero Allocation Text/Structured Logger for .NET with StringInterpolation and Source Generator, built on top of a Microsoft.Extensions.Logging.
MIT License
1.14k stars 80 forks source link

Load Assembly faild in unity 2021.3.12(MacOs)/15(Win11) #66

Closed DeanHH closed 9 months ago

DeanHH commented 1 year ago

Assembly 'Library/ScriptAssemblies/Assembly-CSharp.dll' will not be loaded due to errors: Reference has errors 'Microsoft.Extensions.Logging'.

Assembly 'Library/ScriptAssemblies/Assembly-CSharp-Editor.dll' will not be loaded due to errors: Reference has errors 'Assembly-CSharp'.

Assembly 'Library/ScriptAssemblies/ZLogger.dll' will not be loaded due to errors: Reference has errors 'Microsoft.Extensions.Logging'.

Assembly 'Assets/Plugins/Microsoft.Extensions.Logging.dll' will not be loaded due to errors: Unable to resolve reference 'System.Diagnostics.DiagnosticSource'. Is the assembly missing or incompatible with the current platform? Reference validation can be disabled in the Plugin Inspector.

Assembly 'Assets/Plugins/Microsoft.Extensions.Logging.Configuration.dll' will not be loaded due to errors: Reference has errors 'Microsoft.Extensions.Logging'.

SoftwareGuy commented 1 year ago

Going to bump this. Apparently this is on Linux build targets, as it seems that Windows build targets have no problem with resolving of the reference.

That makes ZLogger somewhat useless on Linux build target... BUT a possible work around is to grab System.Diagnostics.DiagnosticSource from NuPkg (at least one that says the NET Standard 2.0 version), extract the NuPkg with 7-Zip and copy the DLL under lib/netstandard2.0 into your Plugins folder.

No more compile error after that.

I do not know if this will work with IL2CPP builds though, but worth a shot at least.

pistoleta commented 1 year ago

same problem on iOS builds with unity 2021.3

pistoleta commented 1 year ago

Going to bump this. Apparently this is on Linux build targets, as it seems that Windows build targets have no problem with resolving of the reference.

That makes ZLogger somewhat useless on Linux build target... BUT a possible work around is to grab System.Diagnostics.DiagnosticSource from NuPkg (at least one that says the NET Standard 2.0 version), extract the NuPkg with 7-Zip and copy the DLL under lib/netstandard2.0 into your Plugins folder.

No more compile error after that.

I do not know if this will work with IL2CPP builds though, but worth a shot at least.

Your workaround works on IL2CPP builds, just built on an iPhone, thanks for the info, helped me a lot.

hadashiA commented 9 months ago

In 1.7.1, System.Diagnostics.DiagnosticsSource.dll was added to the package. If there are any environments where the addition would cause problems, please let us know. Thanks!