Skip to content

Reproduce attribute issue - #1

Merged
mateoatr merged 1 commit into
mateoatr:copyOriginalfrom
sbomer:copyOriginal
Apr 5, 2021
Merged

mateoatr merged 1 commit into
mateoatr:copyOriginalfrom
sbomer:copyOriginal

Conversation

@sbomer

@sbomer sbomer commented Apr 5, 2021

Copy link
Copy Markdown

Looks like the issue isn't what I thought it was. The problem actually happens for an attribute enum arg in a "link" assembly, where the enum typeref points to a forwarder. In this case we don't want to keep the forwarder.

The problem is that SweepStep removes the (unused) enum forwarder before it tries to fix the scope of the attribute arg, so fixing the scope fails (Resolve returns null here, and the scope isn't updated). Then when we go to output the assembly, cecil complains about the unresolved scope.

I think the proper fix is to update scopes in SweepStep for all assemblies, before removing any type forwarders. Before your changes, this worked because the forwarder would have been marked (by the logic in MarkStep that marks forwarders pointing to any marked type) - though even before your change it might be possible to repro this with "copyused" assemblies (I will continue to try).

@mateoatr
mateoatr merged commit 5fbd9fe into mateoatr:copyOriginal Apr 5, 2021
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.

2 participants