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

See the return type of method signatures #21

Open
WelliSolutions opened this issue Jul 1, 2023 · 2 comments
Open

See the return type of method signatures #21

WelliSolutions opened this issue Jul 1, 2023 · 2 comments

Comments

@WelliSolutions
Copy link

WelliSolutions commented Jul 1, 2023

Is your feature request related to a problem? Please describe.
For a set of overloaded methods, I tried to figure out what those methods return, but I couldn't (neither with netext, nor with SOS itself). I then need to switch to other tools in order to figure it out (Google if it's a Microsoft type or use a .NET disassembler like dotPeek). Sometimes this requires saving the assembly (DLL) from the crash dump file to disk using .writemem, then starting the disassembler, loading the file and searching for the signature.

As for a public reproducible example, the String.Concat() methods return a new string, since the string class has an immutable design. The output of netext using !wclass is

[...]
	// JIT MODE: Ngen - THIS IS ONLY VALID FOR .NET 4.5 AND BEYOND
	// Click for breakpoint: 000007f81e8be060
	public static Concat(System.String, System.String);
[...]

but MSDN says:

public static string Concat (string str0, string str1);

Please note that MSDN has string after public static whereas netext doesn't.

Describe the solution you'd like
I'd like to see netext say public static string Concat(System.String, System.String); or possibly public static System.String Concat(System.String, System.String);

Describe alternatives you've considered
Today I'm using other products, typically dotPeek to figure it out. As described before, this can be a time consuming process, if I don't have the DLL on disk already.

Additional context
I'm doing production debugging as a service, so I'm not the developer and often I neither have the source code, nor DLLs, nor PDB files.

Here's how the IL code is displayed by dotPeek

method public hidebysig static string
    Concat(
      string str0,
      string str1
    ) cil managed
@rodneyviana
Copy link
Owner

Hi WelliSollutions,

NetExt and SOS can’t show the return type because DAC does not provide this information, however you can use !wmakesource to reverse engineer the source of the complete DLL, not only showing the class structure but the full reverse source code. The code also creates the PDF file and you can use !wopensource to show the exact position in the file. If you are using WinDbg Next .open -a also open source code. Don’t use .writemem to save modules on disk as it will not fix the relocation table, use !wmodule instead.

@WelliSolutions
Copy link
Author

Okay, I tried !wmakesource and it seems to work fine. That command figures out the correct return type. How does it do that? Could !wclass do the same thing?

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

No branches or pull requests

2 participants