Skip to content

Conversation

@radekdoulik
Copy link
Member

commit 82a2fe15984df2b697c42b2fef5ccc17370007e3
Author: Radek Doulik <[email protected]>
Date:   Mon Jul 3 22:41:43 2017 +0200

    do not set scope.Start when start_instruction is null

     - this gets us to the original state how scope start was handled
       before
       https://github.com/jbevain/cecil/commit/7c8e0f767d7b2f652a430e4e26f1d98a20f9e125

     - fixes #57889

     - without this change we get excpetion when writing mdb like this:

        The "LinkAssemblies" task failed unexpectedly. [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
        System.NotSupportedException: Specified method is not supported. [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.Cil.InstructionOffset.get_Offset() [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.Mdb.MdbWriter.WriteScope(ScopeDebugInformation scope, MethodDebugInformation info) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.Mdb.MdbWriter.WriteScopes(Collection`1 scopes, MethodDebugInformation info) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.Mdb.MdbWriter.WriteScope(ScopeDebugInformation scope, MethodDebugInformation info) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.Mdb.MdbWriter.WriteScopes(Collection`1 scopes, MethodDebugInformation info) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.Mdb.MdbWriter.WriteRootScope(ScopeDebugInformation scope, MethodDebugInformation info) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.Mdb.MdbWriter.Write(MethodDebugInformation info) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody(MethodDefinition method) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.MetadataBuilder.AddTypes() [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.MetadataBuilder.BuildTypes() [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.MetadataBuilder.BuildModule() [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.MetadataBuilder.BuildMetadata() [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.ModuleWriter.<>c.b__2_0(MetadataBuilder builder, MetadataReader _) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Linker.Steps.OutputStep.OutputAssembly(AssemblyDefinition assembly) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Linker.Steps.OutputStep.ProcessAssembly(AssemblyDefinition assembly) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           ...

    commit 82a2fe15984df2b697c42b2fef5ccc17370007e3
    Author: Radek Doulik <[email protected]>
    Date:   Mon Jul 3 22:41:43 2017 +0200

        do not set scope.Start when start_instruction is null

         - this gets us to the original state how scope start was handled
           before
           jbevain/cecil@7c8e0f7

         - fixes #57889

         - without this change we get excpetion when writing mdb like this:

            The "LinkAssemblies" task failed unexpectedly. [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
            System.NotSupportedException: Specified method is not supported. [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.Cil.InstructionOffset.get_Offset() [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.Mdb.MdbWriter.WriteScope(ScopeDebugInformation scope, MethodDebugInformation info) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.Mdb.MdbWriter.WriteScopes(Collection`1 scopes, MethodDebugInformation info) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.Mdb.MdbWriter.WriteScope(ScopeDebugInformation scope, MethodDebugInformation info) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.Mdb.MdbWriter.WriteScopes(Collection`1 scopes, MethodDebugInformation info) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.Mdb.MdbWriter.WriteRootScope(ScopeDebugInformation scope, MethodDebugInformation info) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.Mdb.MdbWriter.Write(MethodDebugInformation info) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody(MethodDefinition method) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.MetadataBuilder.AddTypes() [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.MetadataBuilder.BuildTypes() [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.MetadataBuilder.BuildModule() [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.MetadataBuilder.BuildMetadata() [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.ModuleWriter.<>c.b__2_0(MetadataBuilder builder, MetadataReader _) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Linker.Steps.OutputStep.OutputAssembly(AssemblyDefinition assembly) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               at Mono.Linker.Steps.OutputStep.ProcessAssembly(AssemblyDefinition assembly) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
               ...
@jonpryor
Copy link
Contributor

As with the prior attempted fix for Bug #57889, I fear that this is just hiding symptoms.

Some quick gripping, and MdbWriter.WriteScope() makes me uncomfortable:

		void WriteScope (ScopeDebugInformation scope, MethodDebugInformation info)
		{
			writer.OpenScope (scope.Start.Offset);

			WriteScopeVariables (scope);

			if (scope.HasScopes)
				WriteScopes (scope.Scopes, info);

			writer.CloseScope (scope.End.IsEndOfMethod ? info.code_size : scope.End.Offset);
		}

This is where your listed stack trace is hitting:

        System.NotSupportedException: Specified method is not supported. [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.Cil.InstructionOffset.get_Offset() [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]
           at Mono.Cecil.Mdb.MdbWriter.WriteScope(ScopeDebugInformation scope, MethodDebugInformation info) [C:\xms\xamarin-forms-samples\Templates\DataTemplateSelector\Droid\Selector.Droid.csproj]

Instead, then, the likely result is that scope.Start.Offset may be 0, as it's not always set -- e.g. if the Instruction instance is created by the Instruction(OpCode, object) constructor.

My quick static analysis doesn't otherwise make me convinced that this approach will continue to work, as I don't understand why jbevain made that change in the first place. Perhaps he was fixing another bug at the same time?

@radekdoulik
Copy link
Member Author

Both of these bug fixes were intended to fix the regression and bring us back to the state after the original bugfix jbevain/cecil@01a695f

So with this second fix we get to the state where cecil handles the broken mdb's again without crashing.

I think the basic question here is whether we want cecil to be able to cope with broken mdb's or not and rather reject them in some way, like throwing appropriate exception. Which is the question of jbevain/cecil#424

@jonpryor
Copy link
Contributor

After my week of (bad) explorations...

I don't think we want Cecil to deal with broken mdb's, but that's jbevain's call.

The more "interesting" thing is that we shouldn't be asking Cecil to deal with broken mdbs in the first place. Bug #57889 is an exception from the <LinkAssemblies/> task, and the <LinkAssemblies/> task should not be loading debug symbols:

https://github.com/xamarin/xamarin-android/blob/4b00475/src/Xamarin.Android.Build.Tasks/Tasks/LinkAssemblies.cs#L88

Thus, the "real" question: Why is the <LinkAssemblies/> task loading debug symbols when it's explicitly asking to not load debug symbols? If it never loaded the debug symbols, we wouldn't care if the debug symbols were corrupted.

The problem here is the loading of debug symbols at all, not Cecil.

@radekdoulik
Copy link
Member Author

I agree with that. Handling broken mdb's is necessary as well though as it can happen in Debug configuration too. It is much less likely, because XamlC task will not cause trouble in Debug. Still I saw at least one report of this issue for third party assembly coming from nuget package IIRC.

I will try to fix assembly loading without symbols as well.

This PR should get us to the state we were for many months before the regression and fix the actual problem, so if we are in hurry it should be ok for d15-3.

@jonpryor jonpryor merged commit efefee0 into dotnet:d15-3 Jul 17, 2017
@radekdoulik
Copy link
Member Author

Forgot to comment on this

Instead, then, the likely result is that scope.Start.Offset may be 0, as it's not always set -- e.g. if the Instruction instance is created by the Instruction(OpCode, object) constructor.

in this case the Instruction instance is not created and thus the start has the original int value from mdb, which is later written back. https://github.com/jbevain/cecil/blob/1530a21d652992e9adb749d207a4f4fd44ad8024/Mono.Cecil.Cil/Symbols.cs#L183

jonpryor added a commit to jonpryor/java.interop that referenced this pull request Aug 23, 2022
Context: dotnet/android@7b4d4b8
Context: https://github.com/dotnet/sourcelink#githubcom-and-github-enterprise
Context: https://www.hanselman.com/blog/exploring-net-cores-sourcelink-stepping-into-the-source-code-of-nuget-packages-you-dont-own

Changes: http://github.com/xamarin/xamarin-android-tools/compare/fc3c2ac191a47715bc58e110ef28f38009158416...7cfe68373f959b8d08b49dd89e2c874ebde38bda

  * dotnet/android-tools@7cfe683: [ci] Use Microsoft.SourceLink.GitHub (dotnet#192)
  * dotnet/android-tools@01a0dde: [Localization] Import translated resx files (dotnet#189)
  * dotnet/android-tools@cc715d9: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r25 (dotnet#190)
  * dotnet/android-tools@3c55e9a: Avoid `Environment.SpecialFolder.ApplicationData` (dotnet#188)
  * dotnet/android-tools@0d55472: LEGO: Merge pull request 187
  * dotnet/android-tools@6946512: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729154833425. (dotnet#186)
  * dotnet/android-tools@6e3433a: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729025332507. (dotnet#185)
  * dotnet/android-tools@73c4388: [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-33 (dotnet#184)
  * dotnet/android-tools@da3653e: [Xamarin.Android.Tools.AndroidSdk] Add API-33 to KnownVersions
  * dotnet/android-tools@327d433: [ci] Run OneLocBuild on a schedule (dotnet#180)
  * dotnet/android-tools@8ab60e4: [ci] Use latest macOS and Windows images (dotnet#181)
  * dotnet/android-tools@4dd3292: LEGO: Merge pull request 182
  * dotnet/android-tools@56b61f1: [Localization] Add OneLocBuild job (dotnet#175)
  * dotnet/android-tools@14076a6: [Xamarin.Android.Tools.AndroidSdk] Add API-32 to KnownVersions
  * dotnet/android-tools@9c641b3: [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-32 (dotnet#169)
  * dotnet/android-tools@ec346d0: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r24 (dotnet#171)
  * dotnet/android-tools@47832f1: [Xamarin.Android.Tools.AndroidSdk] AndroidSdkInfo validation locator (dotnet#170)
  * dotnet/android-tools@20f6112: Bump LibZipSharp to 2.0.4 (dotnet#166)
  * dotnet/android-tools@e4f0d59: Add support for writing android:roundIcon to Android manifest (dotnet#162)

Add a reference to the [Microsoft.SourceLink.GitHub NuGet package][0]
to `src/*/*.csproj` and `tools/*/*.csproj` so that `*.pdb` such as
`Java.Interop.pdb` contain URLs to facilitate debugging into their
corresponding assemblies without needing to checkout and build the
`Java.Interop` repo locally:

	% dotnet tool install --global SourceLink --version 3.1.1

	% $HOME/.dotnet/tools/sourcelink print-urls bin/Debug-net7.0/Java.Interop.pdb
	c1eaa3b7ef9a7354080ca02e56f5052a7b04fcf78298210fb69a1c05c5827c3d sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/GlobalSuppressions.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/GlobalSuppressions.cs
	…

	% $HOME/.dotnet/tools/sourcelink test bin/Debug-net7.0/Java.Interop.pdb
	3 Documents with errors:
	983b6f609d1a601d57df96467aafe6a0cc6173a23d261f98ad582d16983259a9 sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/obj/Debug/net7.0/JniEnvironment.g.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/obj/Debug/net7.0/JniEnvironment.g.cs
	error: url failed NotFound: Not Found
	9596da901062cf5add81d66c23696ca92bbfa59c82fe10f4f06d45292e2cb0ff sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs
	error: url failed NotFound: Not Found
	508b170eae1ea8b281b2a892293c0b1f2b1ee67db1bd8ce89036541d3f121643 sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/obj/Debug/net7.0/Java.Interop.AssemblyInfo.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/obj/Debug/net7.0/Java.Interop.AssemblyInfo.cs
	error: url failed NotFound: Not Found
	sourcelink test failed

These errors are expected, as they are generated files.

[0]: https://www.nuget.org/packages/Microsoft.SourceLink.GitHub
jonpryor added a commit to jonpryor/java.interop that referenced this pull request Aug 23, 2022
Context: dotnet/android@7b4d4b8
Context: https://github.com/dotnet/sourcelink#githubcom-and-github-enterprise
Context: https://www.hanselman.com/blog/exploring-net-cores-sourcelink-stepping-into-the-source-code-of-nuget-packages-you-dont-own

Changes: http://github.com/xamarin/xamarin-android-tools/compare/fc3c2ac191a47715bc58e110ef28f38009158416...7cfe68373f959b8d08b49dd89e2c874ebde38bda

  * dotnet/android-tools@7cfe683: [ci] Use Microsoft.SourceLink.GitHub (dotnet#192)
  * dotnet/android-tools@01a0dde: [Localization] Import translated resx files (dotnet#189)
  * dotnet/android-tools@cc715d9: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r25 (dotnet#190)
  * dotnet/android-tools@3c55e9a: Avoid `Environment.SpecialFolder.ApplicationData` (dotnet#188)
  * dotnet/android-tools@0d55472: LEGO: Merge pull request 187
  * dotnet/android-tools@6946512: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729154833425. (dotnet#186)
  * dotnet/android-tools@6e3433a: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729025332507. (dotnet#185)
  * dotnet/android-tools@73c4388: [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-33 (dotnet#184)
  * dotnet/android-tools@da3653e: [Xamarin.Android.Tools.AndroidSdk] Add API-33 to KnownVersions
  * dotnet/android-tools@327d433: [ci] Run OneLocBuild on a schedule (dotnet#180)
  * dotnet/android-tools@8ab60e4: [ci] Use latest macOS and Windows images (dotnet#181)
  * dotnet/android-tools@4dd3292: LEGO: Merge pull request 182
  * dotnet/android-tools@56b61f1: [Localization] Add OneLocBuild job (dotnet#175)
  * dotnet/android-tools@14076a6: [Xamarin.Android.Tools.AndroidSdk] Add API-32 to KnownVersions
  * dotnet/android-tools@9c641b3: [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-32 (dotnet#169)
  * dotnet/android-tools@ec346d0: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r24 (dotnet#171)
  * dotnet/android-tools@47832f1: [Xamarin.Android.Tools.AndroidSdk] AndroidSdkInfo validation locator (dotnet#170)
  * dotnet/android-tools@20f6112: Bump LibZipSharp to 2.0.4 (dotnet#166)
  * dotnet/android-tools@e4f0d59: Add support for writing android:roundIcon to Android manifest (dotnet#162)

Add a reference to the [Microsoft.SourceLink.GitHub NuGet package][0]
to `src/*/*.csproj` and `tools/*/*.csproj` so that `*.pdb` such as
`Java.Interop.pdb` contain URLs to facilitate debugging into their
corresponding assemblies without needing to checkout and build the
`Java.Interop` repo locally:

	% dotnet tool install --global SourceLink --version 3.1.1

	% $HOME/.dotnet/tools/sourcelink print-urls bin/Debug-net7.0/Java.Interop.pdb
	c1eaa3b7ef9a7354080ca02e56f5052a7b04fcf78298210fb69a1c05c5827c3d sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/GlobalSuppressions.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/GlobalSuppressions.cs
	…

	% $HOME/.dotnet/tools/sourcelink test bin/Debug-net7.0/Java.Interop.pdb
	3 Documents with errors:
	983b6f609d1a601d57df96467aafe6a0cc6173a23d261f98ad582d16983259a9 sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/obj/Debug/net7.0/JniEnvironment.g.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/obj/Debug/net7.0/JniEnvironment.g.cs
	error: url failed NotFound: Not Found
	9596da901062cf5add81d66c23696ca92bbfa59c82fe10f4f06d45292e2cb0ff sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs
	error: url failed NotFound: Not Found
	508b170eae1ea8b281b2a892293c0b1f2b1ee67db1bd8ce89036541d3f121643 sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/obj/Debug/net7.0/Java.Interop.AssemblyInfo.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/obj/Debug/net7.0/Java.Interop.AssemblyInfo.cs
	error: url failed NotFound: Not Found
	sourcelink test failed

These errors are expected, as they are generated files.

[0]: https://www.nuget.org/packages/Microsoft.SourceLink.GitHub
jonpryor added a commit to jonpryor/java.interop that referenced this pull request Aug 26, 2022
Context: dotnet/android@7b4d4b8
Context: https://github.com/dotnet/sourcelink#githubcom-and-github-enterprise
Context: https://www.hanselman.com/blog/exploring-net-cores-sourcelink-stepping-into-the-source-code-of-nuget-packages-you-dont-own

Changes: http://github.com/xamarin/xamarin-android-tools/compare/fc3c2ac191a47715bc58e110ef28f38009158416...29f11f2a304376bfa96de999a78083fe5a8174c6

  * dotnet/android-tools@29f11f2: Bump to mono/mono.posix@d8994ca, dotnet/android-libzipsharp@98e9173 (dotnet#193)
  * dotnet/android-tools@7cfe683: [ci] Use Microsoft.SourceLink.GitHub (dotnet#192)
  * dotnet/android-tools@01a0dde: [Localization] Import translated resx files (dotnet#189)
  * dotnet/android-tools@cc715d9: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r25 (dotnet#190)
  * dotnet/android-tools@3c55e9a: Avoid `Environment.SpecialFolder.ApplicationData` (dotnet#188)
  * dotnet/android-tools@0d55472: LEGO: Merge pull request 187
  * dotnet/android-tools@6946512: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729154833425. (dotnet#186)
  * dotnet/android-tools@6e3433a: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729025332507. (dotnet#185)
  * dotnet/android-tools@73c4388: [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-33 (dotnet#184)
  * dotnet/android-tools@da3653e: [Xamarin.Android.Tools.AndroidSdk] Add API-33 to KnownVersions
  * dotnet/android-tools@327d433: [ci] Run OneLocBuild on a schedule (dotnet#180)
  * dotnet/android-tools@8ab60e4: [ci] Use latest macOS and Windows images (dotnet#181)
  * dotnet/android-tools@4dd3292: LEGO: Merge pull request 182
  * dotnet/android-tools@56b61f1: [Localization] Add OneLocBuild job (dotnet#175)
  * dotnet/android-tools@14076a6: [Xamarin.Android.Tools.AndroidSdk] Add API-32 to KnownVersions
  * dotnet/android-tools@9c641b3: [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-32 (dotnet#169)
  * dotnet/android-tools@ec346d0: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r24 (dotnet#171)
  * dotnet/android-tools@47832f1: [Xamarin.Android.Tools.AndroidSdk] AndroidSdkInfo validation locator (dotnet#170)
  * dotnet/android-tools@20f6112: Bump LibZipSharp to 2.0.4 (dotnet#166)
  * dotnet/android-tools@e4f0d59: Add support for writing android:roundIcon to Android manifest (dotnet#162)

Add a reference to the [Microsoft.SourceLink.GitHub NuGet package][0]
to `src/*/*.csproj` and `tools/*/*.csproj` so that `*.pdb` such as
`Java.Interop.pdb` contain URLs to facilitate debugging into their
corresponding assemblies without needing to checkout and build the
`Java.Interop` repo locally:

	% dotnet tool install --global SourceLink --version 3.1.1

	% $HOME/.dotnet/tools/sourcelink print-urls bin/Debug-net7.0/Java.Interop.pdb
	c1eaa3b7ef9a7354080ca02e56f5052a7b04fcf78298210fb69a1c05c5827c3d sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/GlobalSuppressions.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/GlobalSuppressions.cs
	…

	% $HOME/.dotnet/tools/sourcelink test bin/Debug-net7.0/Java.Interop.pdb
	3 Documents with errors:
	983b6f609d1a601d57df96467aafe6a0cc6173a23d261f98ad582d16983259a9 sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/obj/Debug/net7.0/JniEnvironment.g.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/obj/Debug/net7.0/JniEnvironment.g.cs
	error: url failed NotFound: Not Found
	9596da901062cf5add81d66c23696ca92bbfa59c82fe10f4f06d45292e2cb0ff sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs
	error: url failed NotFound: Not Found
	508b170eae1ea8b281b2a892293c0b1f2b1ee67db1bd8ce89036541d3f121643 sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/obj/Debug/net7.0/Java.Interop.AssemblyInfo.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/obj/Debug/net7.0/Java.Interop.AssemblyInfo.cs
	error: url failed NotFound: Not Found
	sourcelink test failed

These errors are expected, as they are generated files.

[0]: https://www.nuget.org/packages/Microsoft.SourceLink.GitHub
jonpryor added a commit that referenced this pull request Aug 26, 2022
Context: dotnet/android@7b4d4b8
Context: https://github.com/dotnet/sourcelink#githubcom-and-github-enterprise
Context: https://www.hanselman.com/blog/exploring-net-cores-sourcelink-stepping-into-the-source-code-of-nuget-packages-you-dont-own

Changes: http://github.com/xamarin/xamarin-android-tools/compare/fc3c2ac191a47715bc58e110ef28f38009158416...29f11f2a304376bfa96de999a78083fe5a8174c6

  * dotnet/android-tools@29f11f2: Bump to mono/mono.posix@d8994ca, dotnet/android-libzipsharp@98e9173 (#193)
  * dotnet/android-tools@7cfe683: [ci] Use Microsoft.SourceLink.GitHub (#192)
  * dotnet/android-tools@01a0dde: [Localization] Import translated resx files (#189)
  * dotnet/android-tools@cc715d9: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r25 (#190)
  * dotnet/android-tools@3c55e9a: Avoid `Environment.SpecialFolder.ApplicationData` (#188)
  * dotnet/android-tools@0d55472: LEGO: Merge pull request 187
  * dotnet/android-tools@6946512: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729154833425. (#186)
  * dotnet/android-tools@6e3433a: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729025332507. (#185)
  * dotnet/android-tools@73c4388: [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-33 (#184)
  * dotnet/android-tools@da3653e: [Xamarin.Android.Tools.AndroidSdk] Add API-33 to KnownVersions
  * dotnet/android-tools@327d433: [ci] Run OneLocBuild on a schedule (#180)
  * dotnet/android-tools@8ab60e4: [ci] Use latest macOS and Windows images (#181)
  * dotnet/android-tools@4dd3292: LEGO: Merge pull request 182
  * dotnet/android-tools@56b61f1: [Localization] Add OneLocBuild job (#175)
  * dotnet/android-tools@14076a6: [Xamarin.Android.Tools.AndroidSdk] Add API-32 to KnownVersions
  * dotnet/android-tools@9c641b3: [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-32 (#169)
  * dotnet/android-tools@ec346d0: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r24 (#171)
  * dotnet/android-tools@47832f1: [Xamarin.Android.Tools.AndroidSdk] AndroidSdkInfo validation locator (#170)
  * dotnet/android-tools@20f6112: Bump LibZipSharp to 2.0.4 (#166)
  * dotnet/android-tools@e4f0d59: Add support for writing android:roundIcon to Android manifest (#162)

Add a reference to the [Microsoft.SourceLink.GitHub NuGet package][0]
to `src/*/*.csproj` and `tools/*/*.csproj` so that `*.pdb` such as
`Java.Interop.pdb` contain URLs to facilitate debugging into their
corresponding assemblies without needing to checkout and build the
`Java.Interop` repo locally:

	% dotnet tool install --global SourceLink --version 3.1.1

	% $HOME/.dotnet/tools/sourcelink print-urls bin/Debug-net7.0/Java.Interop.pdb
	c1eaa3b7ef9a7354080ca02e56f5052a7b04fcf78298210fb69a1c05c5827c3d sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/GlobalSuppressions.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/GlobalSuppressions.cs
	…

	% $HOME/.dotnet/tools/sourcelink test bin/Debug-net7.0/Java.Interop.pdb
	3 Documents with errors:
	983b6f609d1a601d57df96467aafe6a0cc6173a23d261f98ad582d16983259a9 sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/obj/Debug/net7.0/JniEnvironment.g.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/obj/Debug/net7.0/JniEnvironment.g.cs
	error: url failed NotFound: Not Found
	9596da901062cf5add81d66c23696ca92bbfa59c82fe10f4f06d45292e2cb0ff sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs
	error: url failed NotFound: Not Found
	508b170eae1ea8b281b2a892293c0b1f2b1ee67db1bd8ce89036541d3f121643 sha256 csharp /Volumes/Xamarin-Work/src/xamarin/Java.Interop/src/Java.Interop/obj/Debug/net7.0/Java.Interop.AssemblyInfo.cs
	https://raw.githubusercontent.com/jonpryor/Java.Interop/6d1ae4ee1076341f8af36dbdd306dce0e6266999/src/Java.Interop/obj/Debug/net7.0/Java.Interop.AssemblyInfo.cs
	error: url failed NotFound: Not Found
	sourcelink test failed

These errors are expected, as they are generated files.

[0]: https://www.nuget.org/packages/Microsoft.SourceLink.GitHub
@github-actions github-actions bot locked and limited conversation to collaborators Apr 15, 2024
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.

3 participants