* fix: prevent allocation of massive array
A poison message could contain an invalid length causing us to allocate massive arrays
* throw exception instead
* Update Assets/Mirror/Runtime/NetworkReader.cs
Co-authored-by: James Frowen <jamesfrowendev@gmail.com>
* test for ReadArray
* swapping order of equation so that length doesnt overflow
* adding test case
* adding more tests for array length
* swapping order
* fixing expected message
Co-authored-by: James Frowen <jamesfrowendev@gmail.com>
Unity has added new private LogWarning methods in 2020.2 which causes weaver to find the wrong method. Checking the parameters as we as the name will find the correct method.
fixes: https://github.com/vis2k/Mirror/issues/2366
* adding MakeGeneric method
* adding tests for NB syncvar+hook
* adding functions to NetworkBehaviour
* getting references to new functions
* fixing NB read so it always reads same number of bytes as write
* adding backing field and serialize for Nb Syncvar
* extra test
* adding ignore to transform test
* fixing test
Seems like this has come up a few times so here is a commit to sort this out.
We shouldn't have to worry about the order of the using, we should just let plugins automatically sort them. They are sorted into alphabetical order expect for system becase we have `dotnet_sort_system_directives_first = true` enabled in `.editorconfig`
* fix: stopping values being reset before OnDestory is called
* matches server side logic
* if an object is being fully destroyed it doesn't need its values to be reset
* adding read/write functions
* adding method to get WriteNetworkBehaviour
* adding methods to weavertypes
* adding method to get ReadNetworkBehaviour
* weaver test for NetworkBehaviour in RPC
* renaming var
* writing tests to make sure read/write works
* registering functions
* changing function and adding comment
* checking any writer is set
* adding Description to test
* collection test
* fixing call
* removing errors, networkbehaviour as read/write
* adding test to use the reader that weaver generates
* fixing import
* simplifying test
* removing null from spawned
* improving throw
* adding code coverage
* applying code suggestions
* Using TypeReference with IEqualityComparer instead of string to keep reference to type
* using targetType to initialize write/read functions
* test to make sure write function is set
```
UnityException: ToString is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'GamePlay' on game object 'GamePlay'.
See "Script Serialization" page in the Unity Manual for further details.
UnityEngine.Object.ToString () (at <a979f18d51af41179d12b797e8c5be14>:0)
UnityEngine.Logger.GetString (System.Object message) (at <a979f18d51af41179d12b797e8c5be14>:0)
UnityEngine.Logger.LogError (System.String tag, System.Object message) (at <a979f18d51af41179d12b797e8c5be14>:0)
Mirror.NetworkBehaviour.InitSyncObject (Mirror.SyncObject syncObject) (at Assets/System/3rdParty/Mirror/Runtime/NetworkBehaviour.cs:168)
myGame.GamePlay..ctor () (at Assets/System/GamePlay.cs:18)
```