Skip to content

Fix type reference name in attribute argument getting mangled when - #722

Merged
jbevain merged 1 commit into
jbevain:masterfrom
Unity-Technologies:master-winrt-fix
Feb 11, 2021
Merged

jbevain merged 1 commit into
jbevain:masterfrom
Unity-Technologies:master-winrt-fix

Conversation

@mrvoorhe

@mrvoorhe mrvoorhe commented Feb 9, 2021

Copy link
Copy Markdown
Contributor

such attribute is put on a method in a projected type.

This is a fix that Unity's cecil has had for a couple years.

{
var module = GetCurrentModule ();
var cecil = module.AssemblyReferences.Where (reference => reference.Name == "Mono.Cecil").First ();
var cecil = module.AssemblyReferences.Where (reference => reference.Name == "Unity.Cecil").First ();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Nope :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@mrvoorhe

Copy link
Copy Markdown
Contributor Author

I can't tell if a test failed or if there was some CI instability. All I see in the log is

  Determining projects to restore...
D:\a\cecil\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj : error NU1101: Unable to find package Microsoft.SourceLink.GitHub. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\cecil\cecil\Mono.Cecil.sln]
D:\a\cecil\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj : error NU1101: Unable to find package Microsoft.NETFramework.ReferenceAssemblies.net40. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\cecil\cecil\Mono.Cecil.sln]
  Failed to restore D:\a\cecil\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj (in 1.1 sec).
  Restored D:\a\cecil\cecil\symbols\pdb\Test\Mono.Cecil.Pdb.Tests.csproj (in 49.83 sec).
  Restored D:\a\cecil\cecil\symbols\mdb\Test\Mono.Cecil.Mdb.Tests.csproj (in 48.71 sec).
  Restored D:\a\cecil\cecil\symbols\mdb\Mono.Cecil.Mdb.csproj (in 7 ms).
  Restored D:\a\cecil\cecil\Test\Mono.Cecil.Tests.csproj (in 125 ms).
  Restored D:\a\cecil\cecil\rocks\Mono.Cecil.Rocks.csproj (in 5 ms).
  Restored D:\a\cecil\cecil\rocks\Test\Mono.Cecil.Rocks.Tests.csproj (in 127 ms).
  Restored D:\a\cecil\cecil\Mono.Cecil.csproj (in 5 ms).

Build FAILED.

@mrvoorhe

Copy link
Copy Markdown
Contributor Author

Looks like it was a CI instability. I force pushed to trigger a new CI run and now the tests are green.

@jbevain

jbevain commented Feb 11, 2021

Copy link
Copy Markdown
Owner

Yeah that's NuGet having hiccups.

Comment thread Mono.Cecil/AssemblyWriter.cs Outdated
private void WriteCustomAttributeTypeValue (TypeReference value)
{
var typeDefinition = value as TypeDefinition;
TypeDefinition outermostDeclaringType = typeDefinition;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Could you move this into the if branch?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

…ch attribute is put on a method in a projected type.
@jbevain
jbevain merged commit 43336ee into jbevain:master Feb 11, 2021
@jbevain

jbevain commented Feb 11, 2021

Copy link
Copy Markdown
Owner

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants