Open
Description
Roslyn has a capability to emit special debug information for C#/VB async methods.
F# doesn't emit this information. This means we must, in some way, be missing out on a debug capability supported by .NET debugging.
- clarify the user-facing experience this supports and verify it is not supported by F#
- collect the information in the compiler as we generate resumable code
- implement the code to emit this information
- see if it is useful beyond F# tasks.
Portable PDB spec is here: https://github.com/dotnet/runtime/blob/main/docs/design/specs/PortablePdb-Metadata.md
Also aplies to "StateMachine Local Scopes"
https://github.com/dotnet/roslyn/blob/3d8acbd585a75e9cdb3509623bf6c39ceb46b2c2/src/Compilers/Core/Portable/PEWriter/MetadataWriter.PortablePdb.cs
Here's an example of what they emit: https://github.com/dotnet/roslyn/blob/3d8acbd585a75e9cdb3509623bf6c39ceb46b2c2/src/Compilers/Core/Portable/PEWriter/MetadataWriter.PortablePdb.cs
private void SerializeAsyncMethodSteppingInfo(AsyncMoveNextBodyDebugInfo asyncInfo, MethodDefinitionHandle moveNextMethod, int aggregateMethodDefRid)
{
Debug.Assert(asyncInfo.ResumeOffsets.Length == asyncInfo.YieldOffsets.Length);
Debug.Assert(asyncInfo.CatchHandlerOffset >= -1);
var writer = new BlobBuilder();
writer.WriteUInt32((uint)((long)asyncInfo.CatchHandlerOffset + 1));
for (int i = 0; i < asyncInfo.ResumeOffsets.Length; i++)
{
writer.WriteUInt32((uint)asyncInfo.YieldOffsets[i]);
writer.WriteUInt32((uint)asyncInfo.ResumeOffsets[i]);
writer.WriteCompressedInteger(aggregateMethodDefRid);
}
_debugMetadataOpt.AddCustomDebugInformation(
parent: moveNextMethod,
kind: _debugMetadataOpt.GetOrAddGuid(PortableCustomDebugInfoKinds.AsyncMethodSteppingInformationBlob),
value: _debugMetadataOpt.GetOrAddBlob(writer));
}
Metadata
Metadata
Assignees
Type
Projects
Status
New