BeardedManStudios / ForgeNetworkingRemastered

See various forks, also please join the Forge Community fork of Forge Alloy! -> https://github.com/ForgeAlloyCommunity/ForgeAlloy
https://twitter.com/FarrisFaulds
Apache License 2.0
1.49k stars 311 forks source link

Heads up: ConcurrentQueue.TryDequeue hides member in (at least) .NET 5.0 #389

Open NoTuxNoBux opened 3 years ago

NoTuxNoBux commented 3 years ago

Version Number and Operating System(s):

Windows 10, Forge Network Alloy at da8e1295ae1d4fada3037740a4b30df679e4e395 (develop).

Expected behavior:

No warnings are shown during build.

Actual behavior:

Warnings are shown during build:

...\Concurrency.cs(32,21): warning CS0108: 'ConcurrentQueue<T>.TryDequeue(out T)' hides inherited member 'Queue<T>.TryDequeue(out T)'. Use the new keyword if hiding was intended. [C:\Users\Me\Projecten\Internal\dotnet-wade-server\Forge\Forge.csproj]

Steps to reproduce:

Use Forge Networking Alloy in a .NET 5.0 project, i.e. copy-paste the ForgeNetworkingRemastered/ForgeUnity/Assets/BeardedManStudios/Scripts/Networking/Forge/Networking folder into a non-Unity C# project and try to build using dotnet build.

The warning will be generated.

Context

This can be solved by adding the new keyword, but it turns out that this in turn generates warnings on older .NET versions such as used by Unity. Apparently this method did not exist before in the standard library and now does. This could mean that in more recent versions, the custom implementation is obsolete.