Skip to content

Commit

Permalink
fix: error with missing assemblies (#1052)
Browse files Browse the repository at this point in the history
* fix: error with missing assemblies

During first import,  the weaver will be called before all assemblies
are built.  No need to look for custom readers and writers if the assemblies
are not built.

fixes #1051

* forgot using
  • Loading branch information
paulpach committed Sep 3, 2019
1 parent 74faf2a commit 00eb23a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Assets/Mirror/Editor/Weaver/Processors/ReaderWriterProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using UnityEditor.Compilation;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace Mirror.Weaver
{
Expand All @@ -18,10 +19,18 @@ public static void ProcessReadersAndWriters(AssemblyDefinition CurrentAssembly)
{
if (unityAsm.name != CurrentAssembly.Name.Name)
{
using (DefaultAssemblyResolver asmResolver = new DefaultAssemblyResolver())
using (AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(unityAsm.outputPath, new ReaderParameters { ReadWrite = false, ReadSymbols = true, AssemblyResolver = asmResolver }))
try
{
ProcessAssemblyClasses(CurrentAssembly, assembly);
using (DefaultAssemblyResolver asmResolver = new DefaultAssemblyResolver())
using (AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(unityAsm.outputPath, new ReaderParameters { ReadWrite = false, ReadSymbols = true, AssemblyResolver = asmResolver }))
{
ProcessAssemblyClasses(CurrentAssembly, assembly);
}
}
catch(FileNotFoundException)
{
// During first import, this gets called before some assemblies
// are built, just skip them
}
}
}
Expand Down

0 comments on commit 00eb23a

Please sign in to comment.