public Validator( string[] markedSource, ImmutableArray <ActiveStatementDebugInfo> activeStatements, ImmutableDictionary <ActiveMethodId, ImmutableArray <NonRemappableRegion> > nonRemappableRegions = null, Func <Solution, Solution> adjustSolution = null, CommittedSolution.DocumentState initialState = CommittedSolution.DocumentState.MatchesBuildOutput, bool openDocuments = false) { Workspace = TestWorkspace.CreateCSharp(ActiveStatementsDescription.ClearTags(markedSource), composition: s_composition, openDocuments: openDocuments); if (adjustSolution != null) { Workspace.ChangeSolution(adjustSolution(Workspace.CurrentSolution)); } var solution = Workspace.CurrentSolution; var mockDebuggeModuleProvider = new Mock <IDebuggeeModuleMetadataProvider>(MockBehavior.Strict); var mockCompilationOutputsProvider = new Func <Project, CompilationOutputs>(_ => new MockCompilationOutputs(Guid.NewGuid())); var debuggingSession = new DebuggingSession(solution, mockCompilationOutputsProvider); if (initialState != CommittedSolution.DocumentState.None) { EditAndContinueWorkspaceServiceTests.SetDocumentsState(debuggingSession, solution, initialState); } debuggingSession.Test_SetNonRemappableRegions(nonRemappableRegions ?? ImmutableDictionary <ActiveMethodId, ImmutableArray <NonRemappableRegion> > .Empty); var telemetry = new EditSessionTelemetry(); EditSession = new EditSession(debuggingSession, telemetry, cancellationToken => Task.FromResult(activeStatements), mockDebuggeModuleProvider.Object); }
public Validator( string[] markedSource, ImmutableArray <ActiveStatementDebugInfo> activeStatements, ImmutableDictionary <ActiveMethodId, ImmutableArray <NonRemappableRegion> > nonRemappableRegions = null, Func <Solution, Solution> adjustSolution = null, CommittedSolution.DocumentState initialState = CommittedSolution.DocumentState.MatchesBuildOutput) { var exportProviderFactory = ExportProviderCache.GetOrCreateExportProviderFactory( TestExportProvider.MinimumCatalogWithCSharpAndVisualBasic.WithPart(typeof(CSharpEditAndContinueAnalyzer)).WithPart(typeof(DummyLanguageService))); var exportProvider = exportProviderFactory.CreateExportProvider(); Workspace = TestWorkspace.CreateCSharp(ActiveStatementsDescription.ClearTags(markedSource), exportProvider: exportProvider, openDocuments: true); if (adjustSolution != null) { Workspace.ChangeSolution(adjustSolution(Workspace.CurrentSolution)); } var mockDebuggeModuleProvider = new Mock <IDebuggeeModuleMetadataProvider>(); var mockCompilationOutputsProvider = new Func <Project, CompilationOutputs>(_ => new MockCompilationOutputs(Guid.NewGuid())); var debuggingSession = new DebuggingSession(Workspace, mockDebuggeModuleProvider.Object, mockCompilationOutputsProvider); if (initialState != CommittedSolution.DocumentState.None) { EditAndContinueWorkspaceServiceTests.SetDocumentsState(debuggingSession, Workspace.CurrentSolution, initialState); } debuggingSession.Test_SetNonRemappableRegions(nonRemappableRegions ?? ImmutableDictionary <ActiveMethodId, ImmutableArray <NonRemappableRegion> > .Empty); var telemetry = new EditSessionTelemetry(); EditSession = new EditSession(debuggingSession, telemetry, cancellationToken => Task.FromResult(activeStatements)); }
private static EditSession CreateEditSession( Solution solution, ImmutableArray <ManagedActiveStatementDebugInfo> activeStatements, ImmutableDictionary <ManagedMethodId, ImmutableArray <NonRemappableRegion> > nonRemappableRegions = null, CommittedSolution.DocumentState initialState = CommittedSolution.DocumentState.MatchesBuildOutput) { var mockDebuggerService = new MockManagedEditAndContinueDebuggerService() { GetActiveStatementsImpl = () => activeStatements }; var mockCompilationOutputsProvider = new Func <Project, CompilationOutputs>(_ => new MockCompilationOutputs(Guid.NewGuid())); var debuggingSession = new DebuggingSession(solution, mockDebuggerService, mockCompilationOutputsProvider, SpecializedCollections.EmptyEnumerable <KeyValuePair <DocumentId, CommittedSolution.DocumentState> >()); if (initialState != CommittedSolution.DocumentState.None) { EditAndContinueWorkspaceServiceTests.SetDocumentsState(debuggingSession, solution, initialState); } debuggingSession.Test_SetNonRemappableRegions(nonRemappableRegions ?? ImmutableDictionary <ManagedMethodId, ImmutableArray <NonRemappableRegion> > .Empty); var telemetry = new EditSessionTelemetry(); return(new EditSession(debuggingSession, telemetry, inBreakState: true)); }
private static EditSession CreateEditSession( Solution solution, ImmutableArray <ManagedActiveStatementDebugInfo> activeStatements, ImmutableDictionary <ManagedMethodId, ImmutableArray <NonRemappableRegion> > nonRemappableRegions = null, CommittedSolution.DocumentState initialState = CommittedSolution.DocumentState.MatchesBuildOutput) { var mockDebuggerService = new MockManagedEditAndContinueDebuggerService() { GetActiveStatementsImpl = () => activeStatements }; var mockCompilationOutputsProvider = new Func <Project, CompilationOutputs>(_ => new MockCompilationOutputs(Guid.NewGuid())); var debuggingSession = new DebuggingSession( new DebuggingSessionId(1), solution, mockDebuggerService, EditAndContinueTestHelpers.Net5RuntimeCapabilities, mockCompilationOutputsProvider, SpecializedCollections.EmptyEnumerable <KeyValuePair <DocumentId, CommittedSolution.DocumentState> >(), reportDiagnostics: true); if (initialState != CommittedSolution.DocumentState.None) { EditAndContinueWorkspaceServiceTests.SetDocumentsState(debuggingSession, solution, initialState); } debuggingSession.GetTestAccessor().SetNonRemappableRegions(nonRemappableRegions ?? ImmutableDictionary <ManagedMethodId, ImmutableArray <NonRemappableRegion> > .Empty); debuggingSession.RestartEditSession(inBreakState: true, out _); return(debuggingSession.EditSession); }
private DiagnosticsUpdatedArgs MakeArgs( DebuggingSession session, object errorId, Workspace workspace, Solution solution, ProjectId projectId, DocumentId documentId, ImmutableArray <DiagnosticData> items) { return(new DiagnosticsUpdatedArgs( id: new EnCId(session, errorId), workspace: workspace, solution: solution, projectId: projectId, documentId: documentId, diagnostics: items)); }
public void ClearDiagnostics(DebuggingSession session, Workspace workspace, object kind, ProjectId projectId, ImmutableArray <DocumentId> documentIds) { if (documentIds.IsDefault) { return; } foreach (var documentId in documentIds) { ClearDiagnostics(session, workspace, kind, projectId, documentId); } }
public ImmutableArray <DocumentId> ReportDiagnostics(DebuggingSession session, object errorId, ProjectId projectId, Solution solution, IEnumerable <Diagnostic> diagnostics) { var argsByDocument = ImmutableArray.CreateRange( from diagnostic in diagnostics let document = solution.GetDocument(diagnostic.Location.SourceTree) where document != null let item = MakeDiagnosticData(projectId, document, solution, diagnostic) group item by document.Id into itemsByDocumentId select MakeArgs(session, errorId, solution.Workspace, solution, projectId, itemsByDocumentId.Key, ImmutableArray.CreateRange(itemsByDocumentId))); foreach (var args in argsByDocument) { RaiseDiagnosticsUpdated(args); } return(argsByDocument.SelectAsArray(args => args.DocumentId)); }
public Validator( string[] markedSource, ImmutableArray <ManagedActiveStatementDebugInfo> activeStatements, ImmutableDictionary <ManagedMethodId, ImmutableArray <NonRemappableRegion> > nonRemappableRegions = null, Func <Solution, Solution> adjustSolution = null, CommittedSolution.DocumentState initialState = CommittedSolution.DocumentState.MatchesBuildOutput, bool openDocuments = false) { Workspace = TestWorkspace.CreateCSharp(ActiveStatementsDescription.ClearTags(markedSource), composition: s_composition, openDocuments: openDocuments); if (adjustSolution != null) { Workspace.ChangeSolution(adjustSolution(Workspace.CurrentSolution)); } var solution = Workspace.CurrentSolution; var mockDebuggerService = new MockManagedEditAndContinueDebuggerService() { GetActiveStatementsImpl = () => activeStatements }; var mockCompilationOutputsProvider = new Func <Project, CompilationOutputs>(_ => new MockCompilationOutputs(Guid.NewGuid())); var debuggingSession = new DebuggingSession(solution, mockCompilationOutputsProvider, SpecializedCollections.EmptyEnumerable <KeyValuePair <DocumentId, CommittedSolution.DocumentState> >()); if (initialState != CommittedSolution.DocumentState.None) { EditAndContinueWorkspaceServiceTests.SetDocumentsState(debuggingSession, solution, initialState); } debuggingSession.Test_SetNonRemappableRegions(nonRemappableRegions ?? ImmutableDictionary <ManagedMethodId, ImmutableArray <NonRemappableRegion> > .Empty); var telemetry = new EditSessionTelemetry(); EditSession = new EditSession(debuggingSession, telemetry, mockDebuggerService); }
private DiagnosticsUpdatedArgs MakeRemovedArgs( DebuggingSession session, object errorId, Workspace workspace, Solution solution, ProjectId projectId, DocumentId documentId) { return(DiagnosticsUpdatedArgs.DiagnosticsRemoved( CreateId(session, errorId), workspace, solution, projectId, documentId)); }
private DiagnosticsUpdatedArgs MakeArgs( DebuggingSession session, Workspace workspace, object errorId, ProjectId projectId, DocumentId documentId, ImmutableArray <DiagnosticData> items) { return(MakeArgs(session, errorId, workspace, solution: null, projectId: projectId, documentId: documentId, items: items)); }
public void ClearDiagnostics(DebuggingSession session, Workspace workspace, object errorId, ProjectId projectId, DocumentId documentId) { RaiseDiagnosticsUpdated(MakeArgs(session, workspace, errorId, projectId, documentId, ImmutableArray.Create <DiagnosticData>())); }
private DiagnosticsUpdatedArgs MakeRemovedArgs( DebuggingSession session, Workspace workspace, object errorId, ProjectId projectId, DocumentId documentId) { return(MakeRemovedArgs(session, errorId, workspace, solution: null, projectId: projectId, documentId: documentId)); }
public void ClearDiagnostics(DebuggingSession session, Workspace workspace, object errorId, ProjectId projectId, DocumentId documentId) { RaiseDiagnosticsUpdated(MakeRemovedArgs(session, workspace, errorId, projectId, documentId)); }
private static EnCId CreateId(DebuggingSession session, object errorId) => new EnCId(session, errorId);
internal ImmutableArray <DocumentId> ReportDiagnostics(DebuggingSession session, object errorId, ProjectId projectId, Solution solution, IEnumerable <Diagnostic> diagnostics) { return(ReportDiagnostics(new EncErrorId(session, errorId), solution, projectId, diagnostics)); }
private DiagnosticsUpdatedArgs MakeCreatedArgs( DebuggingSession session, object errorId, Workspace workspace, Solution solution, ProjectId projectId, DocumentId documentId, ImmutableArray <DiagnosticData> items) { return(DiagnosticsUpdatedArgs.DiagnosticsCreated( CreateId(session, errorId), workspace, solution, projectId, documentId, items)); }
internal void ClearDiagnostics(DebuggingSession session, Workspace workspace, object errorId, ProjectId projectId, ImmutableArray <DocumentId> documentIds) { ClearDiagnostics(new EncErrorId(session, errorId), workspace.CurrentSolution, projectId, documentIds); }
public TestAccessor(DebuggingSession instance) => _instance = instance;