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)); }
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)); }
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); }