UnityNuGet icon indicating copy to clipboard operation
UnityNuGet copied to clipboard

Add NSubstitute, NSubstitute.Analyzers.CSharp and Castle.Core

Open nowsprinting opened this issue 1 year ago • 3 comments

The NuGet package needs to respect a few constraints in order to be listed in the curated list:

  • [x] Add a link to the NuGet package:
    • https://www.nuget.org/packages/NSubstitute
    • https://www.nuget.org/packages/NSubstitute.Analyzers.CSharp
    • https://www.nuget.org/packages/Castle.Core
  • [x] It must have non-preview versions (e.g 1.0.0 but not 1.0.0-preview.1)
  • [x] It must provide .NETStandard2.0 assemblies as part of its package
  • [x] The lowest version added must be the lowest .NETStandard2.0 version available
  • [x] The package has been tested with the Unity editor
  • [x] The package has been tested with a Unity standalone player
    • if the package is not compatible with standalone player, please add a comment to a Known issues section to the top level readme.md
  • [x] All package dependencies with .NETStandard 2.0 target must be added to the PR (respecting the same rules above)
    • Note that if a future version of the package adds a new dependency, this dependency will have to be added manually as well

Note: The server will be updated only when a new version tag is pushed on the main branch, not necessarily after merging this pull-request.

nowsprinting avatar Jul 26 '22 16:07 nowsprinting

if the package is not compatible with standalone player, please add a comment to a Known issues section to the top level readme.md

I do not find the “known issue” section.

The following conditions are required to run Castle.Core with standalone player.

  • Scripting Backend: Mono
  • API Compatibility Level: .NET Framework

See https://forum.unity.com/threads/castle-core-dynamicproxy-in-2018-3b12.591478/

nowsprinting avatar Jul 26 '22 16:07 nowsprinting

Add defineConstraints: UNITY_EDITOR

refs #121

nowsprinting avatar Jul 27 '22 13:07 nowsprinting

Change to draft. wait for fix https://github.com/nsubstitute/NSubstitute/pull/701

nowsprinting avatar Jul 29 '22 13:07 nowsprinting

Worked on Unity 2021.2+ 🎉 Thanks, @bdovaz san!

However, runtime error occurred on under Unity 2021.2.

System.PlatformNotSupportedException : System.Reflection.Emit is not supported on this platform.

Catsle.Core v5.0.0 depends on System.Reflection.Emit. Workaround is to use Castle.Core v4, but Castle.Core v4 does not support .NET Standard 2.0.

Currently, NSubstitute will have to be required Unity 2021.2+.

nowsprinting avatar Jan 18 '23 05:01 nowsprinting

@nowsprinting if I remember correctly, I think they added in Unity 2021.2.x the possibility to change the .NET profile to .NET Standard 2.1.

I think it would only work from that version onwards and as long as you have .NET Standard 2.1 set.

I haven't tested it, you can try it and we will find out.

bdovaz avatar Jan 18 '23 07:01 bdovaz

@bdovaz thanks, Castle.Core v5 depends on System.Reflection.Emit and System.Diagnostics.EventLog when using .NETStandard 2.0. When using .NETStandard 2.1, only depends on System.Diagnostics.EventLog. So running correctly.

see https://www.nuget.org/packages/Castle.Core/5.0.0#dependencies-body-tab

nowsprinting avatar Jan 18 '23 07:01 nowsprinting

@nowsprinting well in this case I do not know if it is worth a section in the Readme.md or another new page to note these things.... Let's see what @xoofx thinks

I also tell you that who uses UnityNuGet and does it directly from Unity, unless he goes to the Github project, he is hardly going to see this page.

bdovaz avatar Jan 18 '23 07:01 bdovaz

I created two issues for this resolution.

nowsprinting avatar Jan 18 '23 09:01 nowsprinting