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

Failed to decompile async Task function: "<>t__builder" #270

Open
g3rzi opened this issue Dec 13, 2023 · 1 comment
Open

Failed to decompile async Task function: "<>t__builder" #270

g3rzi opened this issue Dec 13, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@g3rzi
Copy link

g3rzi commented Dec 13, 2023

dnSpyEx version

6.4.1

Describe the Bug

When loading a .NET DLL from Microsoft Azure DevOps agent: Agent.Worker.dll, some functions, do not decompile correctly.
It shows the content with wrong data, some variables like <>t__builder, <>4__this, and so on. See in the "Actual Behaviour" how the function looks like.

How To Reproduce

Go to azure-pipelines-agent release and download the vsts-agent-win-x64-3.230.0.zip.

Extract the Agent.Worker.dll from ZIP:

C:\Users\<username>\Downloads\vsts-agent-win-x64-3.230.0.zip\bin\Agent.Worker.dll  

Start dnSpy 6.4.1, and open Agent.Worker.dll: File -> Open -> Choose Agent.Worker.dll and press Open.
Go to the class JobRunner: Agent.Worker -> Agent.Worker.dll -> Microsoft.VisualStudio.Services.Agent.Worker -> JobRunner.

Then search for the function RunAsync (line 29) and you will see the function.

This is what it looks like:
image

Expected Behavior

The function should look like it appears in the source code:

public async Task<TaskResult> RunAsync(Pipelines.AgentJobRequestMessage message, CancellationToken jobRequestCancellationToken)
{
            // Validate parameters.
            Trace.Entering();
            ArgUtil.NotNull(message, nameof(message));
            ArgUtil.NotNull(message.Resources, nameof(message.Resources));
            ArgUtil.NotNull(message.Variables, nameof(message.Variables));
            ArgUtil.NotNull(message.Steps, nameof(message.Steps));
            Trace.Info("Job ID {0}", message.JobId);

            DateTime jobStartTimeUtc = DateTime.UtcNow;
...

}

Actual Behavior

When decompiling it with dnSpy 6.4.1 it doesn't show the real content of the function:

public Task<TaskResult> RunAsync(Microsoft.TeamFoundation.DistributedTask.Pipelines.AgentJobRequestMessage message, CancellationToken jobRequestCancellationToken)
{
	JobRunner.<RunAsync>d__4 <RunAsync>d__;
	<RunAsync>d__.<>t__builder = AsyncTaskMethodBuilder<TaskResult>.Create();
	<RunAsync>d__.<>4__this = this;
	<RunAsync>d__.message = message;
	<RunAsync>d__.jobRequestCancellationToken = jobRequestCancellationToken;
	<RunAsync>d__.<>1__state = -1;
	<RunAsync>d__.<>t__builder.Start<JobRunner.<RunAsync>d__4>(ref <RunAsync>d__);
	return <RunAsync>d__.<>t__builder.Task;
}

Additional Context

With ILSpy (version 8.2.7535) it works correctly:
image

@g3rzi g3rzi added the bug Something isn't working label Dec 13, 2023
@funkvps
Copy link

funkvps commented Dec 13, 2023

this new lang feature is supported in newer version of ILSpy, while currently dnspy is heavily modified old version of ILSpy. Need to wait for the new ILSpy based version works, then this will be solved.

can refer issue 5 for details

#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants