Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Remove MDB and non-portable PDB support #2230

Closed
jonathanpeppers opened this issue Sep 26, 2018 · 3 comments
Closed

[Proposal] Remove MDB and non-portable PDB support #2230

jonathanpeppers opened this issue Sep 26, 2018 · 3 comments
Labels
Area: App+Library Build Issues when building Library projects or Application projects. proposal

Comments

@jonathanpeppers
Copy link
Member

jonathanpeppers commented Sep 26, 2018

Currently, let's say you have a "Hello World" Xamarin.Android application project on Windows.

You might have the following properties in your HelloWorld.csproj:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>True</DebugSymbols>
    <DebugType>full</DebugType>
</PropertyGroup>

NOTE: the latest template puts DebugType=portable here

When built, what will currently happen:

  • HelloWorld.dll is compiled
  • HelloWorld.dll.mdb is the generated symbol file
  • We run a ConvertDebuggingFiles MSBuild task (runs pdb2mdb) that is taking ~50ms for "Hello World". (I have seen it take up to 4 seconds, in cases where Mono.Android.dll.mdb existed, see [build] DebugType=portable across all projects #2215)
  • We look for any *.mdb files in _CollectMdbFiles and _CopyMdbFiles targets

As you can see, it is a lot of work to support this file format. Making sure all our of project templates have DebugType=portable is the first step.

What happens in VS for Mac?

The VS for Mac templates are not yet shared with the VS Windows templates, and they are specifying DebugType=full by defaut.

However, Mono is building portable *.pdb files with this setting. ConvertDebuggingFiles and pdb2mdb aren't running at all.

What should we change?

The first thought, is that Xamarin.Android.Common.targets should do this by default:

<DebugType Condition=" '$(DebugType)' = '' OR '$(DebugType)' == 'full' OR '$(DebugType)' = 'pdbonly'>portable</DebugType>

This would make Xamarin.Android projects always use portable *.pdb files by default. DebugType=portable is set by SDK-style NetStandard projects by default. It works for both Debug and Release builds.

We would also remove:

  • Anything looking for *.mdb files
  • ConvertDebuggingFiles and pdb2mdb

If we encounter a "non-portable" pdb file, it will also be skipped and a new warning emitted.

Benefits

These changes cleanup our MSBuild targets and remove code (reduce technical debt).

It will also improve build times. How much? This is an estimate, but I'm seeing 50-100ms in past SmartHotel360 build logs looking for and copying *.mdb files. I think this time is spent even on builds with no changes. I see 300ms being spent on ConvertDebuggingFiles, but this only happens when assemblies are changing.

Concerns

The main concern here is existing NuGet packages, and what will happen.

  • If a *.mdb file is encountered, it will just be ignored
  • If a non-portable *.pdb file is encountered we will emit a warning and ignore it

So I think the only thing that someone could lose here is the ability to debug and step into code inside an existing NuGet package.

See: NuGet/Home#6104

@jonathanpeppers jonathanpeppers added Area: App+Library Build Issues when building Library projects or Application projects. proposal labels Sep 26, 2018
@jonathanpeppers jonathanpeppers added this to the d16-0 milestone Sep 26, 2018
@JonDouglas
Copy link
Contributor

I'm all for this given this is the future of cross-platform symbols. Although it does possibly remove the ability to debug and step into code via packed NuGet symbols, this seems like something we shouldn't wait to implement on our end?

Further Resources:

https://github.com/dotnet/core/blob/master/Documentation/diagnostics/portable_pdb.md
https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md
https://www.mono-project.com/docs/about-mono/releases/4.2.1/

@jonathanpeppers
Copy link
Member Author

One discovery holding us back here, currently our Xamarin.Forms template has this in the NetStandard project:

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DebugType>pdbonly</DebugType>
    <DebugSymbols>true</DebugSymbols>
  </PropertyGroup>

This was added because it broke debugging with UWP??? This doesn't make sense, @joj is going to investigate further.

@jonathanpeppers jonathanpeppers modified the milestones: d16-0, far future Jan 28, 2019
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this issue Nov 1, 2019
Fixes: dotnet#2230

We currently spend some time during builds converting symbol files if
`DebugType=Full` or `DebugType=PdbOnly` is used.

These are older symbol formats, and we have already done the work to
use `DebugType=Portable` everywhere in the Xamarin templates.

My thought is to just remove support for these symbols by default
unless `$(AndroidLegacySymbols)` is set to `True`. This way if a
problem comes up, developers can opt-in to the old behavior.

Eventually we may phase out support completely, but it may not matter
to leave it in.

I updated various tests here to make sure we continue to test both
`Full` and `Portable` in `DebuggingTest.cs`.

Other changes:

* I found the `_CollectMdbFiles` MSBuild target is completely unused.
  It should have been removed in 2ea31e6, but we can remove it now.
* I found a place `$(AllowedReferenceRelatedFileExtensions)` was
  adding duplicate values. We should have removed this in e390702.
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this issue Nov 1, 2019
Fixes: dotnet#2230

We currently spend some time during builds converting symbol files if
`DebugType=Full` or `DebugType=PdbOnly` is used.

These are older symbol formats, and we have already done the work to
use `DebugType=Portable` everywhere in the Xamarin templates.

My thought is to just remove support for these symbols by default
unless `$(AndroidLegacySymbols)` is set to `True`. This way if a
problem comes up, developers can opt-in to the old behavior.

Eventually we may phase out support completely, but it may not matter
to leave it in.

I updated various tests here to make sure we continue to test both
`Full` and `Portable` in `DebuggingTest.cs`.

Other changes:

* I found the `_CollectMdbFiles` MSBuild target is completely unused.
  It should have been removed in 2ea31e6, but we can remove it now.
* I found a place `$(AllowedReferenceRelatedFileExtensions)` was
  adding duplicate values. We should have removed this in e390702.
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this issue Nov 1, 2019
Fixes: dotnet#2230

We currently spend some time during builds converting symbol files if
`DebugType=Full` or `DebugType=PdbOnly` is used.

These are older symbol formats, and we have already done the work to
use `DebugType=Portable` everywhere in the Xamarin templates.

My thought is to just remove support for these symbols by default
unless `$(AndroidLegacySymbols)` is set to `True`. This way if a
problem comes up, developers can opt-in to the old behavior.

Eventually we may phase out support completely, but it may not matter
to leave it in.

I updated various tests here to make sure we continue to test both
`Full` and `Portable` in `DebuggingTest.cs`.

Other changes:

* I found the `_CollectMdbFiles` MSBuild target is completely unused.
  It should have been removed in 2ea31e6, but we can remove it now.
* I found a place `$(AllowedReferenceRelatedFileExtensions)` was
  adding duplicate values. We should have removed this in e390702.
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this issue Nov 1, 2019
Fixes: dotnet#2230

We currently spend some time during builds converting symbol files if
`DebugType=Full` or `DebugType=PdbOnly` is used.

These are older symbol formats, and we have already done the work to
use `DebugType=Portable` everywhere in the Xamarin templates.

My thought is to just remove support for these symbols by default
unless `$(AndroidLegacySymbols)` is set to `True`. This way if a
problem comes up, developers can opt-in to the old behavior.

Eventually we may phase out support completely, but it may not matter
to leave it in.

I updated various tests here to make sure we continue to test both
`Full` and `Portable` in `DebuggingTest.cs`.

~~ XA0122 ~~

I added a new warning, for cases where a PCL `<ProjectReference/>`
have `DebugType=Full` set. This seems like the only likely cause a
user could hit an issue. I added a test for this scenario.

Other changes:

* I found the `_CollectMdbFiles` MSBuild target is completely unused.
  It should have been removed in 2ea31e6, but we can remove it now.
* I found a place `$(AllowedReferenceRelatedFileExtensions)` was
  adding duplicate values. We should have removed this in e390702.
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this issue Nov 4, 2019
Fixes: dotnet#2230

We currently spend some time during builds converting symbol files if
`DebugType=Full` or `DebugType=PdbOnly` is used.

These are older symbol formats, and we have already done the work to
use `DebugType=Portable` everywhere in the Xamarin templates.

My thought is to just remove support for these symbols by default
unless `$(AndroidLegacySymbols)` is set to `True`. This way if a
problem comes up, developers can opt-in to the old behavior.

Eventually we may phase out support completely, but it may not matter
to leave it in.

I updated various tests here to make sure we continue to test both
`Full` and `Portable` in `DebuggingTest.cs`.

~~ XA0122 ~~

I added a new warning, for cases where a PCL `<ProjectReference/>`
have `DebugType=Full` set. This seems like the only likely cause a
user could hit an issue. I added a test for this scenario.

Other changes:

* I found the `_CollectMdbFiles` MSBuild target is completely unused.
  It should have been removed in 2ea31e6, but we can remove it now.
* I found a place `$(AllowedReferenceRelatedFileExtensions)` was
  adding duplicate values. We should have removed this in e390702.
@jpobst
Copy link
Contributor

jpobst commented Mar 1, 2022

Will not be supported in .NET 6: aab69af.

@jpobst jpobst closed this as completed Mar 1, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jun 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App+Library Build Issues when building Library projects or Application projects. proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants