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

.NET: copy the pdb for our platform assembly to the .app #11879

Closed
rolfbjarne opened this issue Jun 9, 2021 · 5 comments · Fixed by #18970
Closed

.NET: copy the pdb for our platform assembly to the .app #11879

rolfbjarne opened this issue Jun 9, 2021 · 5 comments · Fixed by #18970
Labels
dotnet An issue or pull request related to .NET (6)
Milestone

Comments

@rolfbjarne
Copy link
Member

rolfbjarne commented Jun 9, 2021

Steps to Reproduce

  1. Build an iOS.NET app
  2. Look for Microsoft.iOS.pdb in the .app
  3. Fail

Expected Behavior

We should bundle the Microsoft.iOS.pdb for Debug configurations, or if MtouchDebug/MmpDebug is true.

Diagnosis

This is because of dotnet/sdk#1458.

Workaround

Add this to a Directory.Build.targets file:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<!-- https://github.com/dotnet/sdk/issues/1458#issuecomment-420456386 -->
	<Target Name="_ResolveCopyLocalNuGetPackagePdbsAndXml" Condition="$(CopyLocalLockFileAssemblies) == true" AfterTargets="ResolveReferences">
		<ItemGroup>
			<ReferenceCopyLocalPaths
				Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).pdb')"
				Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)' != '' and Exists('%(RootDir)%(Directory)%(Filename).pdb')" />
		</ItemGroup>
	</Target>
</Project>

but we should come up with something in our own targets files.

@rolfbjarne rolfbjarne added dotnet An issue or pull request related to .NET (6) dotnet-pri3 .NET 6: wishlist for stable release labels Jun 9, 2021
@rolfbjarne rolfbjarne added this to the .NET 6 milestone Jun 9, 2021
@rolfbjarne rolfbjarne modified the milestones: .NET 6, .NET 7 Apr 6, 2022
@rolfbjarne rolfbjarne removed the dotnet-pri3 .NET 6: wishlist for stable release label Apr 6, 2022
@rolfbjarne rolfbjarne modified the milestones: .NET 7, .NET 8 Aug 26, 2022
@spouliot
Copy link
Contributor

spouliot commented Oct 14, 2022

This makes both "Source Link" and "sources embedded inside PDB" unusable for iOS, macOS, MacCatalyst (and tvOS).

However this works fine with Android builds - so it might be an easy "cut and paste" solution to fix this :-)

