Skip to content

Commit

Permalink
Incremental compiler compatibility fixes (#52)
Browse files Browse the repository at this point in the history
* Catch exception during weaving when .pdb is locked

* Allow built-in types from netstandard.dll

* Revert whitespace changes in 56d2164
  • Loading branch information
apkd authored and vis2k committed Oct 6, 2018
1 parent 30ade03 commit b531b4d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Mirror/Weaver/UNetBehaviourProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,8 @@ void ProcessSyncVars()
fieldModuleName != Weaver.m_UnityAssemblyDefinition.MainModule.Name &&
fieldModuleName != Weaver.m_UNetAssemblyDefinition.MainModule.Name &&
fieldModuleName != Weaver.corLib.Name &&
fieldModuleName != "System.Runtime.dll" // this is only for Metro, built-in types are not in corlib on metro
fieldModuleName != "System.Runtime.dll" && // this is only for Metro, built-in types are not in corlib on metro
fieldModuleName != "netstandard.dll" // handle built-in types when weaving new C#7 compiler assemblies
)
{
Log.Error("SyncVar [" + fd.FullName + "] from " + resolvedField.Module.ToString() + " cannot be a different module.");
Expand Down
11 changes: 10 additions & 1 deletion Mirror/Weaver/Weaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1868,7 +1868,16 @@ static bool Weave(string assName, IEnumerable<string> dependencies, IAssemblyRes
writeParams.SymbolWriterProvider = new MdbWriterProvider();
// old pdb file is out of date so delete it. symbols will be stored in mdb
var pdb = Path.ChangeExtension(assName, ".pdb");
File.Delete(pdb);

try
{
File.Delete(pdb);
}
catch (Exception ex)
{
// workaround until Unity fixes C#7 compiler compability with the UNET weaver
UnityEngine.Debug.LogWarning($"Unable to delete file {pdb}: {ex.Message}");
}
}

scriptDef.Write(dest, writeParams);
Expand Down

0 comments on commit b531b4d

Please sign in to comment.