Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@vadym-kl
Copy link
Member

Includes the following changes:

Microsoft.Quantum.Simulation.Common

  • Added StackTrace.cs : Q# specific StackFrame and StackTraceCollector that listens to SimulatorBase events to keep track of stack trace.
  • Added PortablePDBReader.cs to access SourceLink and source code information from PortablePDBs.
  • Changes to SimulatorBase.cs : Modified Run method to dump Q# stack trace in case of unhandled exception, added EnableStackTrace() method and CallStack property.
  • Changes to Microsoft.Quantum.Simulation.Common.csproj : added dependency on System.Reflection.Metadata to read PortablePDBs.

Microsoft.Quantum.Simulation.Core

  • Added IWrappedOperation interface, so there is an easy uniform way to get to operation being wrapped by AdjointedOperation, ControlledOperation and other similar wrappers. This is necessary to get to the attributes that contain source file and line numbers of ICallables.
    This affects several files in src/Simulation/Core/Generics and src/Simulation/Core/Operations.
  • Added type extension method UnwrapCallable to assist with unwrapping using IWrappedOperation interface.

Microsoft.Quantum.QsCompiler.CsharpGeneration

Includes @bettinaheim's fix in src/Simulation/CsharpGeneration/SimulationCode.fs to use base one line numbers uniformly in all C# generated code; inside #line directives and in SourceLocation attributes.

Microsoft.Quantum.Simulation.Simulators.Tests

  • Added tests covering stack trace and advanced source extraction from PortablePDBs, such as source URLs and source code itself.
  • Enabled SourceLink and PortablePDBs generation in the test project, so related features can be tested.

@vadym-kl vadym-kl requested review from anpaz and bettinaheim October 30, 2019 02:19
@vadym-kl vadym-kl requested a review from avasch01 October 30, 2019 04:35
@vadym-kl vadym-kl requested a review from avasch01 October 30, 2019 18:27
Copy link
Contributor

@avasch01 avasch01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Copy link
Member

@anpaz anpaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. I do have some comments but nothing major. Thanks!

Copy link
Member

@anpaz anpaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks

/// https://github.com/dotnet/designs/blob/master/accepted/diagnostics/source-link.md#source-link-json-schema
/// </summary>
[Serializable]
public class SourceLinkPathRemapping
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if this should just be called SourceLink or SourceLinkData or SourceLinkInfo.

#region Stack trace collection support
private StackTraceCollector stackTraceCollector = null;

public void EnableStackTrace()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see if we can instead enabling by default and just disabling it explicitly.

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.

5 participants