Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incremental compiler compatibility fixes #52

Merged
merged 3 commits into from
Oct 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give an example of a type in netstandard.dll that is needed? I haven't tried that Unity version yet

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my case:

[SyncVar]
public string DisplayName;

[SyncVar]
public bool IsAlive;

Results in System.String and System.Boolean being referenced from netstandard.dll

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an expert on the topic, but you can refer to the comment here for an explanation why this occurs
dotnet/standard#146 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

)
{
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