* Isolate net messages in integration tests.
Integration tests don't use Lidgren to connect client and send, instead they just use some in-process channels to communicate. Because of this, the original implementation of net messages *directly* passed the net message instances between client and server instances. This caused issues whenever content would mutate data in a NetMessage after it "passed through".
Now we run the messages through WriteToBuffer() and ReadFromBuffer() so they pass through binary serialization. This means there's no more implicit sharing of the objects.
Note that this requires some trickery: Lidgren's message types have internal constructors. Really ideally we'd change the engine to make this more testable... but that's a content breaking change. Instead I just added InternalsVisibleTo to Lidgren so we can mess with it. We maintain the library ourselves anyways I can do what I want.
Fixes#4836
* Register Robust.UnitTesting as assembly for reflection.
This is necessary so that serialized types in the assembly can be picked up by NetSerializer.
Have to disable automatic reflection on all entity systems/components that tests register manually right now, because otherwise tests break.
* Stop shallow cloning specific net messages in integration tests.
This isn't necessary anymore now that we have a thorough fix.
* Wow I really forgot to copy-paste that line to the other side huh.
* Add test that serializer hash matches.
* Another test one I missed earlier.
* Changelog
Lidgren NetTime.Now is now synchronized to IGameTiming.RealTime.
NetChannel is now a nested class of NetManager.
Add IGameTiming.ServerTime, INetChannel.RemoteTimeOffset, INetChannel.RemoteTime
* make lidgren use spans everywhere where it can
convert custom pooling to shared array pool impl
add unit tests for read/write
add native socket extensions to socket so we can legit pass spans for SendTo/ReceiveFrom
bump version in lidgren csproj
replace some random "% 8" w/ "& 7"
more minor nullability hacks to fix static analysis complaints
made receiving packets use span
minor native sockets refactor to use pinvoke
add read/write constrained/prealloc'd bit stream impl to lidgren and update usages
fixed missing stream cleanup
remove outstanding stream cleanup since it refs buffer thru the class, can't read some other buf
apply suggestions from code review
remove unsafe cruft
* add tests to gh actions
* make stats use interpolation in tostring and remove m_bytesAllocated since it's all in the shared pool now
* this pr still open so fuck it
stats, human readability, faster BitsToHold methods
* add api compatible version of ReadBytes
* rename ReadOnlyStreamWrapper -> ReadOnlyWrapperStream
rename WriteOnlyStreamWrapper -> WriteOnlyWrapperStream
add AppendViaStream, AppenderStream impl
add and update documentation on read/write bytes methods
also fix some goofs
* Project file refactor
Move all the .csproj files to the new .NET Core style.
This doesn't make any difference for compiling for Framework,
but it does reduce a ton of useless boilerplate.
As an extension of this, killed a bunch of uncompiled & unmaintained .cs files.
Compiling for release (to profile) works now.
Removed AnyCPU targets from the solution file.
* Fix compiler warnings.