l bin/Debug/net6.0-ios/iossimulator-arm64/DebugMyApp.Mobile.app/*.pdb
-rw-r--r--  1 poupou  staff   338K 13 Oct 19:26 bin/Debug/net6.0-ios/iossimulator-arm64/DebugMyApp.Mobile.app/DebugMyApp.Mobile.pdb

l bin/Debug/net6.0-macos/osx-arm64/DebugMyApp.Mobile.app/Contents/MonoBundle/*.pdb                             
-rw-r--r--  1 poupou  staff   286K 13 Oct 09:29 bin/Debug/net6.0-macos/osx-arm64/DebugMyApp.Mobile.app/Contents/MonoBundle/DebugMyApp.Mobile.pdb

l bin/Debug/net6.0-maccatalyst/maccatalyst-arm64/DebugMyApp.Mobile.app/Contents/MonoBundle/*.pdb               
-rw-r--r--  1 poupou  staff   337K 13 Oct 19:19 bin/Debug/net6.0-maccatalyst/maccatalyst-arm64/DebugMyApp.Mobile.app/Contents/MonoBundle/DebugMyApp.Mobile.pdb


l bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/*.pdb                                
-rw-r--r--  1 poupou  staff   460K 13 Oct 16:43 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/DebugMyApp.Mobile.pdb
-rwxr--r--  1 poupou  staff    82K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Java.Interop.pdb
-rwxr--r--  1 poupou  staff    39K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Mono.Android.Export.pdb
-rwxr--r--  1 poupou  staff    12M 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Mono.Android.pdb
-rwxr--r--  1 poupou  staff    12K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.Core.Extensions.Logging.Singleton.pdb
-rwxr--r--  1 poupou  staff    15K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.Core.Extensions.Logging.pdb
-rwxr--r--  1 poupou  staff    13K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.Diagnostics.Eventing.pdb
-rwxr--r--  1 poupou  staff    12K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.Foundation.Logging.pdb
-rwxr--r--  1 poupou  staff   107K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.Foundation.pdb
-rwxr--r--  1 poupou  staff    11K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.UI.Adapter.Microsoft.Extensions.Logging.pdb
-rwxr--r--  1 poupou  staff    42K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.UI.BindingHelper.Android.pdb
-rwxr--r--  1 poupou  staff    82K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.UI.Composition.pdb
-rwxr--r--  1 poupou  staff    30K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.UI.Dispatching.pdb
-rwxr--r--  1 poupou  staff    31K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.UI.FluentTheme.pdb
-rwxr--r--  1 poupou  staff   1.1M 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.UI.FluentTheme.v1.pdb
-rwxr--r--  1 poupou  staff   1.3M 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.UI.FluentTheme.v2.pdb
-rwxr--r--  1 poupou  staff    32K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.UI.RemoteControl.pdb
-rwxr--r--  1 poupou  staff    37K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.UI.Toolkit.pdb
-rwxr--r--  1 poupou  staff   3.8M 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.UI.pdb
-rwxr--r--  1 poupou  staff   1.4M 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Uno.pdb
-rwxr--r--  1 poupou  staff    46K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Activity.pdb
-rwxr--r--  1 poupou  staff    17K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Annotation.Experimental.pdb
-rwxr--r--  1 poupou  staff    64K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Annotation.pdb
-rwxr--r--  1 poupou  staff    34K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.AppCompat.AppCompatResources.pdb
-rwxr--r--  1 poupou  staff   433K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.AppCompat.pdb
-rwxr--r--  1 poupou  staff    17K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Arch.Core.Common.pdb
-rwxr--r--  1 poupou  staff    15K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Arch.Core.Runtime.pdb
-rwxr--r--  1 poupou  staff    13K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.AsyncLayoutInflater.pdb
-rwxr--r--  1 poupou  staff    46K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Browser.pdb
-rwxr--r--  1 poupou  staff    16K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.CardView.pdb
-rwxr--r--  1 poupou  staff    38K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Collection.pdb
-rwxr--r--  1 poupou  staff   386K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.ConstraintLayout.Core.pdb
-rwxr--r--  1 poupou  staff   258K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.ConstraintLayout.pdb
-rwxr--r--  1 poupou  staff    41K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.CoordinatorLayout.pdb
-rwxr--r--  1 poupou  staff   689K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Core.pdb
-rwxr--r--  1 poupou  staff    26K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.CursorAdapter.pdb
-rwxr--r--  1 poupou  staff    29K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.CustomView.pdb
-rwxr--r--  1 poupou  staff    16K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.DocumentFile.pdb
-rwxr--r--  1 poupou  staff    27K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.DrawerLayout.pdb
-rwxr--r--  1 poupou  staff    28K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.DynamicAnimation.pdb
-rwxr--r--  1 poupou  staff   122K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Fragment.pdb
-rwxr--r--  1 poupou  staff    13K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Interpolator.pdb
-rwxr--r--  1 poupou  staff    18K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Legacy.Support.Core.UI.pdb
-rwxr--r--  1 poupou  staff    13K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Legacy.Support.Core.Utils.pdb
-rwxr--r--  1 poupou  staff    12K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Legacy.Support.V4.pdb
-rwxr--r--  1 poupou  staff    21K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Lifecycle.Common.pdb
-rwxr--r--  1 poupou  staff    17K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Lifecycle.LiveData.Core.pdb
-rwxr--r--  1 poupou  staff    15K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Lifecycle.Runtime.pdb
-rwxr--r--  1 poupou  staff    18K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Lifecycle.ViewModel.pdb
-rwxr--r--  1 poupou  staff    14K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Lifecycle.ViewModelSavedState.pdb
-rwxr--r--  1 poupou  staff    29K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Loader.pdb
-rwxr--r--  1 poupou  staff    13K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.LocalBroadcastManager.pdb
-rwxr--r--  1 poupou  staff   164K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Media.pdb
-rwxr--r--  1 poupou  staff    14K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Print.pdb
-rwxr--r--  1 poupou  staff   231K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.RecyclerView.pdb
-rwxr--r--  1 poupou  staff    16K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.SavedState.pdb
-rwxr--r--  1 poupou  staff    22K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.SlidingPaneLayout.pdb
-rwxr--r--  1 poupou  staff    29K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.SwipeRefreshLayout.pdb
-rwxr--r--  1 poupou  staff    12K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Tracing.Tracing.pdb
-rwxr--r--  1 poupou  staff    66K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.Transition.pdb
-rwxr--r--  1 poupou  staff    22K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.VectorDrawable.Animated.pdb
-rwxr--r--  1 poupou  staff    17K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.VectorDrawable.pdb
-rwxr--r--  1 poupou  staff    49K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.VersionedParcelable.pdb
-rwxr--r--  1 poupou  staff    35K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.ViewPager.pdb
-rwxr--r--  1 poupou  staff    28K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.AndroidX.ViewPager2.pdb
-rwxr--r--  1 poupou  staff   698K 12 Oct 10:54 bin/Debug/net6.0-android/android-arm64/DebugMyApp.DebugMyApp/assemblies/Xamarin.Google.Android.Material.pdb

@spouliot
Copy link
Contributor

according to dotnet/sdk#1458 (comment) that might be fixed (opt-in) in 7.0

@spouliot
Copy link
Contributor

from a quick test https://github.com/SimonCropp/Cymbal seems to work fine too

@spouliot
Copy link
Contributor

spouliot commented May 3, 2023

@rolfbjarne it would be nice to include this for net8 along with enabling SourceLink and embedding the generated source code into the .pdb.

This would allow VSCode to debug the iOS/Mac SDK internals (including binding code) just like it already works (without any workaround) for the Android SDK. https://twitter.com/spouliot/status/1653828865221861391?s=20

c.c. @dalexsoto

@rolfbjarne
Copy link
Member Author

according to dotnet/sdk#1458 (comment) that might be fixed (opt-in) in 7.0

Unfortunately setting CopyDebugSymbolFilesFromPackages=true only works with normal NuGets (resolved in the ResolvePackageAssets target), not runtime packs (resolved in the ResolveRuntimePackAssets target). There doesn't seem to be a way to have ResolveRuntimePackAssets find pdbs.

However this works fine with Android builds - so it might be an easy "cut and paste" solution to fix this :-)

Android's build logic is very different from ours :/

Android also implemented SourceLink support (dotnet/android#7298), which we haven't yet, but I've opened an issue for this: #18968

rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue Sep 8, 2023
…ixes xamarin#11879.

Copy the pdb for our platform assembly to the app bundle if we're in Debug
mode.

Fixes xamarin#11879.
rolfbjarne added a commit that referenced this issue Sep 11, 2023
…ixes #11879. (#18970)

Copy the pdb for our platform assembly to the app bundle if we're in
Debug mode.

Fixes #11879.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet An issue or pull request related to .NET (6)
Projects
None yet
2 participants