Open jnm2 opened 6 years ago
Roslyn 2.6.1
I need a way to add embedded source to a MetadataBuilder. Currently this requires reflection:
// https://github.com/dotnet/roslyn/blob/ee2a411ff9aeb2f78da962e2abaa0b69da3f925c/src/Dependencies/CodeAnalysis.Debugging/PortableCustomDebugInfoKinds.cs#L17 private static readonly Guid PortableCustomDebugInfoKinds_EmbeddedSource = new Guid("0E8A571B-6926-466E-B4AD-8AB04611F5FE"); // https://github.com/dotnet/roslyn/blob/ee2a411ff9aeb2f78da962e2abaa0b69da3f925c/src/Compilers/Core/Portable/EmbeddedText.cs#L79 private static readonly Func<EmbeddedText, ImmutableArray<byte>> get_Blob = (Func<EmbeddedText, ImmutableArray<byte>>) typeof(EmbeddedText) .GetProperty("Blob", BindingFlags.Instance | BindingFlags.NonPublic) .GetGetMethod(true) .CreateDelegate(typeof(Func<EmbeddedText, ImmutableArray<byte>>)); // ... (MetadataBuilder builder) builder.AddCustomDebugInformation( parent: documentHandle, kind: builder.GetOrAddGuid(PortableCustomDebugInfoKinds_EmbeddedSource), value: builder.GetOrAddBlob(get_Blob.Invoke(embeddedText)));
Please make these internal APIs public (or provide an equivalent alternative which returns both the serialized blob and the checksum):
namespace Microsoft.CodeAnalysis { public sealed class EmbeddedText { + public ImmutableArray<byte> Blob { get; } } } namespace Microsoft.CodeAnalysis.Debugging { + public static class PortableCustomDebugInfoKinds + { + public static readonly Guid EmbeddedSource; + } }
https://github.com/dotnet/roslyn/blob/a2f028526a329950a891d5c74a5b8d703168297c/src/Compilers/Core/Portable/EmbeddedText.cs#L79
Comment just above:
https://github.com/dotnet/roslyn/blob/a2f028526a329950a891d5c74a5b8d703168297c/src/Compilers/Core/Portable/EmbeddedText.cs#L65-L68
https://github.com/dotnet/roslyn/blob/ee2a411ff9aeb2f78da962e2abaa0b69da3f925c/src/Dependencies/CodeAnalysis.Debugging/PortableCustomDebugInfoKinds.cs#L17
Tagging @tmat
Roslyn 2.6.1
Problem
I need a way to add embedded source to a MetadataBuilder. Currently this requires reflection:
Proposal
Please make these internal APIs public (or provide an equivalent alternative which returns both the serialized blob and the checksum):
Existing API
https://github.com/dotnet/roslyn/blob/a2f028526a329950a891d5c74a5b8d703168297c/src/Compilers/Core/Portable/EmbeddedText.cs#L79
Comment just above:
https://github.com/dotnet/roslyn/blob/a2f028526a329950a891d5c74a5b8d703168297c/src/Compilers/Core/Portable/EmbeddedText.cs#L65-L68
https://github.com/dotnet/roslyn/blob/ee2a411ff9aeb2f78da962e2abaa0b69da3f925c/src/Dependencies/CodeAnalysis.Debugging/PortableCustomDebugInfoKinds.cs#L17