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.

Reported excp source StackTrace line does not match actual excp source line

See original GitHub issue

Package

Sentry.AspNetCore

.NET Flavor

.NET Core

.NET Version

3.1.416

OS

Linux

SDK Version

3.30.0

Self-Hosted Sentry Version

No response

Steps to Reproduce

Hi.

We enabled uploading source and symbols using Portable PDB netcoreapp31 (publish in docker), and we are observing non-matching src stacktrace line with actual excp line. Example in screenshot, line highlighted is a return statement which has nothing with the Exception that is thrown:

We do the build inside docker like:

ENV SENTRY_LOG_LEVEL=info

RUN dotnet publish -c release -o /app -r $PLATFORM -p:UseSentryCLI=true -p:SentryOrg=$ORGNAME  \
    -p:SentryProject=$PROJNAME -p:SentryUploadSymbols=true -p:SentryUploadSources=true  \
    --self-contained true --no-restore -p:PublishReadyToRun=true -p:DebugType=Portable -p:DebugSymbols=true

Should changing to DebugType=Full be of any help?

If it helps:

ISSUE ID: 3894189831 PROJECT ID: 5239187

We are NOT self-hosted you can reach me out private to give out subdomain ID.

We upgraded from 3.13 SDK and did not have issues in showing the exact correct matching line where the exception occurs. We did not used PDB and source upload, we only had stacktrace info but it was correct.

Expected Result

Highlighted line should be showing the throw CreateMyException() L763.

Actual Result

The actual exception is explicitly thrown 13 lines after in L763. The highlighted code is not relevant to the exception.

image

part of logs with our exe REST WEB API being built and reported with Sentry in docker:

#33 60.34   RedactedProjectName -> /source/RedactedProjectName/bin/linux-musl-x64/release/netcoreapp3.1/linux-musl-x64/RedactedProjectName.dll
#33 60.44     INFO    2023-04-21 11:42:22.049859105 +00:00 sentry-cli was invoked with the following command line: "/root/.nuget/packages/sentry/3.30.0/tools/sentry-cli-Linux-x86_64" "info" "--no-defaults"
#33 162.3   Some ReadyToRun compilations emitted warnings, indicating potential missing dependencies. Missing dependencies could potentially cause runtime failures. To show the warnings, set the PublishReadyToRunShowWarnings property to true.
#33 166.9   RedactedProjectName -> /app/
#33 166.9   Preparing to upload debug symbols and sources to Sentry for RedactedProjectName (release/netcoreapp3.1)
#33 166.9     INFO    2023-04-21 11:44:08.525740235 +00:00 sentry-cli was invoked with the following command line: "/root/.nuget/packages/sentry/3.30.0/tools/sentry-cli-Linux-x86_64" "dif" "upload" "--org" "RedactedProjectName" "--project" "RedactedProjectName-api" "--include-sources" "obj/linux-musl-x64/release/netcoreapp3.1/linux-musl-x64/"
#33 166.9     INFO    2023-04-21 11:44:08.526156313 +00:00 Issuing a command for Organization: RedactedProjectName Project: RedactedProjectName-api
#33 167.5   > Found 9 debug information files (4 with embedded sources)
#33 167.6   > Resolved source code for 1 debug information file
#33 167.6   > Prepared debug information files for upload
#33 168.3   > Uploaded 2 missing debug information files
#33 168.5   > File upload complete:
#33 168.5   
#33 168.5     PENDING 6de92202-c49f-4a5b-a2da-6f8285d2c8f2-df7452e3 (RedactedProjectName.pdb; unknown debug companion)
#33 168.5     PENDING 6de92202-c49f-4a5b-a2da-6f8285d2c8f2-df7452e3 (RedactedProjectName.pdb; unknown sources)

part of logs with our lib used by exe REST WEB API where the mismatch occurs:

#33 37.15   RedactedProjectNameLib -> /source/RedactedProjectNameLib/bin/linux-musl-x64/release/netstandard2.0/RedactedProjectNameLib.dll
#33 37.21     INFO    2023-04-21 11:41:58.818782460 +00:00 sentry-cli was invoked with the following command line: "/root/.nuget/packages/sentry/3.30.0/tools/sentry-cli-Linux-x86_64" "info" "--no-defaults"
#33 37.81   Preparing to upload debug symbols and sources to Sentry for RedactedProjectNameLib (release/netstandard2.0)
#33 37.82     INFO    2023-04-21 11:41:59.428935237 +00:00 sentry-cli was invoked with the following command line: "/root/.nuget/packages/sentry/3.30.0/tools/sentry-cli-Linux-x86_64" "dif" "upload" "--org" "RedactedProjectName" "--project" "RedactedProjectName-api" "--include-sources" "obj/linux-musl-x64/release/netstandard2.0/"
#33 37.82     INFO    2023-04-21 11:41:59.429024215 +00:00 Issuing a command for Organization: RedactedProjectName Project: RedactedProjectName-api
#33 38.36   > Found 1 debug information file
#33 38.42   > Resolved source code for 1 debug information file
#33 38.42   > Prepared debug information files for upload
#33 39.16   > Uploaded 2 missing debug information files
#33 39.34   > File upload complete:
#33 39.34   
#33 39.34     PENDING 9fb191da-e926-43fd-8823-ce5bc7b5795b-8a378395 (RedactedProjectNameLib.pdb; unknown sources)
#33 39.34     PENDING 9fb191da-e926-43fd-8823-ce5bc7b5795b-8a378395 (RedactedProjectNameLib.pdb; unknown debug companion)

Issue Analytics

  • State:closed
  • Created 5 months ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
vmandiccommented, Apr 25, 2023

Thanks for coming back at me Matt.

Unfortunately I am not in a position to provide a min repro. What I can tell you is this does not occur often, it is more of an exception and I’d safely say not up to you guys but dotnet itself per related issue you linked before.

What I can tell you, if its worth having open this issue, is that we are just testing an upgrade of project from netcoreapp3.1 to net7 and I will see we get issues reported there with this problem. Maybe best close the issue also and I can come back at you with more info later as this could take up to 10 days or more for a confirmation.

(We are not opting to the new trimming feature also… that’s a different kind of beast with newer dotnet!)

We still have to address warnings also.

1reaction
mattjohnsonpintcommented, Apr 23, 2023

It could also possibly be related to https://github.com/dotnet/runtime/issues/44986 or another similar issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stack trace line number and message do not match
Any exception thrown by the methods inside section B seem to be faithfully reporting the correct line numbers.
Read more >
StackTrace reports incorrect line number from catch and ...
Description Run the following program: using System; using System.Diagnostics; class Program { static void Main () { try { Console.
Read more >
Exeception line numbers are not reliable
I spent quite some time debugging an issue because the stack trace line numbers were not correct and wanted to share my findings....
Read more >
Line numbers are incorrect in exception stack trace - YouTrack
I just rebuilt it in Maven and right now with Kotlin 1.1 the line numbers reflect the real source line number. Did something...
Read more >
Wrong exception line number in stack trace in release mode
In Release, it is possible that the line that issued the error is different from the source code of your code. Related articles:...
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