Skip to content

Bring back PortablePdbReader - #242

Merged
pranavkm merged 3 commits into
devfrom
prkrishn/235
Jun 22, 2017
Merged

Bring back PortablePdbReader#242
pranavkm merged 3 commits into
devfrom
prkrishn/235

Conversation

@pranavkm

Copy link
Copy Markdown

Fixes #235

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<DebugType>portable</DebugType>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The SDK generates a full pdb for cross-compiled applications (on Windows?). CoreCLR can't seem to read a full pdb and our pdb reader only works one way and we intend to keep it so. Forcing it to portable since that's what most users would have.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Interesting... is that new?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It's xunit shenanigans (https://github.com/xunit/xunit/blob/master/src/xunit.core/build/xunit.core.props#L14) and not the SDK. Maybe a bug in it. Either way, forcing this to portable ensures we get the stack trace correctly both on desktop and coreclr. In the absence of this, coreclr is missing the stacktrace for the test file.

using System.Reflection.Metadata.Ecma335;
using System.Reflection.PortableExecutable;

namespace Microsoft.Extensions.StackTrace.Sources

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why have the namespace differentiation? Here and for the moved files.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I guess that's how it was. It'll be a pain to change it without breaking the consumer. I'd prefer leaving it just to create less work :)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hu? Shouldn't there be 0 consumers currenlty?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

we use StackTraceHelper from our package in Hosting and Diagnostics and that's in the same namespace. Changing the ns for that type would be the troublesome part.

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<DebugType>portable</DebugType>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Interesting... is that new?

</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ThrowingLibrary\ThrowingLibrary.csproj" />

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hu? Why?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Regardless of what kind of pdb you generate, exceptions seem preserve stack trace as long as they are produced and caught in the same assembly. I had to cause it to be produced in a different assembly for us to actually use the portable pdb reader. I'll make a note of this in the test.

Exception exception = null;
try
{
// Throwing an exception in the current assembly always seems to populate the full stack

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Given the discussion elsewhere in this PR, it would be good to put this same comment in the Thrower class itself.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sure

@pranavkm

Copy link
Copy Markdown
Author

🆙 📅

@NTaylorMullen NTaylorMullen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All seems fine. Will have more context once I see it used in hosting/diagnostics.

@pranavkm

Copy link
Copy Markdown
Author

@Eilon bump?

@pranavkm
pranavkm merged commit a4d7a27 into dev Jun 22, 2017
@pranavkm
pranavkm deleted the prkrishn/235 branch June 22, 2017 18:20
@ghost ghost locked as resolved and limited conversation to collaborators May 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants