timcassell / ProtoPromise

Robust and efficient library for management of asynchronous operations in C#/.Net.
MIT License
136 stars 13 forks source link

Compilation error if to use it together with plugin for "oidc-client" (needed for Azure auth) #433

Closed IvanMurzak closed 1 month ago

IvanMurzak commented 2 months ago

That is the conflict with Microsoft.Bcl.AsyncInterfaces.dll, which is part of the Oidc-Client.

Library\PackageCache\com.timcassell.protopromise@3.0.2\Core\Cancelations\CancelationRegistration.cs(117,46): error CS0433: The type 'IAsyncDisposable' exists in both 'Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

Unity version 2022.3.11.

Is there any way to avoid the conflict? I can't disable/remove the DLL because the plugin needs other classes from it. PhotoPromise looks very impressive, I would like to try it if only it could life together with that dll.

image

timcassell commented 2 months ago

@IvanMurzak What types from that dll are not included in .Net Standard 2.1? ProtoPromise uses the types from the standard BCL. Typically libraries like that that have types from the BCL automatically work in non-Unity, so it might be a Unity-specific bug.

timcassell commented 2 months ago

@IvanMurzak I assume you are trying to use this with https://www.nuget.org/packages/IdentityModel.OidcClient? I tried with Unity 2022.3.21 using https://github.com/GlitchEnzo/NuGetForUnity, and I didn't see any errors. Maybe you need to update your Unity version?

IvanMurzak commented 2 months ago

@IvanMurzak What types from that dll are not included in .Net Standard 2.1? ProtoPromise uses the types from the standard BCL. Typically libraries like that that have types from the BCL automatically work in non-Unity, so it might be a Unity-specific bug.

The project I am working on has .NET Framework 4.x. Is the .NET Standard 2.1 required to use ProtoPromise ?

timcassell commented 2 months ago

The project I am working on has .NET Framework 4.x. Is the .NET Standard 2.1 required to use PhotoPromise ?

Unity's 4.X API compatibility level includes .Net Standard 2.1 APIs (unlike desktop Framework). So, no, netstandard2.1 API compatibility level is not required to use ProtoPromise, but you may need to update your Unity version to get it to work (have you tried that yet?).

IvanMurzak commented 2 months ago

The project I am working on has .NET Framework 4.x. Is the .NET Standard 2.1 required to use ProtoPromise ?

Unity's 4.X API compatibility level includes .Net Standard 2.1 APIs (unlike desktop Framework). So, no, netstandard2.1 API compatibility level is not required to use ProtoPromise, but you may need to update your Unity version to get it to work (have you tried that yet?).

Sorry, that is too risky to update Unity version. I won't do that. I can just try to do that with a copy of the project just to let you know if that works. But it won't be a solution for me.

timcassell commented 2 months ago

@IvanMurzak I tried again using Unity 2022.3.11, with .Net Framework API compatibility level. I'm not seeing any errors with only OidcClient and ProtoPromise installed. Are you able to repro in a separate project with just those 2 libraries? Maybe something else is causing the issue. If so, can you share the steps you are using to install the libraries?

IvanMurzak commented 2 months ago

Just tried to update Unity for 2022.3.25. Still have all the errors.

image

IvanMurzak commented 2 months ago

@IvanMurzak I tried again using Unity 2022.3.11, with .Net Framework API compatibility level. I'm not seeing any errors with only OidcClient and ProtoPromise installed. Are you able to repro in a separate project with just those 2 libraries? Maybe something else is causing the issue. If so, can you share the steps you are using to install the libraries?

I will try to reinstall OidcClient. I will reply later

timcassell commented 1 month ago

Closing for no repro. I also think it's not an issue with this library.