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

Unity 2021.2 link issues #52

Closed drew-512 closed 2 years ago

drew-512 commented 2 years ago

Hi @neuecc, thank you for all your hard work and I tell people about Zlogger whenever I can!

However, it would be great to secure Unity 2021.2 compatibility as it seems there are multiple linking issues unfortunately. We are switching to 2021.2 and will need to drop Zlogger if we can't resolve this.

So first, one removes the 4 libs now in Unity to clear errors:

Microsoft.Bcl.AsyncInterfaces
System.Buffers
System.Memory
System.Threading.Tasks.Extensions

However, then these two errors appear:

Assets/Scripts/ZLogger/Unity/UnityLoggerFactory.cs(40,33): error CS0012: The type 'IAsyncDisposable' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

Assets/Scripts/ZLogger/Unity/UnityLoggerFactory.cs(41,24): error CS0012: The type 'IAsyncDisposable' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

Also, there are dozens of these warnings:

Assets/Scripts/ZLogger/Entries/FormatLogEntry.cs(22,32): warning CS0436: The type 'AllowNullAttribute' in 'ZLogger/Shims/NullableAttributes.cs' conflicts with the imported type 'AllowNullAttribute' in 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Using the type defined in 'ZLogger/Shims/NullableAttributes.cs'.

Perhaps you could do a distro/release intended for 2021.2? Please let us know how we can support, friend.

noname77 commented 2 years ago

Subscribing, same on 2022 beta.

I can add that since I need to work in multiple Unity environments, instead of removing the mentioned .dlls, I added define constraints to all 4 as pictured below: image

However, this does not solve the errors so I'm also curious how this can be solved

Best Wiktor

noname77 commented 2 years ago

@drew-512 I wanted to report back that i managed to get ZLogger to work with Unity 2021 today with a hint from this unity forum post.

In particulear:

Some steps might not be necessary. It got it working for me, though i only tested in the editor so far.

For reference, i keep the .dlls in Plugins/Cysharp/ZLogger/Plugins and i attached my updated contents of Plugins/Cysharp for anyone interested.

Cysharp.zip

Best, Wiktor

drew-512 commented 2 years ago

Awesome @noname77 thank you so much. Looks like things are safe for now and that is safe to assume things will get better as Unity make key decisions.

Hopefully down the road we can expect more 2021.2 friendly releases but I get that for now the priority is accommodating 2020.X. Until then, thanks again and lmk how we can support ZLogger.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.