mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 19:10:32 +00:00
fix: #2503 Weaver Custom Read Write functions for Serialization not working over multiple assembly definitions
This commit is contained in:
parent
58863e16a7
commit
dcfab19ab8
@ -98,7 +98,13 @@ public AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters p
|
||||
// let's make it obvious why we returned null for easier debugging.
|
||||
// NOTE: if this fails for "System.Private.CoreLib":
|
||||
// ILPostProcessorReflectionImporter fixes it!
|
||||
|
||||
// the fix for #2503 started showing this warning for Bee.BeeDriver on mac,
|
||||
// which is for compilation. we can ignore that one.
|
||||
if (name.Name != "Bee.BeeDriver")
|
||||
{
|
||||
Log.Warning($"ILPostProcessorAssemblyResolver.Resolve: Failed to find file for {name}");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// finds all readers and writers and register them
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Mono.CecilX;
|
||||
using Mono.CecilX.Cil;
|
||||
@ -17,6 +18,21 @@ public static bool Process(AssemblyDefinition CurrentAssembly, IAssemblyResolver
|
||||
// otherwise Unity crashes when running tests
|
||||
ProcessMirrorAssemblyClasses(CurrentAssembly, resolver, Log, writers, readers, ref WeavingFailed);
|
||||
|
||||
// process dependencies first, this way weaver can process types of other assemblies properly.
|
||||
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2503
|
||||
//
|
||||
// find NetworkReader/Writer extensions in referenced assemblies
|
||||
// save a copy of the collection enumerator since it appears to be modified at some point during iteration
|
||||
IEnumerable<AssemblyNameReference> assemblyReferences = CurrentAssembly.MainModule.AssemblyReferences.ToList();
|
||||
foreach (AssemblyNameReference assemblyNameReference in assemblyReferences)
|
||||
{
|
||||
AssemblyDefinition referencedAssembly = resolver.Resolve(assemblyNameReference);
|
||||
if (referencedAssembly != null)
|
||||
{
|
||||
ProcessAssemblyClasses(CurrentAssembly, referencedAssembly, writers, readers, ref WeavingFailed);
|
||||
}
|
||||
}
|
||||
|
||||
// find readers/writers in the assembly we are in right now.
|
||||
return ProcessAssemblyClasses(CurrentAssembly, CurrentAssembly, writers, readers, ref WeavingFailed);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user