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

Add mvid and mdtoken to callstackframe #6839

Merged
merged 18 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
<SetTargetFramework>TargetFramework=net8.0</SetTargetFramework>
</ProjectReference>
<ProjectReference Include="..\Microsoft.Diagnostics.Monitoring.TestCommon\Microsoft.Diagnostics.Monitoring.TestCommon.csproj" />
<ProjectReference Include="..\Microsoft.Diagnostics.Monitoring.UnitTestApp\Microsoft.Diagnostics.Monitoring.UnitTestApp.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ public class StacksTests
private readonly TemporaryDirectory _tempDirectory;

private const string ExpectedModule = @"Microsoft.Diagnostics.Monitoring.UnitTestApp.dll";
private static readonly Guid ExpectedModuleVersionId = new Guid("b271d014-2be3-4972-9835-7523a19ecff8");
WilliamXieMSFT marked this conversation as resolved.
Show resolved Hide resolved
private const string ExpectedClass = @"Microsoft.Diagnostics.Monitoring.UnitTestApp.Scenarios.StacksWorker+StacksWorkerNested`1[System.Int32]";
private const string ExpectedFunction = @"DoWork[System.Int64]";
private const string ExpectedTextFunction = @"DoWork[Int64]";
private const uint ExpectedFunctionMethodToken = 100663577;
private const string ExpectedCallbackFunction = @"Callback";
private const uint ExpectedCallbackMethodToken = 100663578;
private const string NativeFrame = "[NativeFrame]";
private const string ExpectedThreadName = "TestThread";

Expand Down Expand Up @@ -453,7 +456,11 @@ private static string FormatFrame(string module, string @class, string function)
FormattableString.Invariant($"{module}!{@class}.{function}");

private static bool AreFramesEqual(WebApi.Models.CallStackFrame left, WebApi.Models.CallStackFrame right) =>
(left.ModuleName == right.ModuleName) && (left.TypeName == right.TypeName) && (left.MethodName == right.MethodName);
(left.ModuleName == right.ModuleName) &&
(left.TypeName == right.TypeName) &&
(left.MethodName == right.MethodName) &&
(left.MethodToken == right.MethodToken) &&
(left.ModuleVersionId == right.ModuleVersionId);

private static bool AreFramesEqual(WebApi.Models.ProfileEvent left, WebApi.Models.ProfileEvent right) =>
(left.Frame == right.Frame) && (left.At == right.At) && (left.Type == right.Type);
Expand Down Expand Up @@ -535,24 +542,30 @@ private static (WebApi.Models.CallStack, IList<WebApi.Models.CallStackFrame>) Ge

private static WebApi.Models.CallStackFrame[] ExpectedFrames() => new WebApi.Models.CallStackFrame[]
{
new WebApi.Models.CallStackFrame
{
ModuleName = ExpectedModule,
TypeName = ExpectedClass,
MethodName = ExpectedCallbackFunction
},
new WebApi.Models.CallStackFrame
{
ModuleName = NativeFrame,
TypeName = NativeFrame,
MethodName = NativeFrame
},
new WebApi.Models.CallStackFrame
{
ModuleName = ExpectedModule,
TypeName = ExpectedClass,
MethodName = ExpectedFunction
}
new WebApi.Models.CallStackFrame
{
ModuleName = ExpectedModule,
MethodToken = ExpectedCallbackMethodToken,
TypeName = ExpectedClass,
MethodName = ExpectedCallbackFunction,
ModuleVersionId = ExpectedModuleVersionId,
},
new WebApi.Models.CallStackFrame
{
ModuleName = NativeFrame,
MethodToken = 0,
TypeName = NativeFrame,
MethodName = NativeFrame,
ModuleVersionId = Guid.Empty,
},
new WebApi.Models.CallStackFrame
{
ModuleName = ExpectedModule,
MethodToken = ExpectedFunctionMethodToken,
TypeName = ExpectedClass,
MethodName = ExpectedFunction,
ModuleVersionId = ExpectedModuleVersionId,
}
};
}
}
Loading