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

ReferenceAssemblyAttribute in System.Diagnostics.StackTrace? #25

Open
wasabii opened this issue Dec 21, 2023 · 5 comments
Open

ReferenceAssemblyAttribute in System.Diagnostics.StackTrace? #25

wasabii opened this issue Dec 21, 2023 · 5 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@wasabii
Copy link

wasabii commented Dec 21, 2023

Attempting to make a reference assembly from another .NET 6 assembly. .NET 6 assembly... seems pretty normal. No ReferenceAssemblyAttribute on it.... run refasmer.

refasmer -o foo.dll -r bar.dll

Looking in foo.dll, in ildasm, I see:

.custom instance void [System.Diagnostics.StackTrace]System.Runtime.CompilerServices.ReferenceAssemblyAttribute::.ctor() = ( 01 00 00 00 )

System.Diagnostics.StackTrace? What?

@ForNeVeR
Copy link
Contributor

I am sorry, but it is unclear what the issue is. Does it refer to System.Diagnostics.StackTrace as an assembly name?

Could you please provide some steps to reproduce the issue?

@ForNeVeR ForNeVeR added the question Further information is requested label Dec 21, 2023
@wasabii
Copy link
Author

wasabii commented Dec 21, 2023

Yes. It is attempting to use the attribute in System.Diagnostic.StackTrace.

It did also create it's own version of is the attribute on my assembly. But, that's not the one who's ctor is invoked.

I'll try to figure out a simple test case for ya.

@zabbius
Copy link
Contributor

zabbius commented Dec 21, 2023

Refasmer tries to find ReferenceAssemblyAttribute in processed assembly before creating it's own one.
Maybe your lib has such exotic variant of this attribute?

@wasabii
Copy link
Author

wasabii commented Dec 21, 2023

Checking over the TypeDef table on the original assembly, I don't see any entry for it. Checking the TypeRef table, I don't see any reference to it.

On the resulting assembly, though, I do see, at the end of the TypeRef table, a new entry for ReferenceAssemblyAttribute from System.Diagnostics.StackTrace.

This is dotPeeks view of the TypeRef that was apparently created:

image

So, the input assembly has no TypeRef to System.Diagnostics.StackTrace, but the output assembly does.

I've been going over the refasmer code, and I can't really see anyway this could be possible, yet. But, there it is.... and I've rerun it a few times now and produced the same thing.

@wasabii
Copy link
Author

wasabii commented Dec 21, 2023

I do see that it tries to search all TypeRef's for a matching type name. So, if the original assembly had a TypeRef to the type in System.Diagnostics.StackTrace, I do see how it would be copied over. But, still, can't find such a thing in the original assembly.

@ForNeVeR ForNeVeR added bug Something isn't working help wanted Extra attention is needed and removed question Further information is requested labels Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants