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

SystemTextJsonFormatter throws exceptions when ETW logging is enabled #1038

Closed
dibarbet opened this issue May 6, 2024 · 0 comments · Fixed by #1040
Closed

SystemTextJsonFormatter throws exceptions when ETW logging is enabled #1038

dibarbet opened this issue May 6, 2024 · 0 comments · Fixed by #1040
Assignees
Milestone

Comments

@dibarbet
Copy link
Member

dibarbet commented May 6, 2024

I've been working on converting the Roslyn LSP server to STJ in dotnet/roslyn#73207

When validating the changes in VS, I hit a huge number of exception count regressions (thousands in some scenarios), see this internal link. These regressions were not reproducible in my changes locally, nor in the build from the VS insertion, until I either

  1. set the env var StreamJsonRpc_TestWithEventSource
  2. or ran VS under perfview using the streamjsonrpc ETW provider (F0CFFE53-BCC5-53F5-8873-995568808A3B)

The exception stacks in the RPS run pretty much all look like the following:
image

It appears as though we're hitting this throw in TryGetArgumentByNameOrIndex -

throw new JsonException("Unexpected value kind for arguments: " + (this.JsonArguments?.ValueKind.ToString() ?? "null"));

because the JsonRpcEventSource is calling to get a string representation of the message with name: null and where JsonArguments is JsonValueKind.Object -
if (request.TryGetArgumentByNameOrIndex(null, i, null, out object? value))

AArnott added a commit to AArnott/vs-streamjsonrpc that referenced this issue May 7, 2024
…em.Text.Json` formatter

This also adjusts how we test with ETW events turned on so that issues like this will be caught rather than swallowed.

Fixes microsoft#1038
@AArnott AArnott added this to the v2.19 milestone May 7, 2024
@AArnott AArnott self-assigned this May 7, 2024
@AArnott AArnott closed this as completed in c5fd7b7 May 7, 2024
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

Successfully merging a pull request may close this issue.

2 participants