Make StackTraceHelper tests runtime-agnostic
Summary
Fixes the remaining 2 failing StackTraceHelper tests from #63927 by making tests runtime-agnostic instead of expecting exact string matches for runtime internals.
Problem
Tests were failing on Mono due to strict string matching against runtime-specific formatting:
- Lambda methods: Expected
"lambda_method34"but Mono shows"object.lambda_method34" - Async state machines: Expected resolved method names but Mono shows state machine internals
Solution
Updated tests to verify essential functionality while accepting different valid runtime behaviors:
-
Lambda test: Changed from
Assert.StartsWith("lambda_method")toAssert.Contains("lambda_method") - Async test: Added flexible checks that accept both resolved method names and state machine forms
cc: @giritrivedi
Thank you so much for your contribution @medhatiwari! Left a small comment that would be good if you could address, but otherwise this is looking really good 😃
Thank you so much for your contribution @medhatiwari! Left a small comment that would be good if you could address, but otherwise this is looking really good 😃
Thanks for reviewing the PR
Can this be merged ?
/azp run
Commenter does not have sufficient privileges for PR 64007 in repo dotnet/aspnetcore
@wtgodbe any idea around the test failures? Unless I'm missing something obvious it seems like they are unrelated to this PR. Would be good to finally get this contribution merged 😃