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

Demystifier shows async methods in AOP aspect #218

Open
deastr opened this issue Sep 26, 2023 · 0 comments
Open

Demystifier shows async methods in AOP aspect #218

deastr opened this issue Sep 26, 2023 · 0 comments

Comments

@deastr
Copy link

deastr commented Sep 26, 2023

I have a sample async console app with Aspect Oriented Programming logger, in this structure:

ConsoleApp
Project.Class.Method1
Project.Class.Method2

Call list is: ConsoleApp.Main -> Project.Class.Method1 -> Project.Class.Method2

All three of them are async.

This is the GetFrame list when observed by AOP logger while entering to Method2:

EnhancedStackTrace.Current().FrameCount
8
EnhancedStackTrace.Current().GetFrame(0).GetMethod().Name
"Method2"
EnhancedStackTrace.Current().GetFrame(1).GetMethod().Name
"MoveNext"
EnhancedStackTrace.Current().GetFrame(2).GetMethod().Name
"Start"
EnhancedStackTrace.Current().GetFrame(3).GetMethod().Name
"Method1"
EnhancedStackTrace.Current().GetFrame(4).GetMethod().Name
"MoveNext"
EnhancedStackTrace.Current().GetFrame(5).GetMethod().Name
"Start"
EnhancedStackTrace.Current().GetFrame(6).GetMethod().Name
"Main"
EnhancedStackTrace.Current().GetFrame(7).GetMethod().Name
"<Main>"

Interestingly .ToString() method shows somewhat different list:

 at Task Project2.Class1.Method2()
 at async Task Project2.Class1.Method1()
 at void System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<TStateMachine>(ref TStateMachine stateMachine)
 at Task Project2.Class1.Method1()
 at async Task Application.Program.Main(string[] args)
 at void System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<TStateMachine>(ref TStateMachine stateMachine)
 at Task Application.Program.Main(string[] args)
 at void Application.Program.<Main>(?)

I'm attaching sample project.

test.zip

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

1 participant