Repository navigation
docs(dotnet): Fix the code samples on the ASP.NET tracing pages - #20828
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Both span samples were missing a return, and the ASP.NET one also used an HttpGet route that MVC 5 doesn't support and was missing using Sentry. The ASP.NET page also said transactions are named after the route, but Sentry.AspNet names them after the request path. Refs getsentry/sentry-dotnet#5700 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…al.asax Sentry.AspNet names transactions after the request path, and Relay replaces path parts that look like IDs, so a request to /person/42 shows up as GET /person/*, not GET /person/42. Say so and link the troubleshooting page that shows how to set the name. The Global.asax.cs sample didn't compile: the DSN wasn't quoted and had no semicolon, and SentrySdk needs using Sentry on .NET Framework. Drop the Web.config comment and the System.Configuration using that went with it. Refs getsentry/sentry-dotnet#5700 Co-Authored-By: Claude Opus 5.5 <[email protected]>
ric-oliv
force-pushed
the
docs/dotnet-aspnet-span-samples
branch
from
November 17, 2026 11:51
76ec5fe to
0192af5
Compare
ric-oliv
marked this pull request as ready for review
November 17, 2026 11:51
Contributor
|
Getting ready to monitor this change · Rollout details
|
Litarnus
approved these changes
Nov 17, 2026
sentrivana
approved these changes
Nov 17, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DESCRIBE YOUR PR
The code samples on the ASP.NET Core and ASP.NET tracing pages don't compile when you paste them into a project.
On the ASP.NET Core page, the
tryblock ends without areturn, so the compiler reports CS0161. The sample now returnsOk(id), finishes the span with the exception in thecatch, and drops the unusedusing Microsoft.Extensions.Logging;.The ASP.NET sample had three errors.
[HttpGet("/person/{id}")]doesn't compile in MVC 5, because itsHttpGetAttributetakes no route, andSentrySdkneedsusing Sentry;on .NET Framework. It also had the same missingreturn. I built both fixed samples against the 7.0.0 packages, the ASP.NET one for .NET Framework 4.8 with MVC 5.3.The ASP.NET page also said transactions are named
<HTTP method> <Route>.Sentry.AspNetnames them after the request path, and since that name comes from the URL, Sentry replaces parts that look like IDs: a request to/person/42shows up asGET /person/*. I replaced that sentence, linked to the troubleshooting page that shows how to set the name yourself, and dropped the controller sample that went with it.The
Global.asax.cssetup sample on the same page didn't compile either. The DSN wasn't quoted and had no semicolon, andSentrySdkneededusing Sentry;. I fixed both, and removed the comment saying the DSN comes from Web.config, along with itsusing System.Configuration;.Refs getsentry/sentry-dotnet#5700
IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
Select exactly one option. For deadlines, replace
YYYY-MM-DDwith the due date. You can update this information later by editing the PR description.PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes: