From 08fdffd6abf4b12e12752a2e9c42c924b4e77c15 Mon Sep 17 00:00:00 2001 From: vis2k Date: Sun, 22 Aug 2021 20:46:38 +0800 Subject: [PATCH] comments --- .../Editor/Weaver/EntryPoint/CompilationFinishedHook.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Assets/Mirror/Editor/Weaver/EntryPoint/CompilationFinishedHook.cs b/Assets/Mirror/Editor/Weaver/EntryPoint/CompilationFinishedHook.cs index 353efbd32..1d39bfacc 100644 --- a/Assets/Mirror/Editor/Weaver/EntryPoint/CompilationFinishedHook.cs +++ b/Assets/Mirror/Editor/Weaver/EntryPoint/CompilationFinishedHook.cs @@ -155,17 +155,24 @@ static bool WeaveFromFile(string assemblyPath, string[] dependencies) // open the file as stream using (FileStream stream = new FileStream(assemblyPath, FileMode.Open, FileAccess.ReadWrite)) { + // resolver for this assembly using (DefaultAssemblyResolver asmResolver = new DefaultAssemblyResolver()) { + // read assembly with the following parameters ReaderParameters readerParameters = new ReaderParameters { ReadWrite = true, ReadSymbols = true, AssemblyResolver = asmResolver }; + + // read assembly from stream with parameters using (AssemblyDefinition asmDef = AssemblyDefinition.ReadAssembly(stream, readerParameters)) { + // add this assembly's path and unity's assembly path asmResolver.AddSearchDirectory(Path.GetDirectoryName(assemblyPath)); asmResolver.AddSearchDirectory(Helpers.UnityEngineDllDirectoryName()); + + // add dependencies if (dependencies != null) { foreach (string path in dependencies)