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

ClrMd v2 cannot find emitted type #4108

Closed
timcassell opened this issue Jul 27, 2023 · 4 comments · Fixed by microsoft/clrmd#1179
Closed

ClrMd v2 cannot find emitted type #4108

timcassell opened this issue Jul 27, 2023 · 4 comments · Fixed by microsoft/clrmd#1179
Assignees
Labels
Milestone

Comments

@timcassell
Copy link

Using IL emit to generate a dynamic type, then using ClrMd to disassemble it, it worked in v1, but fails in v2.

v1 works

ClrType typeWithBenchmark = state.Runtime.Heap.GetTypeByName(settings.TypeName);

v2 fails

ClrType typeWithBenchmark = state.Runtime.EnumerateModules().Select(module => module.GetTypeByName(settings.TypeName)).First(type => type != null);

Relevant issue in BenchmarkDotNet dotnet/BenchmarkDotNet#2383

@timcassell timcassell added the bug Something isn't working label Jul 27, 2023
@hoyosjs
Copy link
Member

hoyosjs commented Jul 31, 2023

If this is an issue directly in CLRMd, should this be in https://github.com/microsoft/clrmd

@timcassell
Copy link
Author

If this is an issue directly in CLRMd, should this be in https://github.com/microsoft/clrmd

microsoft/clrmd#1079

@leculver
Copy link
Contributor

Sorry for the delay, I've been on leave. I'm taking a look.

leculver added a commit to leculver/clrmd that referenced this issue Aug 21, 2023
The dac private API will return "<Unloaded Type>" for dynamic type names.  We can work around this by using metadata (when available) to produce the name.  This restores ClrMD 1.1's behavior.

Fixes dotnet/diagnostics#4108.
leculver added a commit to microsoft/clrmd that referenced this issue Aug 21, 2023
* Use metadata to find type names when appropriate

The dac private API will return "<Unloaded Type>" for dynamic type names.  We can work around this by using metadata (when available) to produce the name.  This restores ClrMD 1.1's behavior.

Fixes dotnet/diagnostics#4108.

* Respect string caching
@leculver
Copy link
Contributor

This is fixed, it will be shipped in ClrMD 3.0.

@ghost ghost locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants