question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Invalid Character" when using Scope names with state

See original GitHub issue

Please mark the type framework used:

  • ASP.NET MVC
  • ASP.NET Web API (OWIN)
  • ASP.NET Core
  • WPF
  • WinForms
  • Xamarin
  • Other:

Please mark the type of the runtime used:

  • .NET Framework
  • Mono
  • .NET Core
  • Version:

Please mark the NuGet packages used:

  • Sentry
  • Sentry.Serilog
  • Sentry.NLog
  • Sentry.Log4Net
  • Sentry.Extensions.Logging
  • Sentry.AspNetCore
  • Version: 2.1.8

When using the AspNetCore ILogger like this:

using (logger.BeginScope("HTTP {HttpMethod} {Uri}", "123", "1234")){
	logger.LogCritical("Test");
}

This creates a scope called “HTTP 123 1234” and additional tags “HttpMethod: 123” and “Uri: 1234”. Sentry successfully gets the tags but the scope results in an error in the sentry frontend like this: image

The tags json will contain:

{"value":"HTTP {HttpMethod} {Uri}","key":null}

I think Sentry should be able to use “HTTP 123 1234” as value and probably have “scope” as a tag key (Are arrays supported as tag keys?)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
WolfspiritMcommented, Dec 1, 2020

Sounds like we’d need to special case for that, and extract the key from the message format (like {a} would be key a) to add the tags.

That actually already works. With the example above I get “HttpMethod” as Key and “123” as value but the message itself is passed without any kind of replacement and any kind of key which marks it as invalid in the frontend. I guess the tags work cause FormattedLogValues is based on a IReadOnlyList<KeyValuePair<string, object>>

I can take a look if I can get a PR ready 😄

0reactions
fearhqcommented, Dec 7, 2020

I am experiencing this exact problem too. We have recently updated our asp .net core version to 3.1 and sentry to 2.1.8

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tomcat: java.lang.IllegalArgumentException: Invalid ...
This exception can occur when you try to execute HTTPS request from client on endpoint which isn't HTTPS enabled.
Read more >
Character causes invalid character error · Issue #147
I ran into this issue with a production app; we discovered our users were entering emoji characters into description fields and we would...
Read more >
Invalid keyscope name reported · Issue #2228 · dita-ot ...
Invalid key scope name "chrysanthèmes". Looking in the specs, ... I'm surprised that we don't explicitly state what characters are allowed.
Read more >
Character name invalid characters : r/pathofexile
Character name invalid characters. I know they changed something a couple leagues ago with the allowed characters but I still see names on ......
Read more >
The variables contains invalid characters. - TechDocs
The field accepts the following national language characters only: @ # $. Field name. Table name of a record object. The first character...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found