diff --git a/Assets/Mirror/Plugins/Mirror.Weaver.dll b/Assets/Mirror/Plugins/Mirror.Weaver.dll index c59a3e8d3..d1e4cf0bf 100644 Binary files a/Assets/Mirror/Plugins/Mirror.Weaver.dll and b/Assets/Mirror/Plugins/Mirror.Weaver.dll differ diff --git a/Weaver/Weaver/CompilationFinishedHook.cs b/Weaver/Weaver/CompilationFinishedHook.cs index fb9cd0765..9b08e5a9f 100644 --- a/Weaver/Weaver/CompilationFinishedHook.cs +++ b/Weaver/Weaver/CompilationFinishedHook.cs @@ -25,25 +25,26 @@ public class CompilationFinishedHook static void HandleMessage(string msg) { if (UnityLogEnabled) Debug.Log(msg); - OnWeaverMessage?.Invoke(msg); + if (OnWeaverMessage != null) OnWeaverMessage.Invoke(msg); } // warning message handler that also calls OnWarningMethod delegate static void HandleWarning(string msg) { if (UnityLogEnabled) Debug.LogWarning(msg); - OnWeaverWarning?.Invoke(msg); + if (OnWeaverWarning != null) OnWeaverWarning.Invoke(msg); } // error message handler that also calls OnErrorMethod delegate static void HandleError(string msg) { if (UnityLogEnabled) Debug.LogError(msg); - OnWeaverError?.Invoke(msg); + if (OnWeaverError != null) OnWeaverError.Invoke(msg); } static CompilationFinishedHook() { + UnityLogEnabled = true; // assemblyPath: Library/ScriptAssemblies/Assembly-CSharp.dll/ // assemblyPath: Library/ScriptAssemblies/Assembly-CSharp-Editor.dll CompilationPipeline.assemblyCompilationFinished += (assemblyPath, messages) => @@ -85,7 +86,8 @@ static CompilationFinishedHook() bool buildingForEditor = assemblyPath.EndsWith("Editor.dll"); if (!buildingForEditor) { - if (UnityLogEnabled) Console.WriteLine("Weaving: " + assemblyPath); + //if (UnityLogEnabled) Debug.Log("Weaving: " + assemblyPath); // uncomment to easily observe weave targets + Console.WriteLine("Weaving: " + assemblyPath); // assemblyResolver: unity uses this by default: // ICompilationExtension compilationExtension = GetCompilationExtension(); // IAssemblyResolver assemblyResolver = compilationExtension.GetAssemblyResolver(editor, file, null); diff --git a/Weaver/Weaver/Weaver.cs b/Weaver/Weaver/Weaver.cs index 4ec5dab5d..b22036d1a 100644 --- a/Weaver/Weaver/Weaver.cs +++ b/Weaver/Weaver/Weaver.cs @@ -1466,31 +1466,6 @@ static bool Weave(string assName, IEnumerable dependencies, IAssemblyRes //Console.WriteLine ("Output:" + dest); WriterParameters writeParams = Helpers.GetWriterParameters(readParams); - - // PdbWriterProvider uses ISymUnmanagedWriter2 COM interface but Mono can't invoke a method on it and crashes (actually it first throws the following exception and then crashes). - // One solution would be to convert UNetWeaver to exe file and run it on .NET on Windows (I have tested that and it works). - // However it's much more simple to just write mdb file. - // System.NullReferenceException: Object reference not set to an instance of an object - // at(wrapper cominterop - invoke) Mono.Cecil.Pdb.ISymUnmanagedWriter2:DefineDocument(string, System.Guid &, System.Guid &, System.Guid &, Mono.Cecil.Pdb.ISymUnmanagedDocumentWriter &) - // at Mono.Cecil.Pdb.SymWriter.DefineDocument(System.String url, Guid language, Guid languageVendor, Guid documentType)[0x00000] in < filename unknown >:0 - if (writeParams.SymbolWriterProvider is PdbWriterProvider) - { - writeParams.SymbolWriterProvider = new MdbWriterProvider(); - // old pdb file is out of date so delete it. symbols will be stored in mdb - string pdb = Path.ChangeExtension(assName, ".pdb"); - - try - { - File.Delete(pdb); - } - catch (Exception ex) - { - // workaround until Unity fixes C#7 compiler compability with the UNET weaver - // un-comment it if you want lot of noise - //UnityEngine.Debug.LogWarning(string.Format("Unable to delete file {0}: {1}", pdb, ex.Message)); - } - } - CurrentAssembly.Write(dest, writeParams); }