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

Hide a invoke filter helper method in a stack trace. #218

Merged
merged 2 commits into from
Nov 11, 2019

Conversation

mayuki
Copy link
Member

@mayuki mayuki commented Nov 9, 2019

If an app is running on .NET Core, Hide a invoke filter helper method in a stack trace by using a hack.

Before

image

   at Sandbox.Hosting.MyService.HelloAsync() in C:\Users\Tomoyo\Source\Repos\MagicOnion\sandbox\Sandbox.Hosting\Program.cs:line 147
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at MagicOnion.CompilerServices.AsyncUnaryResultMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine) in C:\Users\Tomoyo\Source\Repos\MagicOnion\src\MagicOnion\CompilerServices\AsyncUnaryResultMethodBuilder.cs:line 21
   at Sandbox.Hosting.MyService.HelloAsync()
   at lambda_method(Closure , ServiceContext )
   at Sandbox.Hosting.MyFilter3Attribute.Invoke(ServiceContext context, Func`2 next) in C:\Users\Tomoyo\Source\Repos\MagicOnion\sandbox\Sandbox.Hosting\Program.cs:line 130
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Sandbox.Hosting.MyFilter3Attribute.Invoke(ServiceContext context, Func`2 next)
   at MagicOnion.Server.MethodHandler.<>c__DisplayClass45_0.<BuildMethodBodyWithFilter>b__0(ServiceContext ctx) in C:\Users\Tomoyo\Source\Repos\MagicOnion\src\MagicOnion\Server\MethodHandler.cs:line 296
   at Sandbox.Hosting.MyFilter2Attribute.Invoke(ServiceContext context, Func`2 next) in C:\Users\Tomoyo\Source\Repos\MagicOnion\sandbox\Sandbox.Hosting\Program.cs:line 112
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Sandbox.Hosting.MyFilter2Attribute.Invoke(ServiceContext context, Func`2 next)
   at MagicOnion.Server.MethodHandler.<>c__DisplayClass45_0.<BuildMethodBodyWithFilter>b__0(ServiceContext ctx) in C:\Users\Tomoyo\Source\Repos\MagicOnion\src\MagicOnion\Server\MethodHandler.cs:line 296
   at Sandbox.Hosting.MyFilterAttribute.Invoke(ServiceContext context, Func`2 next) in C:\Users\Tomoyo\Source\Repos\MagicOnion\sandbox\Sandbox.Hosting\Program.cs:line 95
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Sandbox.Hosting.MyFilterAttribute.Invoke(ServiceContext context, Func`2 next)
   at MagicOnion.Server.MethodHandler.<>c__DisplayClass45_0.<BuildMethodBodyWithFilter>b__0(ServiceContext ctx) in C:\Users\Tomoyo\Source\Repos\MagicOnion\src\MagicOnion\Server\MethodHandler.cs:line 296
   at MagicOnion.Server.MethodHandler.UnaryServerMethod[TRequest,TResponse](Byte[] request, ServerCallContext context) in C:\Users\Tomoyo\Source\Repos\MagicOnion\src\MagicOnion\Server\MethodHandler.cs:line 367
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at MagicOnion.Server.MethodHandler.UnaryServerMethod[TRequest,TResponse](Byte[] request, ServerCallContext context)
   at Grpc.Core.Internal.UnaryServerCallHandler`2.HandleCall(ServerRpcNew newRpc, CompletionQueueSafeHandle cq)

After

image

   at Sandbox.Hosting.MyService.HelloAsync() in C:\Users\Tomoyo\Source\Repos\MagicOnion\sandbox\Sandbox.Hosting\Program.cs:line 147
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at MagicOnion.CompilerServices.AsyncUnaryResultMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine) in C:\Users\Tomoyo\Source\Repos\MagicOnion\src\MagicOnion\CompilerServices\AsyncUnaryResultMethodBuilder.cs:line 21
   at Sandbox.Hosting.MyService.HelloAsync()
   at lambda_method(Closure , ServiceContext )
   at Sandbox.Hosting.MyFilter3Attribute.Invoke(ServiceContext context, Func`2 next) in C:\Users\Tomoyo\Source\Repos\MagicOnion\sandbox\Sandbox.Hosting\Program.cs:line 130
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Sandbox.Hosting.MyFilter3Attribute.Invoke(ServiceContext context, Func`2 next)
   at Sandbox.Hosting.MyFilter2Attribute.Invoke(ServiceContext context, Func`2 next) in C:\Users\Tomoyo\Source\Repos\MagicOnion\sandbox\Sandbox.Hosting\Program.cs:line 112
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Sandbox.Hosting.MyFilter2Attribute.Invoke(ServiceContext context, Func`2 next)
   at Sandbox.Hosting.MyFilterAttribute.Invoke(ServiceContext context, Func`2 next) in C:\Users\Tomoyo\Source\Repos\MagicOnion\sandbox\Sandbox.Hosting\Program.cs:line 95
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Sandbox.Hosting.MyFilterAttribute.Invoke(ServiceContext context, Func`2 next)
   at MagicOnion.Server.MethodHandler.UnaryServerMethod[TRequest,TResponse](Byte[] request, ServerCallContext context) in C:\Users\Tomoyo\Source\Repos\MagicOnion\src\MagicOnion\Server\MethodHandler.cs:line 365
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at MagicOnion.Server.MethodHandler.UnaryServerMethod[TRequest,TResponse](Byte[] request, ServerCallContext context)
   at Grpc.Core.Internal.UnaryServerCallHandler`2.HandleCall(ServerRpcNew newRpc, CompletionQueueSafeHandle cq)

@mayuki mayuki requested a review from neuecc November 9, 2019 15:49
Copy link
Member

@neuecc neuecc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work, thanks!

@neuecc neuecc merged commit 14e1ef3 into master Nov 11, 2019
@neuecc neuecc deleted the feature/CleanStackTrace branch November 11, 2019 01:37
AntonC9018 pushed a commit to AntonC9018/MagicOnion that referenced this pull request Sep 13, 2022
Hide a invoke filter helper method in a stack trace.
AntonC9018 pushed a commit to AntonC9018/MagicOnion that referenced this pull request Sep 13, 2022
Hide a invoke filter helper method in a stack trace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants