-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
$Callsite always shows MoveNext for c# 5 async/awaited methods #255
Comments
Thanks for the bug report, I'll look into this soon |
As described multiple places, such as: There are currently no good way to get a clear stacktrace from an async method. So this issue will be postponed, at least till the next version |
We should document this behavior and close this issue afterwards |
note added to the wiki. https://github.com/NLog/NLog/wiki/Callsite-layout-renderer thanks for the report. |
I use the following extension methods in my code and it always seems to work for me.
|
Cool! Thanks! We will try it :) |
I think that using StackTrace will have a serious impact on performance (when I removed the use of StackTrace and GetFrames; my code run 30 seconds instead of 2 minutes). I propose to use these methods: |
Agree, stacktrace uses some performance. But this is for ages and we had no performance complaints.
Which test is that?
We like it, but that's not binary compatible AND most of the time those are not the member/linenumbers you needed. (e.g. there is proxy between it) |
I am working on module that must be fast (a loop of 5000 elements that has multiple loops inside, the code is very complex). The 'GetMemberName' methods returns actually the name of parent method. We used it to bypass the "MoveNext" problem but also to have human readable method when a cod is protected by obfuscation. |
Nice. We like to change it, if we could do it optional / backwards-compatible. So if you have ideas on that, let us know :) |
Maybe, it would be easy to use only these methods when targeting .Net 4.5 or above (using preporcesisng directives), and lower old code when targeting old frameworks. |
yes, was thinking about that. But then the logger methods are binary incompatible between frameworks. That's also not nice - but maybe we have to live with that. If you change your framework (.e.g net4 => net45), you need to include the other nlog.dll and it needs a recompile of your program after it. |
PS: #532 |
If I have methods that are annotated with the async keyword and called as an awaited method, the callsite method name always returns MoveNext.
The text was updated successfully, but these errors were encountered: