Skip to content

Conversation

colejohnson66
Copy link
Contributor

Fixes #8728.

Summary

Exception.StackTrace returns a nullable string?, but it is not documented when it will be null. Testing confirms that it's null before being thrown.

// prints `True`
Console.WriteLine((new Exception()).StackTrace is null);

// prints `False`
try
{
    throw new Exception();
}
catch (Exception ex)
{
    Console.WriteLine(ex.StackTrace is null);
}

@colejohnson66 colejohnson66 requested a review from a team as a code owner December 25, 2022 02:12
@ghost ghost added community-contribution Indicates that the PR has been added by a community member area-System.Runtime labels Dec 25, 2022
@learn-build-service-prod

This comment was marked as outdated.

@learn-build-service-prod
Copy link

Learn Build status updates of commit 8a4fd85:

✅ Validation status: passed

File Status Preview URL Details
xml/System/Exception.xml ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@greenEkatherine greenEkatherine requested review from a team and gewarren December 30, 2022 14:29
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
@learn-build-service-prod
Copy link

Learn Build status updates of commit 9f15c39:

✅ Validation status: passed

File Status Preview URL Details
xml/System/Exception.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@learn-build-service-prod
Copy link

Learn Build status updates of commit 60779fa:

✅ Validation status: passed

File Status Preview URL Details
xml/System/Exception.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@learn-build-service-prod
Copy link

Learn Build status updates of commit 9c12ec1:

✅ Validation status: passed

File Status Preview URL Details
xml/System/Exception.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@learn-build-service-prod
Copy link

Learn Build status updates of commit ca15d08:

✅ Validation status: passed

File Status Preview URL Details
xml/System/Exception.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

Copy link
Contributor

@gewarren gewarren left a comment

Choose a reason for hiding this comment

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

@gewarren gewarren merged commit f8aab18 into dotnet:main Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Runtime community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exception.StackTrace does not explain how it could be null

3 participants