From a931a4e8faa6b2be445d52c05a3d854f875e94ab Mon Sep 17 00:00:00 2001 From: Oleg Tkachenko Date: Wed, 24 Jan 2018 08:27:18 -0800 Subject: [PATCH 01/43] Migrate to latest editor bits in 15.6stg --- build/Targets/Packages.props | 22 +++++++++---------- .../RenameCommandHandler_RenameHandler.cs | 4 ++-- .../GoToAdjacentMemberCommandHandler.cs | 6 ++--- .../FindReferencesCommandHandler.cs | 4 ++-- .../GoToDefinitionCommandHandler.cs | 6 ++--- .../GoToImplementationCommandHandler.cs | 6 ++--- ...bstractAutomaticLineEnderCommandHandler.cs | 2 +- .../AbstractChangeSignatureCommandHandler.cs | 8 +++---- ...CommentUncommentSelectionCommandHandler.cs | 2 +- ...tractDocumentationCommentCommandHandler.cs | 4 ++-- .../AbstractXmlTagCompletionCommandHandler.cs | 4 ++-- .../AbstractEncapsulateFieldCommandHandler.cs | 2 +- .../AbstractExtractInterfaceCommandHandler.cs | 2 +- .../AbstractExtractMethodCommandHandler.cs | 4 ++-- .../FormatCommandHandler.FormatDocument.cs | 4 ++-- .../FormatCommandHandler.FormatSelection.cs | 4 ++-- .../Formatting/FormatCommandHandler.Paste.cs | 4 ++-- .../OrganizeDocumentCommandHandler.cs | 8 +++---- .../Utilities/TestUIThreadOperationContext.cs | 2 +- .../LineCommit/CommitCommandHandler.vb | 16 +++++++------- .../Interactive/InteractiveCommandHandler.cs | 8 +++---- .../CallHierarchyCommandHandler.cs | 4 ++-- .../AbstractSyncClassViewCommandHandler.cs | 4 ++-- 23 files changed, 65 insertions(+), 65 deletions(-) diff --git a/build/Targets/Packages.props b/build/Targets/Packages.props index 915eab7331783..48351b249a49c 100644 --- a/build/Targets/Packages.props +++ b/build/Targets/Packages.props @@ -72,24 +72,24 @@ 15.0.26730-alpha 15.0.26730-alpha 15.5.23 - 15.6.253-preview + 15.6.281-preview 15.0.26811-vsucorediag 15.0.26811-vsucorediag 10.0.30319 1.1.4322 15.0.26730-alpha - 15.6.253-preview + 15.6.281-preview 15.0.26730-alpha 15.0.26730-alpha 15.0.26730-alpha 15.0.25726-Preview5 2.0.0-rc3-61304-01 15.3.1710.203 - 15.6.253-preview - 15.6.253-preview - 15.6.253-preview + 15.6.281-preview + 15.6.281-preview + 15.6.281-preview 7.10.6070 - 15.6.253-preview + 15.6.281-preview 15.0.26730-alpha 15.0.26730-alpha 15.0.26730-alpha @@ -115,11 +115,11 @@ 9.0.30729 15.0.26730-alpha 8.0.0.0-alpha - 15.6.253-preview - 15.6.253-preview - 15.6.253-preview - 15.6.253-preview - 15.6.253-preview + 15.6.281-preview + 15.6.281-preview + 15.6.281-preview + 15.6.281-preview + 15.6.281-preview 7.10.6070 10.0.30319 12.0.30110 diff --git a/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_RenameHandler.cs b/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_RenameHandler.cs index 77d09248e1f09..7a10692c1cf90 100644 --- a/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_RenameHandler.cs +++ b/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_RenameHandler.cs @@ -47,9 +47,9 @@ public VSCommanding.CommandState GetCommandState(RenameCommandArgs args, Func m["type"] = "legacy"), - context.WaitContext.UserCancellationToken)) + context.OperationContext.UserCancellationToken)) { if (!service.TryFindReferences(document, caretPosition, new WaitContextAdapter(waitScope))) { diff --git a/src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs b/src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs index 2bec52f41b614..5b2943e31da61 100644 --- a/src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs +++ b/src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs @@ -63,10 +63,10 @@ internal bool TryExecuteCommand(Document document, int caretPosition, IGoToDefin { string errorMessage = null; - using (context.WaitContext.AddScope(allowCancellation: true, EditorFeaturesResources.Navigating_to_definition)) + using (context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Navigating_to_definition)) { if (goToDefinitionService != null && - goToDefinitionService.TryGoToDefinition(document, caretPosition, context.WaitContext.UserCancellationToken)) + goToDefinitionService.TryGoToDefinition(document, caretPosition, context.OperationContext.UserCancellationToken)) { return true; } @@ -79,7 +79,7 @@ internal bool TryExecuteCommand(Document document, int caretPosition, IGoToDefin // We are about to show a modal UI dialog so we should take over the command execution // wait context. That means the command system won't attempt to show its own wait dialog // and also will take it into consideration when measuring command handling duration. - context.WaitContext.TakeOwnership(); + context.OperationContext.TakeOwnership(); var workspace = document.Project.Solution.Workspace; var notificationService = workspace.Services.GetService(); notificationService.SendNotification(errorMessage, title: EditorFeaturesResources.Go_to_Definition, severity: NotificationSeverity.Information); diff --git a/src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs b/src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs index d640f2eef633a..5a89265f478fa 100644 --- a/src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs +++ b/src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs @@ -86,9 +86,9 @@ private void ExecuteCommand( // We have all the cheap stuff, so let's do expensive stuff now string messageToShow = null; - using (context.WaitContext.AddScope(allowCancellation: true, EditorFeaturesResources.Locating_implementations)) + using (context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Locating_implementations)) { - var userCancellationToken = context.WaitContext.UserCancellationToken; + var userCancellationToken = context.OperationContext.UserCancellationToken; if (canUseStreamingWindow) { StreamingGoToImplementation( @@ -108,7 +108,7 @@ private void ExecuteCommand( // We are about to show a modal UI dialog so we should take over the command execution // wait context. That means the command system won't attempt to show its own wait dialog // and also will take it into consideration when measuring command handling duration. - context.WaitContext.TakeOwnership(); + context.OperationContext.TakeOwnership(); var notificationService = document.Project.Solution.Workspace.Services.GetService(); notificationService.SendNotification(messageToShow, title: EditorFeaturesResources.Go_To_Implementation, diff --git a/src/EditorFeatures/Core/Implementation/AutomaticCompletion/AbstractAutomaticLineEnderCommandHandler.cs b/src/EditorFeatures/Core/Implementation/AutomaticCompletion/AbstractAutomaticLineEnderCommandHandler.cs index edd29f2bc1260..0b5a61effc31c 100644 --- a/src/EditorFeatures/Core/Implementation/AutomaticCompletion/AbstractAutomaticLineEnderCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/AutomaticCompletion/AbstractAutomaticLineEnderCommandHandler.cs @@ -80,7 +80,7 @@ public void ExecuteCommand(AutomaticLineEnderCommandArgs args, Action nextHandle return; } - using (context.WaitContext.AddScope(allowCancellation: false, EditorFeaturesResources.Automatically_completing)) + using (context.OperationContext.AddScope(allowCancellation: false, EditorFeaturesResources.Automatically_completing)) { // This is a non cancellable command var userCancellationToken = CancellationToken.None; diff --git a/src/EditorFeatures/Core/Implementation/ChangeSignature/AbstractChangeSignatureCommandHandler.cs b/src/EditorFeatures/Core/Implementation/ChangeSignature/AbstractChangeSignatureCommandHandler.cs index beb1206a4ddcf..07f1655f4c560 100644 --- a/src/EditorFeatures/Core/Implementation/ChangeSignature/AbstractChangeSignatureCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/ChangeSignature/AbstractChangeSignatureCommandHandler.cs @@ -80,7 +80,7 @@ private bool ExecuteCommand(ITextView textView, ITextBuffer subjectBuffer, Comma ChangeSignatureResult result = null; - using (context.WaitContext.AddScope(allowCancellation: true, FeaturesResources.Change_signature)) + using (context.OperationContext.AddScope(allowCancellation: true, FeaturesResources.Change_signature)) { var reorderParametersService = document.GetLanguageService(); result = reorderParametersService.ChangeSignature( @@ -91,10 +91,10 @@ private bool ExecuteCommand(ITextView textView, ITextBuffer subjectBuffer, Comma // We are about to show a modal UI dialog so we should take over the command execution // wait context. That means the command system won't attempt to show its own wait dialog // and also will take it into consideration when measuring command handling duration. - context.WaitContext.TakeOwnership(); + context.OperationContext.TakeOwnership(); workspace.Services.GetService().SendNotification(errorMessage, severity: severity); }, - context.WaitContext.UserCancellationToken); + context.OperationContext.UserCancellationToken); } if (result == null || !result.Succeeded) @@ -110,7 +110,7 @@ private bool ExecuteCommand(ITextView textView, ITextBuffer subjectBuffer, Comma // We are about to show a modal UI dialog so we should take over the command execution // wait context. That means the command system won't attempt to show its own wait dialog // and also will take it into consideration when measuring command handling duration. - context.WaitContext.TakeOwnership(); + context.OperationContext.TakeOwnership(); finalSolution = previewService.PreviewChanges( string.Format(EditorFeaturesResources.Preview_Changes_0, EditorFeaturesResources.Change_Signature), "vs.csharp.refactoring.preview", diff --git a/src/EditorFeatures/Core/Implementation/CommentSelection/CommentUncommentSelectionCommandHandler.cs b/src/EditorFeatures/Core/Implementation/CommentSelection/CommentUncommentSelectionCommandHandler.cs index 58380dcfc9c4f..142018659ad3d 100644 --- a/src/EditorFeatures/Core/Implementation/CommentSelection/CommentUncommentSelectionCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/CommentSelection/CommentUncommentSelectionCommandHandler.cs @@ -91,7 +91,7 @@ internal bool ExecuteCommand(ITextView textView, ITextBuffer subjectBuffer, Oper var message = operation == Operation.Comment ? EditorFeaturesResources.Commenting_currently_selected_text : EditorFeaturesResources.Uncommenting_currently_selected_text; - using (context.WaitContext.AddScope(allowCancellation: false, message)) + using (context.OperationContext.AddScope(allowCancellation: false, message)) { var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); diff --git a/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs b/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs index b705fa7997db0..70b6c5ffbca3c 100644 --- a/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs @@ -575,9 +575,9 @@ public bool ExecuteCommand(InsertCommentCommandArgs args, CommandExecutionContex { var originalCaretPosition = args.TextView.GetCaretPoint(args.SubjectBuffer) ?? -1; - using (context.WaitContext.AddScope(allowCancellation: true, EditorFeaturesResources.Inserting_documentation_comment)) + using (context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Inserting_documentation_comment)) { - return CompleteComment(args.SubjectBuffer, args.TextView, originalCaretPosition, InsertOnCommandInvoke, context.WaitContext.UserCancellationToken); + return CompleteComment(args.SubjectBuffer, args.TextView, originalCaretPosition, InsertOnCommandInvoke, context.OperationContext.UserCancellationToken); } } diff --git a/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractXmlTagCompletionCommandHandler.cs b/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractXmlTagCompletionCommandHandler.cs index 06a10f9a2fc59..1283ecfdf9264 100644 --- a/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractXmlTagCompletionCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractXmlTagCompletionCommandHandler.cs @@ -42,7 +42,7 @@ public void ExecuteCommand(TypeCharCommandArgs args, Action nextHandler, Command return; } - using (context.WaitContext.AddScope(allowCancellation: true, EditorFeaturesResources.Completing_Tag)) + using (context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Completing_Tag)) { var buffer = args.SubjectBuffer; @@ -61,7 +61,7 @@ public void ExecuteCommand(TypeCharCommandArgs args, Action nextHandler, Command return; } - TryCompleteTag(args.TextView, args.SubjectBuffer, document, position.Value, context.WaitContext.UserCancellationToken); + TryCompleteTag(args.TextView, args.SubjectBuffer, document, position.Value, context.OperationContext.UserCancellationToken); } } diff --git a/src/EditorFeatures/Core/Implementation/EncapsulateField/AbstractEncapsulateFieldCommandHandler.cs b/src/EditorFeatures/Core/Implementation/EncapsulateField/AbstractEncapsulateFieldCommandHandler.cs index cb8329afa6ede..69a5380f2bad6 100644 --- a/src/EditorFeatures/Core/Implementation/EncapsulateField/AbstractEncapsulateFieldCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/EncapsulateField/AbstractEncapsulateFieldCommandHandler.cs @@ -50,7 +50,7 @@ public bool ExecuteCommand(EncapsulateFieldCommandArgs args, CommandExecutionCon return false; } - using (var waitScope = context.WaitContext.AddScope(allowCancellation: true, EditorFeaturesResources.Applying_Encapsulate_Field_refactoring)) + using (var waitScope = context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Applying_Encapsulate_Field_refactoring)) { return Execute(args, waitScope); } diff --git a/src/EditorFeatures/Core/Implementation/ExtractInterface/AbstractExtractInterfaceCommandHandler.cs b/src/EditorFeatures/Core/Implementation/ExtractInterface/AbstractExtractInterfaceCommandHandler.cs index 229b6cca72624..c5700719049ce 100644 --- a/src/EditorFeatures/Core/Implementation/ExtractInterface/AbstractExtractInterfaceCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/ExtractInterface/AbstractExtractInterfaceCommandHandler.cs @@ -68,7 +68,7 @@ public bool ExecuteCommand(ExtractInterfaceCommandArgs args, CommandExecutionCon // We are about to show a modal UI dialog so we should take over the command execution // wait context. That means the command system won't attempt to show its own wait dialog // and also will take it into consideration when measuring command handling duration. - context.WaitContext.TakeOwnership(); + context.OperationContext.TakeOwnership(); var extractInterfaceService = document.GetLanguageService(); var result = extractInterfaceService.ExtractInterface( document, diff --git a/src/EditorFeatures/Core/Implementation/ExtractMethod/AbstractExtractMethodCommandHandler.cs b/src/EditorFeatures/Core/Implementation/ExtractMethod/AbstractExtractMethodCommandHandler.cs index 401879beb1744..5c2f30532e11d 100644 --- a/src/EditorFeatures/Core/Implementation/ExtractMethod/AbstractExtractMethodCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/ExtractMethod/AbstractExtractMethodCommandHandler.cs @@ -91,9 +91,9 @@ public bool ExecuteCommand(ExtractMethodCommandArgs args, CommandExecutionContex _renameService.ActiveSession.Commit(); } - using (context.WaitContext.AddScope(allowCancellation: true, EditorFeaturesResources.Applying_Extract_Method_refactoring)) + using (context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Applying_Extract_Method_refactoring)) { - return Execute(args.SubjectBuffer, args.TextView, context.WaitContext); + return Execute(args.SubjectBuffer, args.TextView, context.OperationContext); } } diff --git a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.FormatDocument.cs b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.FormatDocument.cs index 3c3cd17d2476c..4251a597bf888 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.FormatDocument.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.FormatDocument.cs @@ -40,9 +40,9 @@ private bool TryExecuteCommand(FormatDocumentCommandArgs args, CommandExecutionC return false; } - using (context.WaitContext.AddScope(allowCancellation: true, EditorFeaturesResources.Formatting_document)) + using (context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Formatting_document)) { - Format(args.TextView, document, null, context.WaitContext.UserCancellationToken); + Format(args.TextView, document, null, context.OperationContext.UserCancellationToken); } return true; diff --git a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.FormatSelection.cs b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.FormatSelection.cs index 1dcff63942250..03ce5cdb4229f 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.FormatSelection.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.FormatSelection.cs @@ -43,7 +43,7 @@ private bool TryExecuteCommand(FormatSelectionCommandArgs args, CommandExecution return false; } - using (context.WaitContext.AddScope(allowCancellation: true, EditorFeaturesResources.Formatting_currently_selected_text)) + using (context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Formatting_currently_selected_text)) { var buffer = args.SubjectBuffer; @@ -56,7 +56,7 @@ private bool TryExecuteCommand(FormatSelectionCommandArgs args, CommandExecution var formattingSpan = selection[0].Span.ToTextSpan(); - Format(args.TextView, document, formattingSpan, context.WaitContext.UserCancellationToken); + Format(args.TextView, document, formattingSpan, context.OperationContext.UserCancellationToken); // make behavior same as dev12. // make sure we set selection back and set caret position at the end of selection diff --git a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.Paste.cs b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.Paste.cs index c6ded8a11f83b..35fa4e4fe6807 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.Paste.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.Paste.cs @@ -25,9 +25,9 @@ public VSCommanding.CommandState GetCommandState(PasteCommandArgs args, Func.ExecuteCommand(ExecuteInInteractiveCommandArgs args, CommandExecutionContext context) { var window = OpenInteractiveWindow(focus: false); - using (context.WaitContext.AddScope(allowCancellation: true, InteractiveEditorFeaturesResources.Executing_selection_in_Interactive_Window)) + using (context.OperationContext.AddScope(allowCancellation: true, InteractiveEditorFeaturesResources.Executing_selection_in_Interactive_Window)) { - string submission = GetSelectedText(args, context.WaitContext.UserCancellationToken); + string submission = GetSelectedText(args, context.OperationContext.UserCancellationToken); if (!String.IsNullOrWhiteSpace(submission)) { window.SubmitAsync(new string[] { submission }); @@ -107,10 +107,10 @@ private void CopyToWindow(IInteractiveWindow window, CopyToInteractiveCommandArg using (var edit = buffer.CreateEdit()) { - using (var waitScope = context.WaitContext.AddScope(allowCancellation: true, + using (var waitScope = context.OperationContext.AddScope(allowCancellation: true, InteractiveEditorFeaturesResources.Copying_selection_to_Interactive_Window)) { - var text = GetSelectedText(args, context.WaitContext.UserCancellationToken); + var text = GetSelectedText(args, context.OperationContext.UserCancellationToken); // If the last line isn't empty in the existing submission buffer, we will prepend a // newline diff --git a/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyCommandHandler.cs b/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyCommandHandler.cs index fdff2ebf4fc6e..70fa1d5f15695 100644 --- a/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyCommandHandler.cs +++ b/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyCommandHandler.cs @@ -43,9 +43,9 @@ public bool ExecuteCommand(ViewCallHierarchyCommandArgs args, CommandExecutionCo private void AddRootNode(ViewCallHierarchyCommandArgs args, CommandExecutionContext context) { - using (var waitScope = context.WaitContext.AddScope(allowCancellation: true, EditorFeaturesResources.Computing_Call_Hierarchy_Information)) + using (var waitScope = context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Computing_Call_Hierarchy_Information)) { - var cancellationToken = context.WaitContext.UserCancellationToken; + var cancellationToken = context.OperationContext.UserCancellationToken; var document = args.SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); if (document == null) { diff --git a/src/VisualStudio/Core/Def/Implementation/Library/ClassView/AbstractSyncClassViewCommandHandler.cs b/src/VisualStudio/Core/Def/Implementation/Library/ClassView/AbstractSyncClassViewCommandHandler.cs index 7b0ed16242555..baa8db7493fb3 100644 --- a/src/VisualStudio/Core/Def/Implementation/Library/ClassView/AbstractSyncClassViewCommandHandler.cs +++ b/src/VisualStudio/Core/Def/Implementation/Library/ClassView/AbstractSyncClassViewCommandHandler.cs @@ -44,7 +44,7 @@ public bool ExecuteCommand(SyncClassViewCommandArgs args, CommandExecutionContex var snapshot = args.SubjectBuffer.CurrentSnapshot; - using (var waitScope = context.WaitContext.AddScope(allowCancellation: true, string.Format(ServicesVSResources.Synchronizing_with_0, ClassView))) + using (var waitScope = context.OperationContext.AddScope(allowCancellation: true, string.Format(ServicesVSResources.Synchronizing_with_0, ClassView))) { var document = snapshot.GetOpenDocumentInCurrentContextWithChanges(); if (document == null) @@ -64,7 +64,7 @@ public bool ExecuteCommand(SyncClassViewCommandArgs args, CommandExecutionContex return true; } - var userCancellationToken = context.WaitContext.UserCancellationToken; + var userCancellationToken = context.OperationContext.UserCancellationToken; var semanticModel = document .GetSemanticModelAsync(userCancellationToken) .WaitAndGetResult(userCancellationToken); From 85e94fcd893624fd216afdbc27d84dbfe93d3a84 Mon Sep 17 00:00:00 2001 From: Oleg Tkachenko Date: Wed, 24 Jan 2018 09:58:30 -0800 Subject: [PATCH 02/43] convert 2 more handlers to simple ICommandHandler, no global service provider --- .../RenameCommandHandler_RenameHandler.cs | 16 +++++++++------- .../RenameCommandHandler_ReturnHandler.cs | 15 +++++++-------- .../Implementation/Venus/VenusCommandFilter.cs | 17 +++++------------ 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_RenameHandler.cs b/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_RenameHandler.cs index 7a10692c1cf90..3929e5bee9ac4 100644 --- a/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_RenameHandler.cs +++ b/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_RenameHandler.cs @@ -14,43 +14,45 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename { - internal partial class RenameCommandHandler : IChainedCommandHandler + internal partial class RenameCommandHandler : VSCommanding.ICommandHandler { - public VSCommanding.CommandState GetCommandState(RenameCommandArgs args, Func nextHandler) + public VSCommanding.CommandState GetCommandState(RenameCommandArgs args) { var caretPoint = args.TextView.GetCaretPoint(args.SubjectBuffer); if (!caretPoint.HasValue) { - return nextHandler(); + return VSCommanding.CommandState.Unspecified; } var textContainer = args.SubjectBuffer.AsTextContainer(); if (!Workspace.TryGetWorkspace(textContainer, out var workspace)) { - return nextHandler(); + return VSCommanding.CommandState.Unspecified; } if (!workspace.CanApplyChange(ApplyChangesKind.ChangeDocument)) { - return nextHandler(); + return VSCommanding.CommandState.Unspecified; } var documents = textContainer.GetRelatedDocuments(); var supportsFeatureService = workspace.Services.GetService(); if (!documents.All(d => supportsFeatureService.SupportsRename(d))) { - return nextHandler(); + return VSCommanding.CommandState.Unspecified; } return VSCommanding.CommandState.Available; } - public void ExecuteCommand(RenameCommandArgs args, Action nextHandler, CommandExecutionContext context) + public bool ExecuteCommand(RenameCommandArgs args, CommandExecutionContext context) { using (context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Finding_token_to_rename)) { ExecuteRenameWorker(args, context.OperationContext.UserCancellationToken); } + + return true; } private void ExecuteRenameWorker(RenameCommandArgs args, CancellationToken cancellationToken) diff --git a/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_ReturnHandler.cs b/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_ReturnHandler.cs index 5bf988f69d30b..edcd6163d46c6 100644 --- a/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_ReturnHandler.cs +++ b/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_ReturnHandler.cs @@ -8,24 +8,23 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename { - internal partial class RenameCommandHandler : IChainedCommandHandler + internal partial class RenameCommandHandler : VSCommanding.ICommandHandler { - public VSCommanding.CommandState GetCommandState(ReturnKeyCommandArgs args, Func nextHandler) + public VSCommanding.CommandState GetCommandState(ReturnKeyCommandArgs args) { - return GetCommandState(nextHandler); + return GetCommandState(); } - public void ExecuteCommand(ReturnKeyCommandArgs args, Action nextHandler, CommandExecutionContext context) + public bool ExecuteCommand(ReturnKeyCommandArgs args, CommandExecutionContext context) { if (_renameService.ActiveSession != null) { _renameService.ActiveSession.Commit(); (args.TextView as IWpfTextView).VisualElement.Focus(); + return true; } - else - { - nextHandler(); - } + + return false; } } } diff --git a/src/VisualStudio/Core/Def/Implementation/Venus/VenusCommandFilter.cs b/src/VisualStudio/Core/Def/Implementation/Venus/VenusCommandFilter.cs index 912842c9476a4..7ea5543d562d7 100644 --- a/src/VisualStudio/Core/Def/Implementation/Venus/VenusCommandFilter.cs +++ b/src/VisualStudio/Core/Def/Implementation/Venus/VenusCommandFilter.cs @@ -36,18 +36,11 @@ public VenusCommandFilter( _subjectBuffer = subjectBuffer; CurrentHandlers = commandHandlerServiceFactory.GetService(subjectBuffer); - // Setup all command handlers migrated to the modern editor commandig to be execited next - var componentModel = Shell.ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel)) as IComponentModel; - var vsCommandHandlerServiceAdapterFactory = componentModel?.GetService(); - if (vsCommandHandlerServiceAdapterFactory != null) - { - var vsCommandHandlerServiceAdapter = vsCommandHandlerServiceAdapterFactory.Create(wpfTextView, _subjectBuffer, nextCommandTarget); - NextCommandTarget = vsCommandHandlerServiceAdapter; - } - else - { - NextCommandTarget = nextCommandTarget; - } + // Chain in editor command handler service. It will execute all our command handlers migrated to the modern editor commanding. + var componentModel = (IComponentModel)languageService.SystemServiceProvider.GetService(typeof(SComponentModel)); + var vsCommandHandlerServiceAdapterFactory = componentModel.GetService(); + var vsCommandHandlerServiceAdapter = vsCommandHandlerServiceAdapterFactory.Create(wpfTextView, _subjectBuffer, nextCommandTarget); + NextCommandTarget = vsCommandHandlerServiceAdapter; } protected override ITextBuffer GetSubjectBufferContainingCaret() From 0add0892b3f44a81087ab526c98e6519878f78a0 Mon Sep 17 00:00:00 2001 From: Oleg Tkachenko Date: Wed, 24 Jan 2018 10:35:47 -0800 Subject: [PATCH 03/43] simplify command handler display names --- .../CSharp/CSharpEditorResources.Designer.cs | 9 - .../CSharp/CSharpEditorResources.resx | 3 - .../SplitStringLiteralCommandHandler.cs | 2 +- .../CSharp/xlf/CSharpEditorResources.cs.xlf | 5 - .../CSharp/xlf/CSharpEditorResources.de.xlf | 5 - .../CSharp/xlf/CSharpEditorResources.es.xlf | 5 - .../CSharp/xlf/CSharpEditorResources.fr.xlf | 5 - .../CSharp/xlf/CSharpEditorResources.it.xlf | 5 - .../CSharp/xlf/CSharpEditorResources.ja.xlf | 5 - .../CSharp/xlf/CSharpEditorResources.ko.xlf | 5 - .../CSharp/xlf/CSharpEditorResources.pl.xlf | 5 - .../xlf/CSharpEditorResources.pt-BR.xlf | 5 - .../CSharp/xlf/CSharpEditorResources.ru.xlf | 5 - .../CSharp/xlf/CSharpEditorResources.tr.xlf | 5 - .../xlf/CSharpEditorResources.zh-Hans.xlf | 5 - .../xlf/CSharpEditorResources.zh-Hant.xlf | 5 - .../CommandHandlers/RenameCommandHandler.cs | 2 +- .../InteractivePasteCommandHandler.cs | 2 +- .../Structure/OutliningCommandHandler.cs | 2 +- .../AbstractCompletionCommandHandler.cs | 2 +- .../AbstractIntelliSenseCommandHandler.cs | 2 +- .../ExecuteInInteractiveCommandHandler.cs | 2 +- .../GoToAdjacentMemberCommandHandler.cs | 2 +- .../SignatureHelpCommandHandler.cs | 2 +- .../Core/EditorFeaturesResources.Designer.cs | 228 ++++-------------- .../Core/EditorFeaturesResources.resx | 94 ++------ .../FindReferencesCommandHandler.cs | 2 +- .../GoToDefinitionCommandHandler.cs | 2 +- .../GoToImplementationCommandHandler.cs | 2 +- ...bstractAutomaticLineEnderCommandHandler.cs | 2 +- ...stractBlockCommentEditingCommandHandler.cs | 2 +- .../AbstractChangeSignatureCommandHandler.cs | 2 +- ...CommentUncommentSelectionCommandHandler.cs | 2 +- ...tractDocumentationCommentCommandHandler.cs | 2 +- .../AbstractXmlTagCompletionCommandHandler.cs | 2 +- .../AbstractEncapsulateFieldCommandHandler.cs | 2 +- .../AbstractExtractInterfaceCommandHandler.cs | 2 +- .../AbstractExtractMethodCommandHandler.cs | 2 +- .../Formatting/FormatCommandHandler.cs | 2 +- ...stractSmartTokenFormatterCommandHandler.cs | 2 +- .../IntelliSense/Completion/Controller.cs | 2 +- .../IntelliSense/SignatureHelp/Controller.cs | 2 +- .../OrganizeDocumentCommandHandler.cs | 2 +- ...enameTrackingCancellationCommandHandler.cs | 2 +- ...ivateToHighlightReferenceCommandHandler.cs | 2 +- .../Core/xlf/EditorFeaturesResources.cs.xlf | 148 +++--------- .../Core/xlf/EditorFeaturesResources.de.xlf | 148 +++--------- .../Core/xlf/EditorFeaturesResources.es.xlf | 148 +++--------- .../Core/xlf/EditorFeaturesResources.fr.xlf | 148 +++--------- .../Core/xlf/EditorFeaturesResources.it.xlf | 148 +++--------- .../Core/xlf/EditorFeaturesResources.ja.xlf | 148 +++--------- .../Core/xlf/EditorFeaturesResources.ko.xlf | 148 +++--------- .../Core/xlf/EditorFeaturesResources.pl.xlf | 148 +++--------- .../xlf/EditorFeaturesResources.pt-BR.xlf | 148 +++--------- .../Core/xlf/EditorFeaturesResources.ru.xlf | 148 +++--------- .../Core/xlf/EditorFeaturesResources.tr.xlf | 148 +++--------- .../xlf/EditorFeaturesResources.zh-Hans.xlf | 148 +++--------- .../xlf/EditorFeaturesResources.zh-Hant.xlf | 148 +++--------- .../EndConstructCommandHandler.vb | 2 +- .../LineCommit/CommitCommandHandler.vb | 2 +- ...tAbstractClassOrInterfaceCommandHandler.vb | 2 +- .../VisualBasic/VBEditorResources.Designer.vb | 44 +--- .../VisualBasic/VBEditorResources.resx | 10 +- .../VisualBasic/xlf/VBEditorResources.cs.xlf | 16 +- .../VisualBasic/xlf/VBEditorResources.de.xlf | 16 +- .../VisualBasic/xlf/VBEditorResources.es.xlf | 16 +- .../VisualBasic/xlf/VBEditorResources.fr.xlf | 16 +- .../VisualBasic/xlf/VBEditorResources.it.xlf | 16 +- .../VisualBasic/xlf/VBEditorResources.ja.xlf | 16 +- .../VisualBasic/xlf/VBEditorResources.ko.xlf | 16 +- .../VisualBasic/xlf/VBEditorResources.pl.xlf | 16 +- .../xlf/VBEditorResources.pt-BR.xlf | 16 +- .../VisualBasic/xlf/VBEditorResources.ru.xlf | 16 +- .../VisualBasic/xlf/VBEditorResources.tr.xlf | 16 +- .../xlf/VBEditorResources.zh-Hans.xlf | 16 +- .../xlf/VBEditorResources.zh-Hant.xlf | 16 +- .../Interactive/InteractiveCommandHandler.cs | 2 +- .../CSharp/Impl/CSharpVSResources.Designer.cs | 18 +- .../CSharp/Impl/CSharpVSResources.resx | 4 +- ...ommandHandler_SessionCancellingCommands.cs | 2 +- .../CSharp/Impl/xlf/CSharpVSResources.cs.xlf | 6 +- .../CSharp/Impl/xlf/CSharpVSResources.de.xlf | 6 +- .../CSharp/Impl/xlf/CSharpVSResources.es.xlf | 6 +- .../CSharp/Impl/xlf/CSharpVSResources.fr.xlf | 6 +- .../CSharp/Impl/xlf/CSharpVSResources.it.xlf | 6 +- .../CSharp/Impl/xlf/CSharpVSResources.ja.xlf | 6 +- .../CSharp/Impl/xlf/CSharpVSResources.ko.xlf | 6 +- .../CSharp/Impl/xlf/CSharpVSResources.pl.xlf | 6 +- .../Impl/xlf/CSharpVSResources.pt-BR.xlf | 6 +- .../CSharp/Impl/xlf/CSharpVSResources.ru.xlf | 6 +- .../CSharp/Impl/xlf/CSharpVSResources.tr.xlf | 6 +- .../Impl/xlf/CSharpVSResources.zh-Hans.xlf | 6 +- .../Impl/xlf/CSharpVSResources.zh-Hant.xlf | 6 +- .../CallHierarchyCommandHandler.cs | 2 +- .../AbstractSyncClassViewCommandHandler.cs | 2 +- .../Snippets/AbstractSnippetCommandHandler.cs | 2 +- .../Core/Def/ServicesVSResources.Designer.cs | 15 +- .../Core/Def/ServicesVSResources.resx | 7 +- .../Core/Def/xlf/ServicesVSResources.cs.xlf | 11 +- .../Core/Def/xlf/ServicesVSResources.de.xlf | 11 +- .../Core/Def/xlf/ServicesVSResources.es.xlf | 11 +- .../Core/Def/xlf/ServicesVSResources.fr.xlf | 11 +- .../Core/Def/xlf/ServicesVSResources.it.xlf | 11 +- .../Core/Def/xlf/ServicesVSResources.ja.xlf | 11 +- .../Core/Def/xlf/ServicesVSResources.ko.xlf | 11 +- .../Core/Def/xlf/ServicesVSResources.pl.xlf | 11 +- .../Def/xlf/ServicesVSResources.pt-BR.xlf | 11 +- .../Core/Def/xlf/ServicesVSResources.ru.xlf | 11 +- .../Core/Def/xlf/ServicesVSResources.tr.xlf | 11 +- .../Def/xlf/ServicesVSResources.zh-Hans.xlf | 11 +- .../Def/xlf/ServicesVSResources.zh-Hant.xlf | 11 +- 111 files changed, 768 insertions(+), 2154 deletions(-) diff --git a/src/EditorFeatures/CSharp/CSharpEditorResources.Designer.cs b/src/EditorFeatures/CSharp/CSharpEditorResources.Designer.cs index 06f9f19bb4a4c..28d709117a03e 100644 --- a/src/EditorFeatures/CSharp/CSharpEditorResources.Designer.cs +++ b/src/EditorFeatures/CSharp/CSharpEditorResources.Designer.cs @@ -86,14 +86,5 @@ internal static string Split_string { return ResourceManager.GetString("Split_string", resourceCulture); } } - - /// - /// Looks up a localized string similar to Split String Literal Command Handler. - /// - internal static string Split_String_Literal_Command_Handler { - get { - return ResourceManager.GetString("Split_String_Literal_Command_Handler", resourceCulture); - } - } } } diff --git a/src/EditorFeatures/CSharp/CSharpEditorResources.resx b/src/EditorFeatures/CSharp/CSharpEditorResources.resx index 96c6dba785684..d27291f3f75f3 100644 --- a/src/EditorFeatures/CSharp/CSharpEditorResources.resx +++ b/src/EditorFeatures/CSharp/CSharpEditorResources.resx @@ -126,7 +126,4 @@ Split string - - Split String Literal Command Handler - \ No newline at end of file diff --git a/src/EditorFeatures/CSharp/SplitStringLiteral/SplitStringLiteralCommandHandler.cs b/src/EditorFeatures/CSharp/SplitStringLiteral/SplitStringLiteralCommandHandler.cs index 4d4f3ea22247c..c31092dba7431 100644 --- a/src/EditorFeatures/CSharp/SplitStringLiteral/SplitStringLiteralCommandHandler.cs +++ b/src/EditorFeatures/CSharp/SplitStringLiteral/SplitStringLiteralCommandHandler.cs @@ -33,7 +33,7 @@ public SplitStringLiteralCommandHandler( _editorOperationsFactoryService = editorOperationsFactoryService; } - public string DisplayName => CSharpEditorResources.Split_String_Literal_Command_Handler; + public string DisplayName => CSharpEditorResources.Split_string; public VSCommanding.CommandState GetCommandState(ReturnKeyCommandArgs args) { diff --git a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.cs.xlf b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.cs.xlf index 20407a993cc55..a17aebf9f66c4 100644 --- a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.cs.xlf +++ b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.cs.xlf @@ -17,11 +17,6 @@ Rozdělit řetězec - - Split String Literal Command Handler - Split String Literal Command Handler - - \ No newline at end of file diff --git a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.de.xlf b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.de.xlf index 6a950cc86c603..50d22d4cbf64f 100644 --- a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.de.xlf +++ b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.de.xlf @@ -17,11 +17,6 @@ Zeichenfolge teilen - - Split String Literal Command Handler - Split String Literal Command Handler - - \ No newline at end of file diff --git a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.es.xlf b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.es.xlf index edee454f1a139..c3a1bcdb8c245 100644 --- a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.es.xlf +++ b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.es.xlf @@ -17,11 +17,6 @@ Dividir cadena - - Split String Literal Command Handler - Split String Literal Command Handler - - \ No newline at end of file diff --git a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.fr.xlf b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.fr.xlf index 6afc5a377ddf5..371e6847a1650 100644 --- a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.fr.xlf +++ b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.fr.xlf @@ -17,11 +17,6 @@ Fractionner la chaîne - - Split String Literal Command Handler - Split String Literal Command Handler - - \ No newline at end of file diff --git a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.it.xlf b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.it.xlf index 53515c1d66425..3f705fc00cd62 100644 --- a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.it.xlf +++ b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.it.xlf @@ -17,11 +17,6 @@ Dividi stringa - - Split String Literal Command Handler - Split String Literal Command Handler - - \ No newline at end of file diff --git a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.ja.xlf b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.ja.xlf index 33c666329c133..79836dd659f25 100644 --- a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.ja.xlf +++ b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.ja.xlf @@ -17,11 +17,6 @@ 文字列を分割します - - Split String Literal Command Handler - Split String Literal Command Handler - - \ No newline at end of file diff --git a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.ko.xlf b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.ko.xlf index 56b3f5ccb18bd..4f37904a65657 100644 --- a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.ko.xlf +++ b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.ko.xlf @@ -17,11 +17,6 @@ 문자열 분할 - - Split String Literal Command Handler - Split String Literal Command Handler - - \ No newline at end of file diff --git a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.pl.xlf b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.pl.xlf index b88d4b51ab28d..8357da8a9bcb6 100644 --- a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.pl.xlf +++ b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.pl.xlf @@ -17,11 +17,6 @@ Rozdziel ciąg - - Split String Literal Command Handler - Split String Literal Command Handler - - \ No newline at end of file diff --git a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.pt-BR.xlf b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.pt-BR.xlf index 69bc3e8d9a884..62ccf9cbe2aa7 100644 --- a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.pt-BR.xlf +++ b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.pt-BR.xlf @@ -17,11 +17,6 @@ Dividir cadeia de caracteres - - Split String Literal Command Handler - Split String Literal Command Handler - - \ No newline at end of file diff --git a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.ru.xlf b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.ru.xlf index 7058da36a9412..c863054ae8617 100644 --- a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.ru.xlf +++ b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.ru.xlf @@ -17,11 +17,6 @@ Разделить строку - - Split String Literal Command Handler - Split String Literal Command Handler - - \ No newline at end of file diff --git a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.tr.xlf b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.tr.xlf index 668cbf79a6804..68e2ef9108775 100644 --- a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.tr.xlf +++ b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.tr.xlf @@ -17,11 +17,6 @@ Dizeyi böl - - Split String Literal Command Handler - Split String Literal Command Handler - - \ No newline at end of file diff --git a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.zh-Hans.xlf b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.zh-Hans.xlf index 9bdc1210da696..eebbc0d6aa141 100644 --- a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.zh-Hans.xlf +++ b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.zh-Hans.xlf @@ -17,11 +17,6 @@ 拆分字符串 - - Split String Literal Command Handler - Split String Literal Command Handler - - \ No newline at end of file diff --git a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.zh-Hant.xlf b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.zh-Hant.xlf index 8b16895ffc7c7..dca16e32a211a 100644 --- a/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.zh-Hant.xlf +++ b/src/EditorFeatures/CSharp/xlf/CSharpEditorResources.zh-Hant.xlf @@ -17,11 +17,6 @@ 分割字串 - - Split String Literal Command Handler - Split String Literal Command Handler - - \ No newline at end of file diff --git a/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler.cs b/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler.cs index ce177090d4324..ccb32fd4a88c6 100644 --- a/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler.cs +++ b/src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler.cs @@ -37,7 +37,7 @@ public RenameCommandHandler( _editorOperationsFactoryService = editorOperationsFactoryService; } - public string DisplayName => EditorFeaturesResources.Rename_Command_Handler; + public string DisplayName => EditorFeaturesResources.Rename; private VSCommanding.CommandState GetCommandState(Func nextHandler) { diff --git a/src/EditorFeatures/Core.Wpf/Interactive/InteractivePasteCommandHandler.cs b/src/EditorFeatures/Core.Wpf/Interactive/InteractivePasteCommandHandler.cs index b7faece4c9c16..187efef6c32e9 100644 --- a/src/EditorFeatures/Core.Wpf/Interactive/InteractivePasteCommandHandler.cs +++ b/src/EditorFeatures/Core.Wpf/Interactive/InteractivePasteCommandHandler.cs @@ -49,7 +49,7 @@ internal sealed class InteractivePasteCommandHandler : VSCommanding.ICommandHand // This is for unit test purpose only, do not explicitly set this field otherwise. internal IRoslynClipboard RoslynClipboard; - public string DisplayName => EditorFeaturesResources.Interactive_Paste_Command_Handler; + public string DisplayName => EditorFeaturesResources.Paste_in_Interactive; [ImportingConstructor] public InteractivePasteCommandHandler(IEditorOperationsFactoryService editorOperationsFactoryService, ITextUndoHistoryRegistry textUndoHistoryRegistry) diff --git a/src/EditorFeatures/Core.Wpf/Structure/OutliningCommandHandler.cs b/src/EditorFeatures/Core.Wpf/Structure/OutliningCommandHandler.cs index d44106a016f46..234132f2479c3 100644 --- a/src/EditorFeatures/Core.Wpf/Structure/OutliningCommandHandler.cs +++ b/src/EditorFeatures/Core.Wpf/Structure/OutliningCommandHandler.cs @@ -22,7 +22,7 @@ public OutliningCommandHandler(IOutliningManagerService outliningManagerService) _outliningManagerService = outliningManagerService; } - public string DisplayName => EditorFeaturesResources.Outlining_Command_Handler; + public string DisplayName => EditorFeaturesResources.Outlining; public bool ExecuteCommand(StartAutomaticOutliningCommandArgs args, CommandExecutionContext context) { diff --git a/src/EditorFeatures/Core/CommandHandlers/AbstractCompletionCommandHandler.cs b/src/EditorFeatures/Core/CommandHandlers/AbstractCompletionCommandHandler.cs index b053995364203..43d7355f01ad5 100644 --- a/src/EditorFeatures/Core/CommandHandlers/AbstractCompletionCommandHandler.cs +++ b/src/EditorFeatures/Core/CommandHandlers/AbstractCompletionCommandHandler.cs @@ -32,7 +32,7 @@ internal abstract class AbstractCompletionCommandHandler : { private readonly IAsyncCompletionService _completionService; - public string DisplayName => EditorFeaturesResources.Completion_Command_Handler; + public string DisplayName => EditorFeaturesResources.Code_Completion; protected AbstractCompletionCommandHandler(IAsyncCompletionService completionService) { diff --git a/src/EditorFeatures/Core/CommandHandlers/AbstractIntelliSenseCommandHandler.cs b/src/EditorFeatures/Core/CommandHandlers/AbstractIntelliSenseCommandHandler.cs index a1cbd00a05a8a..bb3ddea75faae 100644 --- a/src/EditorFeatures/Core/CommandHandlers/AbstractIntelliSenseCommandHandler.cs +++ b/src/EditorFeatures/Core/CommandHandlers/AbstractIntelliSenseCommandHandler.cs @@ -32,7 +32,7 @@ internal abstract class AbstractIntelliSenseCommandHandler : private readonly SignatureHelpCommandHandler _signatureHelpCommandHandler; private readonly QuickInfoCommandHandlerAndSourceProvider _quickInfoCommandHandler; - public string DisplayName => EditorFeaturesResources.IntelliSense_Command_Handler; + public string DisplayName => EditorFeaturesResources.IntelliSense; protected AbstractIntelliSenseCommandHandler( CompletionCommandHandler completionCommandHandler, diff --git a/src/EditorFeatures/Core/CommandHandlers/ExecuteInInteractiveCommandHandler.cs b/src/EditorFeatures/Core/CommandHandlers/ExecuteInInteractiveCommandHandler.cs index 6781a81a121a3..433b2124f1e7e 100644 --- a/src/EditorFeatures/Core/CommandHandlers/ExecuteInInteractiveCommandHandler.cs +++ b/src/EditorFeatures/Core/CommandHandlers/ExecuteInInteractiveCommandHandler.cs @@ -26,7 +26,7 @@ internal class ExecuteInInteractiveCommandHandler { private readonly IEnumerable> _executeInInteractiveHandlers; - public string DisplayName => EditorFeaturesResources.Execute_In_Interactive_Command_Handler; + public string DisplayName => EditorFeaturesResources.Execute_In_Interactive; [ImportingConstructor] public ExecuteInInteractiveCommandHandler( diff --git a/src/EditorFeatures/Core/CommandHandlers/GoToAdjacentMemberCommandHandler.cs b/src/EditorFeatures/Core/CommandHandlers/GoToAdjacentMemberCommandHandler.cs index ad2be6663f953..ca30b1693c823 100644 --- a/src/EditorFeatures/Core/CommandHandlers/GoToAdjacentMemberCommandHandler.cs +++ b/src/EditorFeatures/Core/CommandHandlers/GoToAdjacentMemberCommandHandler.cs @@ -30,7 +30,7 @@ internal class GoToAdjacentMemberCommandHandler : { private readonly IOutliningManagerService _outliningManagerService; - public string DisplayName => EditorFeaturesResources.Go_To_Adjacent_Member_Command_Handler; + public string DisplayName => EditorFeaturesResources.Go_To_Adjacent_Member; [ImportingConstructor] public GoToAdjacentMemberCommandHandler(IOutliningManagerService outliningManagerService) diff --git a/src/EditorFeatures/Core/CommandHandlers/SignatureHelpCommandHandler.cs b/src/EditorFeatures/Core/CommandHandlers/SignatureHelpCommandHandler.cs index fe7ffef5d1e6e..6c0482e7f245e 100644 --- a/src/EditorFeatures/Core/CommandHandlers/SignatureHelpCommandHandler.cs +++ b/src/EditorFeatures/Core/CommandHandlers/SignatureHelpCommandHandler.cs @@ -35,7 +35,7 @@ internal class SignatureHelpCommandHandler : private readonly IAsynchronousOperationListener _listener; private readonly IList> _signatureHelpProviders; - public string DisplayName => EditorFeaturesResources.Signature_Help_Command_Handler; + public string DisplayName => EditorFeaturesResources.Signature_Help; [ImportingConstructor] public SignatureHelpCommandHandler( diff --git a/src/EditorFeatures/Core/EditorFeaturesResources.Designer.cs b/src/EditorFeatures/Core/EditorFeaturesResources.Designer.cs index 1fd6c841bd652..3811b0f984da2 100644 --- a/src/EditorFeatures/Core/EditorFeaturesResources.Designer.cs +++ b/src/EditorFeatures/Core/EditorFeaturesResources.Designer.cs @@ -269,15 +269,6 @@ internal static string Automatic_Line_Ender { } } - /// - /// Looks up a localized string similar to Automatic Line Ender Command Handler. - /// - internal static string Automatic_Line_Ender_Command_Handler { - get { - return ResourceManager.GetString("Automatic_Line_Ender_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Automatic Pair Completion. /// @@ -306,11 +297,11 @@ internal static string Automatically_completing { } /// - /// Looks up a localized string similar to Block Comment Editing Command Handler. + /// Looks up a localized string similar to Block Comment Editing. /// - internal static string Block_Comment_Editing_Command_Handler { + internal static string Block_Comment_Editing { get { - return ResourceManager.GetString("Block_Comment_Editing_Command_Handler", resourceCulture); + return ResourceManager.GetString("Block_Comment_Editing", resourceCulture); } } @@ -449,15 +440,6 @@ internal static string Change_Signature_colon { } } - /// - /// Looks up a localized string similar to Change Signature Command Handler. - /// - internal static string Change_Signature_Command_Handler { - get { - return ResourceManager.GetString("Change_Signature_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Changes. /// @@ -494,6 +476,15 @@ internal static string Class_Parts { } } + /// + /// Looks up a localized string similar to Code Completion. + /// + internal static string Code_Completion { + get { + return ResourceManager.GetString("Code_Completion", resourceCulture); + } + } + /// /// Looks up a localized string similar to Comment Selection. /// @@ -504,11 +495,11 @@ internal static string Comment_Selection { } /// - /// Looks up a localized string similar to Comment/Uncomment Selection Command Handler. + /// Looks up a localized string similar to Comment/Uncomment Selection. /// - internal static string Comment_Uncomment_Selection_Command_Handler { + internal static string Comment_Uncomment_Selection { get { - return ResourceManager.GetString("Comment_Uncomment_Selection_Command_Handler", resourceCulture); + return ResourceManager.GetString("Comment_Uncomment_Selection", resourceCulture); } } @@ -530,15 +521,6 @@ internal static string Completing_Tag { } } - /// - /// Looks up a localized string similar to Code Completion Command Handler. - /// - internal static string Completion_Command_Handler { - get { - return ResourceManager.GetString("Completion_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Computing Call Hierarchy Information. /// @@ -629,15 +611,6 @@ internal static string Documentation_Comment { } } - /// - /// Looks up a localized string similar to Documentation Comment Command Handler. - /// - internal static string Documentation_Comment_Command_Handler { - get { - return ResourceManager.GetString("Documentation_Comment_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Encapsulate Field. /// @@ -656,15 +629,6 @@ internal static string Encapsulate_Field_colon { } } - /// - /// Looks up a localized string similar to Encapsulate Field Command Handler. - /// - internal static string Encapsulate_Field_Command_Handler { - get { - return ResourceManager.GetString("Encapsulate_Field_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Engine must be attached to an Interactive Window.. /// @@ -675,20 +639,20 @@ internal static string Engine_must_be_attached_to_an_Interactive_Window { } /// - /// Looks up a localized string similar to Execute In Interactive Command Handler. + /// Looks up a localized string similar to Execute In Interactive. /// - internal static string Execute_In_Interactive_Command_Handler { + internal static string Execute_In_Interactive { get { - return ResourceManager.GetString("Execute_In_Interactive_Command_Handler", resourceCulture); + return ResourceManager.GetString("Execute_In_Interactive", resourceCulture); } } /// - /// Looks up a localized string similar to Extract Interface Command Handler. + /// Looks up a localized string similar to Extract Interface. /// - internal static string Extract_Interface_Command_Handler { + internal static string Extract_Interface { get { - return ResourceManager.GetString("Extract_Interface_Command_Handler", resourceCulture); + return ResourceManager.GetString("Extract_Interface", resourceCulture); } } @@ -701,15 +665,6 @@ internal static string Extract_Method { } } - /// - /// Looks up a localized string similar to Extract Method Command Handler. - /// - internal static string Extract_Method_Command_Handler { - get { - return ResourceManager.GetString("Extract_Method_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Extract method failed with following reasons :. /// @@ -728,15 +683,6 @@ internal static string Find_References { } } - /// - /// Looks up a localized string similar to Find References Command Handler. - /// - internal static string Find_References_Command_Handler { - get { - return ResourceManager.GetString("Find_References_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Finding enclosing span.... /// @@ -809,15 +755,6 @@ internal static string Fix_all_occurrences_in { } } - /// - /// Looks up a localized string similar to Format Command Handler. - /// - internal static string Format_Command_Handler { - get { - return ResourceManager.GetString("Format_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Format Document. /// @@ -909,11 +846,11 @@ internal static string Given_Workspace_doesn_t_support_Undo { } /// - /// Looks up a localized string similar to Go To Adjacent Member Command Handler. + /// Looks up a localized string similar to Go To Adjacent Member. /// - internal static string Go_To_Adjacent_Member_Command_Handler { + internal static string Go_To_Adjacent_Member { get { - return ResourceManager.GetString("Go_To_Adjacent_Member_Command_Handler", resourceCulture); + return ResourceManager.GetString("Go_To_Adjacent_Member", resourceCulture); } } @@ -926,15 +863,6 @@ internal static string Go_to_Definition { } } - /// - /// Looks up a localized string similar to Go To Definition Command Handler. - /// - internal static string Go_To_Definition_Command_Handler { - get { - return ResourceManager.GetString("Go_To_Definition_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Go To Implementation. /// @@ -944,15 +872,6 @@ internal static string Go_To_Implementation { } } - /// - /// Looks up a localized string similar to Go To Implementation Command Handler. - /// - internal static string Go_To_Implementation_Command_Handler { - get { - return ResourceManager.GetString("Go_To_Implementation_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Highlighted Definition. /// @@ -1142,15 +1061,6 @@ internal static string IntelliSense { } } - /// - /// Looks up a localized string similar to IntelliSense Command Handler. - /// - internal static string IntelliSense_Command_Handler { - get { - return ResourceManager.GetString("IntelliSense_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to IntelliSense Commit Formatting. /// @@ -1161,20 +1071,11 @@ internal static string IntelliSense_Commit_Formatting { } /// - /// Looks up a localized string similar to Interactive Command Handler. + /// Looks up a localized string similar to Interactive. /// - internal static string Interactive_Command_Handler { + internal static string Interactive { get { - return ResourceManager.GetString("Interactive_Command_Handler", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Interactive Paste Command Handler. - /// - internal static string Interactive_Paste_Command_Handler { - get { - return ResourceManager.GetString("Interactive_Paste_Command_Handler", resourceCulture); + return ResourceManager.GetString("Interactive", resourceCulture); } } @@ -1224,11 +1125,11 @@ internal static string Modify_any_highlighted_location_to_begin_renaming { } /// - /// Looks up a localized string similar to Navigate To Highlighted Reference Command Handler. + /// Looks up a localized string similar to Navigate To Highlighted Reference. /// - internal static string Navigate_To_Highlight_Reference_Command_Handler { + internal static string Navigate_To_Highlight_Reference { get { - return ResourceManager.GetString("Navigate_To_Highlight_Reference_Command_Handler", resourceCulture); + return ResourceManager.GetString("Navigate_To_Highlight_Reference", resourceCulture); } } @@ -1331,15 +1232,6 @@ internal static string Organize_Document { } } - /// - /// Looks up a localized string similar to Organize Document Command Handler. - /// - internal static string Organize_Document_Command_Handler { - get { - return ResourceManager.GetString("Organize_Document_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Organizing document.... /// @@ -1350,11 +1242,11 @@ internal static string Organizing_document { } /// - /// Looks up a localized string similar to Outlining Command Handler. + /// Looks up a localized string similar to Outlining. /// - internal static string Outlining_Command_Handler { + internal static string Outlining { get { - return ResourceManager.GetString("Outlining_Command_Handler", resourceCulture); + return ResourceManager.GetString("Outlining", resourceCulture); } } @@ -1385,6 +1277,15 @@ internal static string Paste { } } + /// + /// Looks up a localized string similar to Paste in Interactive. + /// + internal static string Paste_in_Interactive { + get { + return ResourceManager.GetString("Paste_in_Interactive", resourceCulture); + } + } + /// /// Looks up a localized string similar to Peek. /// @@ -1583,15 +1484,6 @@ internal static string Rename_colon_0 { } } - /// - /// Looks up a localized string similar to Rename Command Handler. - /// - internal static string Rename_Command_Handler { - get { - return ResourceManager.GetString("Rename_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Rename operation was cancelled or is not valid. /// @@ -1630,11 +1522,11 @@ internal static string Rename_Tracking { } /// - /// Looks up a localized string similar to Rename Tracking Cancellation Command Handler. + /// Looks up a localized string similar to Rename Tracking Cancellation. /// - internal static string Rename_Tracking_Cancellation_Command_Handler { + internal static string Rename_Tracking_Cancellation { get { - return ResourceManager.GetString("Rename_Tracking_Cancellation_Command_Handler", resourceCulture); + return ResourceManager.GetString("Rename_Tracking_Cancellation", resourceCulture); } } @@ -1693,11 +1585,11 @@ internal static string Searching { } /// - /// Looks up a localized string similar to Signature Help Command Handler. + /// Looks up a localized string similar to Signature Help. /// - internal static string Signature_Help_Command_Handler { + internal static string Signature_Help { get { - return ResourceManager.GetString("Signature_Help_Command_Handler", resourceCulture); + return ResourceManager.GetString("Signature_Help", resourceCulture); } } @@ -1711,11 +1603,11 @@ internal static string Smart_Indenting { } /// - /// Looks up a localized string similar to Smart Token Formatter Command Handler. + /// Looks up a localized string similar to Smart Token Formatter. /// - internal static string Smart_Token_Formatter_Command_Handler { + internal static string Smart_Token_Formatter { get { - return ResourceManager.GetString("Smart_Token_Formatter_Command_Handler", resourceCulture); + return ResourceManager.GetString("Smart_Token_Formatter", resourceCulture); } } @@ -2079,15 +1971,6 @@ internal static string VB_XML_Literals_Text { } } - /// - /// Looks up a localized string similar to View Call Hierarchy Command Handler. - /// - internal static string View_Call_Hierarchy_Command_Handler { - get { - return ResourceManager.GetString("View_Call_Hierarchy_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to We can fix the error by not making struct "out/ref" parameter(s). ///Do you want to proceed?. @@ -2198,15 +2081,6 @@ internal static string XML_End_Tag_Completion { } } - /// - /// Looks up a localized string similar to XML Tag Completion Command Handler. - /// - internal static string Xml_Tag_Completion_Command_Handler { - get { - return ResourceManager.GetString("Xml_Tag_Completion_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to You cannot rename elements from previous submissions.. /// diff --git a/src/EditorFeatures/Core/EditorFeaturesResources.resx b/src/EditorFeatures/Core/EditorFeaturesResources.resx index 31d044260aba3..8a4acd9b1c8b5 100644 --- a/src/EditorFeatures/Core/EditorFeaturesResources.resx +++ b/src/EditorFeatures/Core/EditorFeaturesResources.resx @@ -767,85 +767,43 @@ Do you want to proceed? Inline Rename Field Text - - View Call Hierarchy Command Handler + + Block Comment Editing - - Automatic Line Ender Command Handler + + Comment/Uncomment Selection - - Block Comment Editing Command Handler + + Code Completion - - Change Signature Command Handler + + Execute In Interactive - - Comment/Uncomment Selection Command Handler + + Extract Interface - - Code Completion Command Handler + + Go To Adjacent Member - - Documentation Comment Command Handler + + Interactive - - Encapsulate Field Command Handler + + Paste in Interactive - - Execute In Interactive Command Handler + + Navigate To Highlighted Reference - - Extract Interface Command Handler + + Outlining - - Extract Method Command Handler + + Rename Tracking Cancellation - - Find References Command Handler + + Signature Help - - Format Command Handler - - - Go To Adjacent Member Command Handler - - - Go To Definition Command Handler - - - Go To Implementation Command Handler - - - IntelliSense Command Handler - - - Interactive Command Handler - - - Interactive Paste Command Handler - - - Navigate To Highlighted Reference Command Handler - - - Organize Document Command Handler - - - Outlining Command Handler - - - Rename Command Handler - - - Rename Tracking Cancellation Command Handler - - - Signature Help Command Handler - - - Smart Token Formatter Command Handler - - - XML Tag Completion Command Handler + + Smart Token Formatter \ No newline at end of file diff --git a/src/EditorFeatures/Core/FindReferences/FindReferencesCommandHandler.cs b/src/EditorFeatures/Core/FindReferences/FindReferencesCommandHandler.cs index 0cf42638b7e15..4ed0c3abd52dc 100644 --- a/src/EditorFeatures/Core/FindReferences/FindReferencesCommandHandler.cs +++ b/src/EditorFeatures/Core/FindReferences/FindReferencesCommandHandler.cs @@ -34,7 +34,7 @@ internal class FindReferencesCommandHandler : VSCommanding.ICommandHandler EditorFeaturesResources.Find_References_Command_Handler; + public string DisplayName => EditorFeaturesResources.Find_References; [ImportingConstructor] internal FindReferencesCommandHandler( diff --git a/src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs b/src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs index 5b2943e31da61..f97b5b35c8dce 100644 --- a/src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs +++ b/src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs @@ -20,7 +20,7 @@ namespace Microsoft.CodeAnalysis.Editor.GoToDefinition internal class GoToDefinitionCommandHandler : VSCommanding.ICommandHandler { - public string DisplayName => EditorFeaturesResources.Go_To_Definition_Command_Handler; + public string DisplayName => EditorFeaturesResources.Go_to_Definition; private (Document, IGoToDefinitionService) GetDocumentAndService(ITextSnapshot snapshot) { diff --git a/src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs b/src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs index 5a89265f478fa..bb42917577447 100644 --- a/src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs +++ b/src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs @@ -34,7 +34,7 @@ public GoToImplementationCommandHandler( _streamingPresenters = streamingPresenters; } - public string DisplayName => EditorFeaturesResources.Go_To_Implementation_Command_Handler; + public string DisplayName => EditorFeaturesResources.Go_To_Implementation; private (Document, IGoToImplementationService, IFindUsagesService) GetDocumentAndServices(ITextSnapshot snapshot) { diff --git a/src/EditorFeatures/Core/Implementation/AutomaticCompletion/AbstractAutomaticLineEnderCommandHandler.cs b/src/EditorFeatures/Core/Implementation/AutomaticCompletion/AbstractAutomaticLineEnderCommandHandler.cs index 0b5a61effc31c..6f5118af8b931 100644 --- a/src/EditorFeatures/Core/Implementation/AutomaticCompletion/AbstractAutomaticLineEnderCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/AutomaticCompletion/AbstractAutomaticLineEnderCommandHandler.cs @@ -21,7 +21,7 @@ internal abstract class AbstractAutomaticLineEnderCommandHandler : private readonly ITextUndoHistoryRegistry _undoRegistry; private readonly IEditorOperationsFactoryService _editorOperationsFactoryService; - public string DisplayName => EditorFeaturesResources.Automatic_Line_Ender_Command_Handler; + public string DisplayName => EditorFeaturesResources.Automatic_Line_Ender; public AbstractAutomaticLineEnderCommandHandler( ITextUndoHistoryRegistry undoRegistry, diff --git a/src/EditorFeatures/Core/Implementation/BlockCommentEditing/AbstractBlockCommentEditingCommandHandler.cs b/src/EditorFeatures/Core/Implementation/BlockCommentEditing/AbstractBlockCommentEditingCommandHandler.cs index 1de31101d1e65..d4c71203e5090 100644 --- a/src/EditorFeatures/Core/Implementation/BlockCommentEditing/AbstractBlockCommentEditingCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/BlockCommentEditing/AbstractBlockCommentEditingCommandHandler.cs @@ -45,7 +45,7 @@ public void ExecuteCommand(ReturnKeyCommandArgs args, Action nextHandler) #region Modern editor ICommandHandler - public string DisplayName => EditorFeaturesResources.Block_Comment_Editing_Command_Handler; + public string DisplayName => EditorFeaturesResources.Block_Comment_Editing; public VSCommanding.CommandState GetCommandState(VSEditorCommands.ReturnKeyCommandArgs args) => VSCommanding.CommandState.Unspecified; diff --git a/src/EditorFeatures/Core/Implementation/ChangeSignature/AbstractChangeSignatureCommandHandler.cs b/src/EditorFeatures/Core/Implementation/ChangeSignature/AbstractChangeSignatureCommandHandler.cs index 07f1655f4c560..ab5f5a83a214a 100644 --- a/src/EditorFeatures/Core/Implementation/ChangeSignature/AbstractChangeSignatureCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/ChangeSignature/AbstractChangeSignatureCommandHandler.cs @@ -19,7 +19,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.ChangeSignature internal abstract class AbstractChangeSignatureCommandHandler : VSCommanding.ICommandHandler, VSCommanding.ICommandHandler { - public string DisplayName => EditorFeaturesResources.Change_Signature_Command_Handler; + public string DisplayName => EditorFeaturesResources.Change_Signature; public VSCommanding.CommandState GetCommandState(ReorderParametersCommandArgs args) => GetCommandState(args.SubjectBuffer); diff --git a/src/EditorFeatures/Core/Implementation/CommentSelection/CommentUncommentSelectionCommandHandler.cs b/src/EditorFeatures/Core/Implementation/CommentSelection/CommentUncommentSelectionCommandHandler.cs index 142018659ad3d..1ae8cd8b4cf04 100644 --- a/src/EditorFeatures/Core/Implementation/CommentSelection/CommentUncommentSelectionCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/CommentSelection/CommentUncommentSelectionCommandHandler.cs @@ -45,7 +45,7 @@ internal CommentUncommentSelectionCommandHandler( _editorOperationsFactoryService = editorOperationsFactoryService; } - public string DisplayName => EditorFeaturesResources.Comment_Uncomment_Selection_Command_Handler; + public string DisplayName => EditorFeaturesResources.Comment_Uncomment_Selection; private static VSCommanding.CommandState GetCommandState(ITextBuffer buffer) { diff --git a/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs b/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs index 70b6c5ffbca3c..2aa2b38df7ec2 100644 --- a/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs @@ -74,7 +74,7 @@ private char TriggerCharacter get { return ExteriorTriviaText[ExteriorTriviaText.Length - 1]; } } - public string DisplayName => EditorFeaturesResources.Documentation_Comment_Command_Handler; + public string DisplayName => EditorFeaturesResources.Documentation_Comment; private string GetNewLine(SourceText text) { diff --git a/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractXmlTagCompletionCommandHandler.cs b/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractXmlTagCompletionCommandHandler.cs index 1283ecfdf9264..065444fe2f2b1 100644 --- a/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractXmlTagCompletionCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractXmlTagCompletionCommandHandler.cs @@ -18,7 +18,7 @@ internal abstract class AbstractXmlTagCompletionCommandHandler : IChainedCommand { private readonly ITextUndoHistoryRegistry _undoHistory; - public string DisplayName => EditorFeaturesResources.Xml_Tag_Completion_Command_Handler; + public string DisplayName => EditorFeaturesResources.XML_End_Tag_Completion; public AbstractXmlTagCompletionCommandHandler(ITextUndoHistoryRegistry undoHistory) { diff --git a/src/EditorFeatures/Core/Implementation/EncapsulateField/AbstractEncapsulateFieldCommandHandler.cs b/src/EditorFeatures/Core/Implementation/EncapsulateField/AbstractEncapsulateFieldCommandHandler.cs index 69a5380f2bad6..afa75a0497475 100644 --- a/src/EditorFeatures/Core/Implementation/EncapsulateField/AbstractEncapsulateFieldCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/EncapsulateField/AbstractEncapsulateFieldCommandHandler.cs @@ -25,7 +25,7 @@ internal abstract class AbstractEncapsulateFieldCommandHandler : VSCommanding.IC private readonly ITextBufferUndoManagerProvider _undoManager; private readonly IAsynchronousOperationListener _listener; - public string DisplayName => EditorFeaturesResources.Encapsulate_Field_Command_Handler; + public string DisplayName => EditorFeaturesResources.Encapsulate_Field; public AbstractEncapsulateFieldCommandHandler( ITextBufferUndoManagerProvider undoManager, diff --git a/src/EditorFeatures/Core/Implementation/ExtractInterface/AbstractExtractInterfaceCommandHandler.cs b/src/EditorFeatures/Core/Implementation/ExtractInterface/AbstractExtractInterfaceCommandHandler.cs index c5700719049ce..e3d9d75357a16 100644 --- a/src/EditorFeatures/Core/Implementation/ExtractInterface/AbstractExtractInterfaceCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/ExtractInterface/AbstractExtractInterfaceCommandHandler.cs @@ -16,7 +16,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.ExtractInterface { internal abstract class AbstractExtractInterfaceCommandHandler : VSCommanding.ICommandHandler { - public string DisplayName => EditorFeaturesResources.Extract_Interface_Command_Handler; + public string DisplayName => EditorFeaturesResources.Extract_Interface; public VSCommanding.CommandState GetCommandState(ExtractInterfaceCommandArgs args) { diff --git a/src/EditorFeatures/Core/Implementation/ExtractMethod/AbstractExtractMethodCommandHandler.cs b/src/EditorFeatures/Core/Implementation/ExtractMethod/AbstractExtractMethodCommandHandler.cs index 5c2f30532e11d..73425a364aaae 100644 --- a/src/EditorFeatures/Core/Implementation/ExtractMethod/AbstractExtractMethodCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/ExtractMethod/AbstractExtractMethodCommandHandler.cs @@ -40,7 +40,7 @@ public AbstractExtractMethodCommandHandler( _editorOperationsFactoryService = editorOperationsFactoryService; _renameService = renameService; } - public string DisplayName => EditorFeaturesResources.Extract_Method_Command_Handler; + public string DisplayName => EditorFeaturesResources.Extract_Method; public VSCommanding.CommandState GetCommandState(ExtractMethodCommandArgs args) { diff --git a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs index 120cc30ce0360..b4810f7719be3 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs @@ -37,7 +37,7 @@ internal partial class FormatCommandHandler : private readonly ITextUndoHistoryRegistry _undoHistoryRegistry; private readonly IEditorOperationsFactoryService _editorOperationsFactoryService; - public string DisplayName => EditorFeaturesResources.Format_Command_Handler; + public string DisplayName => EditorFeaturesResources.Automatic_Formatting; [ImportingConstructor] public FormatCommandHandler( diff --git a/src/EditorFeatures/Core/Implementation/Formatting/Indentation/AbstractSmartTokenFormatterCommandHandler.cs b/src/EditorFeatures/Core/Implementation/Formatting/Indentation/AbstractSmartTokenFormatterCommandHandler.cs index 93df47551e70e..6749b699b2bba 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/Indentation/AbstractSmartTokenFormatterCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/Indentation/AbstractSmartTokenFormatterCommandHandler.cs @@ -28,7 +28,7 @@ internal abstract class AbstractSmartTokenFormatterCommandHandler : private readonly ITextUndoHistoryRegistry _undoHistoryRegistry; private readonly IEditorOperationsFactoryService _editorOperationsFactoryService; - public string DisplayName => EditorFeaturesResources.Smart_Token_Formatter_Command_Handler; + public string DisplayName => EditorFeaturesResources.Smart_Token_Formatter; public AbstractSmartTokenFormatterCommandHandler( ITextUndoHistoryRegistry undoHistoryRegistry, diff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs index 54ea6ff495b96..925c05e193dea 100644 --- a/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs +++ b/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs @@ -237,7 +237,7 @@ private void CommitItem(CompletionItem item) private const int MaxMRUSize = 10; private ImmutableArray _recentItems = ImmutableArray.Empty; - public string DisplayName => EditorFeaturesResources.Completion_Command_Handler; + public string DisplayName => EditorFeaturesResources.Code_Completion; public void MakeMostRecentItem(string item) { diff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Controller.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Controller.cs index 17b80612fb595..fea546a311a4d 100644 --- a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Controller.cs +++ b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Controller.cs @@ -29,7 +29,7 @@ internal partial class Controller : private ImmutableArray _providers; private IContentType _lastSeenContentType; - public string DisplayName => EditorFeaturesResources.Signature_Help_Command_Handler; + public string DisplayName => EditorFeaturesResources.Signature_Help; public Controller( ITextView textView, diff --git a/src/EditorFeatures/Core/Implementation/Organizing/OrganizeDocumentCommandHandler.cs b/src/EditorFeatures/Core/Implementation/Organizing/OrganizeDocumentCommandHandler.cs index 00510e9923fc3..6a02440609d0e 100644 --- a/src/EditorFeatures/Core/Implementation/Organizing/OrganizeDocumentCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/Organizing/OrganizeDocumentCommandHandler.cs @@ -29,7 +29,7 @@ internal class OrganizeDocumentCommandHandler : VSCommanding.ICommandHandler, VSCommanding.ICommandHandler { - public string DisplayName => EditorFeaturesResources.Organize_Document_Command_Handler; + public string DisplayName => EditorFeaturesResources.Organize_Document; public VSCommanding.CommandState GetCommandState(OrganizeDocumentCommandArgs args) { diff --git a/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingCancellationCommandHandler.cs b/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingCancellationCommandHandler.cs index 3a1fba84eae3a..f9b54ff8d606b 100644 --- a/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingCancellationCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingCancellationCommandHandler.cs @@ -22,7 +22,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking [Order(After = PredefinedCommandHandlerNames.EventHookup)] internal class RenameTrackingCancellationCommandHandler : VSCommanding.ICommandHandler { - public string DisplayName => EditorFeaturesResources.Rename_Tracking_Cancellation_Command_Handler; + public string DisplayName => EditorFeaturesResources.Rename_Tracking_Cancellation; public bool ExecuteCommand(EscapeKeyCommandArgs args, CommandExecutionContext context) { diff --git a/src/EditorFeatures/Core/ReferenceHighlighting/NagivateToHighlightReferenceCommandHandler.cs b/src/EditorFeatures/Core/ReferenceHighlighting/NagivateToHighlightReferenceCommandHandler.cs index 4d8eb4aae8ad6..399054da432cd 100644 --- a/src/EditorFeatures/Core/ReferenceHighlighting/NagivateToHighlightReferenceCommandHandler.cs +++ b/src/EditorFeatures/Core/ReferenceHighlighting/NagivateToHighlightReferenceCommandHandler.cs @@ -30,7 +30,7 @@ internal partial class NavigateToHighlightReferenceCommandHandler : private readonly IOutliningManagerService _outliningManagerService; private readonly IViewTagAggregatorFactoryService _tagAggregatorFactory; - public string DisplayName => EditorFeaturesResources.Navigate_To_Highlight_Reference_Command_Handler; + public string DisplayName => EditorFeaturesResources.Navigate_To_Highlight_Reference; [ImportingConstructor] public NavigateToHighlightReferenceCommandHandler( diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf index 5c2b61e9f68b3..21fb24e8d3801 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf @@ -1084,139 +1084,69 @@ Chcete pokračovat? Text pole při přejmenovávání na řádku - - View Call Hierarchy Command Handler - View Call Hierarchy Command Handler + + Block Comment Editing + Block Comment Editing - - Automatic Line Ender Command Handler - Automatic Line Ender Command Handler + + Comment/Uncomment Selection + Comment/Uncomment Selection - - Block Comment Editing Command Handler - Block Comment Editing Command Handler + + Code Completion + Code Completion - - Change Signature Command Handler - Change Signature Command Handler + + Execute In Interactive + Execute In Interactive - - Comment/Uncomment Selection Command Handler - Comment/Uncomment Selection Command Handler + + Extract Interface + Extract Interface - - Code Completion Command Handler - Code Completion Command Handler + + Go To Adjacent Member + Go To Adjacent Member - - Documentation Comment Command Handler - Documentation Comment Command Handler + + Interactive + Interactive - - Encapsulate Field Command Handler - Encapsulate Field Command Handler + + Navigate To Highlighted Reference + Navigate To Highlighted Reference - - Execute In Interactive Command Handler - Execute In Interactive Command Handler + + Outlining + Outlining - - Extract Interface Command Handler - Extract Interface Command Handler + + Rename Tracking Cancellation + Rename Tracking Cancellation - - Extract Method Command Handler - Extract Method Command Handler + + Signature Help + Signature Help - - Find References Command Handler - Find References Command Handler + + Smart Token Formatter + Smart Token Formatter - - Format Command Handler - Format Command Handler - - - - Go To Adjacent Member Command Handler - Go To Adjacent Member Command Handler - - - - Go To Definition Command Handler - Go To Definition Command Handler - - - - Go To Implementation Command Handler - Go To Implementation Command Handler - - - - IntelliSense Command Handler - IntelliSense Command Handler - - - - Interactive Command Handler - Interactive Command Handler - - - - Interactive Paste Command Handler - Interactive Paste Command Handler - - - - Navigate To Highlighted Reference Command Handler - Navigate To Highlighted Reference Command Handler - - - - Organize Document Command Handler - Organize Document Command Handler - - - - Outlining Command Handler - Outlining Command Handler - - - - Rename Command Handler - Rename Command Handler - - - - Rename Tracking Cancellation Command Handler - Rename Tracking Cancellation Command Handler - - - - Signature Help Command Handler - Signature Help Command Handler - - - - Smart Token Formatter Command Handler - Smart Token Formatter Command Handler - - - - XML Tag Completion Command Handler - XML Tag Completion Command Handler + + Paste in Interactive + Paste in Interactive diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf index 681b1c367b9b0..ecae09763d8b3 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf @@ -1084,139 +1084,69 @@ Möchten Sie fortfahren? Text für das Feld zur Inlineumbenennung - - View Call Hierarchy Command Handler - View Call Hierarchy Command Handler + + Block Comment Editing + Block Comment Editing - - Automatic Line Ender Command Handler - Automatic Line Ender Command Handler + + Comment/Uncomment Selection + Comment/Uncomment Selection - - Block Comment Editing Command Handler - Block Comment Editing Command Handler + + Code Completion + Code Completion - - Change Signature Command Handler - Change Signature Command Handler + + Execute In Interactive + Execute In Interactive - - Comment/Uncomment Selection Command Handler - Comment/Uncomment Selection Command Handler + + Extract Interface + Extract Interface - - Code Completion Command Handler - Code Completion Command Handler + + Go To Adjacent Member + Go To Adjacent Member - - Documentation Comment Command Handler - Documentation Comment Command Handler + + Interactive + Interactive - - Encapsulate Field Command Handler - Encapsulate Field Command Handler + + Navigate To Highlighted Reference + Navigate To Highlighted Reference - - Execute In Interactive Command Handler - Execute In Interactive Command Handler + + Outlining + Outlining - - Extract Interface Command Handler - Extract Interface Command Handler + + Rename Tracking Cancellation + Rename Tracking Cancellation - - Extract Method Command Handler - Extract Method Command Handler + + Signature Help + Signature Help - - Find References Command Handler - Find References Command Handler + + Smart Token Formatter + Smart Token Formatter - - Format Command Handler - Format Command Handler - - - - Go To Adjacent Member Command Handler - Go To Adjacent Member Command Handler - - - - Go To Definition Command Handler - Go To Definition Command Handler - - - - Go To Implementation Command Handler - Go To Implementation Command Handler - - - - IntelliSense Command Handler - IntelliSense Command Handler - - - - Interactive Command Handler - Interactive Command Handler - - - - Interactive Paste Command Handler - Interactive Paste Command Handler - - - - Navigate To Highlighted Reference Command Handler - Navigate To Highlighted Reference Command Handler - - - - Organize Document Command Handler - Organize Document Command Handler - - - - Outlining Command Handler - Outlining Command Handler - - - - Rename Command Handler - Rename Command Handler - - - - Rename Tracking Cancellation Command Handler - Rename Tracking Cancellation Command Handler - - - - Signature Help Command Handler - Signature Help Command Handler - - - - Smart Token Formatter Command Handler - Smart Token Formatter Command Handler - - - - XML Tag Completion Command Handler - XML Tag Completion Command Handler + + Paste in Interactive + Paste in Interactive diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf index 4a5feeab77b8d..2d4e274fed789 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf @@ -1084,139 +1084,69 @@ Do you want to proceed? Texto del campo de cambio de nombre en línea - - View Call Hierarchy Command Handler - View Call Hierarchy Command Handler + + Block Comment Editing + Block Comment Editing - - Automatic Line Ender Command Handler - Automatic Line Ender Command Handler + + Comment/Uncomment Selection + Comment/Uncomment Selection - - Block Comment Editing Command Handler - Block Comment Editing Command Handler + + Code Completion + Code Completion - - Change Signature Command Handler - Change Signature Command Handler + + Execute In Interactive + Execute In Interactive - - Comment/Uncomment Selection Command Handler - Comment/Uncomment Selection Command Handler + + Extract Interface + Extract Interface - - Code Completion Command Handler - Code Completion Command Handler + + Go To Adjacent Member + Go To Adjacent Member - - Documentation Comment Command Handler - Documentation Comment Command Handler + + Interactive + Interactive - - Encapsulate Field Command Handler - Encapsulate Field Command Handler + + Navigate To Highlighted Reference + Navigate To Highlighted Reference - - Execute In Interactive Command Handler - Execute In Interactive Command Handler + + Outlining + Outlining - - Extract Interface Command Handler - Extract Interface Command Handler + + Rename Tracking Cancellation + Rename Tracking Cancellation - - Extract Method Command Handler - Extract Method Command Handler + + Signature Help + Signature Help - - Find References Command Handler - Find References Command Handler + + Smart Token Formatter + Smart Token Formatter - - Format Command Handler - Format Command Handler - - - - Go To Adjacent Member Command Handler - Go To Adjacent Member Command Handler - - - - Go To Definition Command Handler - Go To Definition Command Handler - - - - Go To Implementation Command Handler - Go To Implementation Command Handler - - - - IntelliSense Command Handler - IntelliSense Command Handler - - - - Interactive Command Handler - Interactive Command Handler - - - - Interactive Paste Command Handler - Interactive Paste Command Handler - - - - Navigate To Highlighted Reference Command Handler - Navigate To Highlighted Reference Command Handler - - - - Organize Document Command Handler - Organize Document Command Handler - - - - Outlining Command Handler - Outlining Command Handler - - - - Rename Command Handler - Rename Command Handler - - - - Rename Tracking Cancellation Command Handler - Rename Tracking Cancellation Command Handler - - - - Signature Help Command Handler - Signature Help Command Handler - - - - Smart Token Formatter Command Handler - Smart Token Formatter Command Handler - - - - XML Tag Completion Command Handler - XML Tag Completion Command Handler + + Paste in Interactive + Paste in Interactive diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf index 2a2b3f19b710e..3718ebdc61287 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf @@ -1084,139 +1084,69 @@ Voulez-vous continuer ? Texte du champ de changement de nom inline - - View Call Hierarchy Command Handler - View Call Hierarchy Command Handler + + Block Comment Editing + Block Comment Editing - - Automatic Line Ender Command Handler - Automatic Line Ender Command Handler + + Comment/Uncomment Selection + Comment/Uncomment Selection - - Block Comment Editing Command Handler - Block Comment Editing Command Handler + + Code Completion + Code Completion - - Change Signature Command Handler - Change Signature Command Handler + + Execute In Interactive + Execute In Interactive - - Comment/Uncomment Selection Command Handler - Comment/Uncomment Selection Command Handler + + Extract Interface + Extract Interface - - Code Completion Command Handler - Code Completion Command Handler + + Go To Adjacent Member + Go To Adjacent Member - - Documentation Comment Command Handler - Documentation Comment Command Handler + + Interactive + Interactive - - Encapsulate Field Command Handler - Encapsulate Field Command Handler + + Navigate To Highlighted Reference + Navigate To Highlighted Reference - - Execute In Interactive Command Handler - Execute In Interactive Command Handler + + Outlining + Outlining - - Extract Interface Command Handler - Extract Interface Command Handler + + Rename Tracking Cancellation + Rename Tracking Cancellation - - Extract Method Command Handler - Extract Method Command Handler + + Signature Help + Signature Help - - Find References Command Handler - Find References Command Handler + + Smart Token Formatter + Smart Token Formatter - - Format Command Handler - Format Command Handler - - - - Go To Adjacent Member Command Handler - Go To Adjacent Member Command Handler - - - - Go To Definition Command Handler - Go To Definition Command Handler - - - - Go To Implementation Command Handler - Go To Implementation Command Handler - - - - IntelliSense Command Handler - IntelliSense Command Handler - - - - Interactive Command Handler - Interactive Command Handler - - - - Interactive Paste Command Handler - Interactive Paste Command Handler - - - - Navigate To Highlighted Reference Command Handler - Navigate To Highlighted Reference Command Handler - - - - Organize Document Command Handler - Organize Document Command Handler - - - - Outlining Command Handler - Outlining Command Handler - - - - Rename Command Handler - Rename Command Handler - - - - Rename Tracking Cancellation Command Handler - Rename Tracking Cancellation Command Handler - - - - Signature Help Command Handler - Signature Help Command Handler - - - - Smart Token Formatter Command Handler - Smart Token Formatter Command Handler - - - - XML Tag Completion Command Handler - XML Tag Completion Command Handler + + Paste in Interactive + Paste in Interactive diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf index 0fdc03ae78f19..006b70f98f141 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf @@ -1084,139 +1084,69 @@ Continuare? Ridenominazione inline - Campo di testo - - View Call Hierarchy Command Handler - View Call Hierarchy Command Handler + + Block Comment Editing + Block Comment Editing - - Automatic Line Ender Command Handler - Automatic Line Ender Command Handler + + Comment/Uncomment Selection + Comment/Uncomment Selection - - Block Comment Editing Command Handler - Block Comment Editing Command Handler + + Code Completion + Code Completion - - Change Signature Command Handler - Change Signature Command Handler + + Execute In Interactive + Execute In Interactive - - Comment/Uncomment Selection Command Handler - Comment/Uncomment Selection Command Handler + + Extract Interface + Extract Interface - - Code Completion Command Handler - Code Completion Command Handler + + Go To Adjacent Member + Go To Adjacent Member - - Documentation Comment Command Handler - Documentation Comment Command Handler + + Interactive + Interactive - - Encapsulate Field Command Handler - Encapsulate Field Command Handler + + Navigate To Highlighted Reference + Navigate To Highlighted Reference - - Execute In Interactive Command Handler - Execute In Interactive Command Handler + + Outlining + Outlining - - Extract Interface Command Handler - Extract Interface Command Handler + + Rename Tracking Cancellation + Rename Tracking Cancellation - - Extract Method Command Handler - Extract Method Command Handler + + Signature Help + Signature Help - - Find References Command Handler - Find References Command Handler + + Smart Token Formatter + Smart Token Formatter - - Format Command Handler - Format Command Handler - - - - Go To Adjacent Member Command Handler - Go To Adjacent Member Command Handler - - - - Go To Definition Command Handler - Go To Definition Command Handler - - - - Go To Implementation Command Handler - Go To Implementation Command Handler - - - - IntelliSense Command Handler - IntelliSense Command Handler - - - - Interactive Command Handler - Interactive Command Handler - - - - Interactive Paste Command Handler - Interactive Paste Command Handler - - - - Navigate To Highlighted Reference Command Handler - Navigate To Highlighted Reference Command Handler - - - - Organize Document Command Handler - Organize Document Command Handler - - - - Outlining Command Handler - Outlining Command Handler - - - - Rename Command Handler - Rename Command Handler - - - - Rename Tracking Cancellation Command Handler - Rename Tracking Cancellation Command Handler - - - - Signature Help Command Handler - Signature Help Command Handler - - - - Smart Token Formatter Command Handler - Smart Token Formatter Command Handler - - - - XML Tag Completion Command Handler - XML Tag Completion Command Handler + + Paste in Interactive + Paste in Interactive diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf index 32a15f77d27a3..8be4d8fea6394 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf @@ -1084,139 +1084,69 @@ Do you want to proceed? インラインの名前変更フィールドのテキスト - - View Call Hierarchy Command Handler - View Call Hierarchy Command Handler + + Block Comment Editing + Block Comment Editing - - Automatic Line Ender Command Handler - Automatic Line Ender Command Handler + + Comment/Uncomment Selection + Comment/Uncomment Selection - - Block Comment Editing Command Handler - Block Comment Editing Command Handler + + Code Completion + Code Completion - - Change Signature Command Handler - Change Signature Command Handler + + Execute In Interactive + Execute In Interactive - - Comment/Uncomment Selection Command Handler - Comment/Uncomment Selection Command Handler + + Extract Interface + Extract Interface - - Code Completion Command Handler - Code Completion Command Handler + + Go To Adjacent Member + Go To Adjacent Member - - Documentation Comment Command Handler - Documentation Comment Command Handler + + Interactive + Interactive - - Encapsulate Field Command Handler - Encapsulate Field Command Handler + + Navigate To Highlighted Reference + Navigate To Highlighted Reference - - Execute In Interactive Command Handler - Execute In Interactive Command Handler + + Outlining + Outlining - - Extract Interface Command Handler - Extract Interface Command Handler + + Rename Tracking Cancellation + Rename Tracking Cancellation - - Extract Method Command Handler - Extract Method Command Handler + + Signature Help + Signature Help - - Find References Command Handler - Find References Command Handler + + Smart Token Formatter + Smart Token Formatter - - Format Command Handler - Format Command Handler - - - - Go To Adjacent Member Command Handler - Go To Adjacent Member Command Handler - - - - Go To Definition Command Handler - Go To Definition Command Handler - - - - Go To Implementation Command Handler - Go To Implementation Command Handler - - - - IntelliSense Command Handler - IntelliSense Command Handler - - - - Interactive Command Handler - Interactive Command Handler - - - - Interactive Paste Command Handler - Interactive Paste Command Handler - - - - Navigate To Highlighted Reference Command Handler - Navigate To Highlighted Reference Command Handler - - - - Organize Document Command Handler - Organize Document Command Handler - - - - Outlining Command Handler - Outlining Command Handler - - - - Rename Command Handler - Rename Command Handler - - - - Rename Tracking Cancellation Command Handler - Rename Tracking Cancellation Command Handler - - - - Signature Help Command Handler - Signature Help Command Handler - - - - Smart Token Formatter Command Handler - Smart Token Formatter Command Handler - - - - XML Tag Completion Command Handler - XML Tag Completion Command Handler + + Paste in Interactive + Paste in Interactive diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf index 6b13d5a25c3cf..39ed8d06af448 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf @@ -1084,139 +1084,69 @@ Do you want to proceed? 인라인 이름 바꾸기 필드 텍스트 - - View Call Hierarchy Command Handler - View Call Hierarchy Command Handler + + Block Comment Editing + Block Comment Editing - - Automatic Line Ender Command Handler - Automatic Line Ender Command Handler + + Comment/Uncomment Selection + Comment/Uncomment Selection - - Block Comment Editing Command Handler - Block Comment Editing Command Handler + + Code Completion + Code Completion - - Change Signature Command Handler - Change Signature Command Handler + + Execute In Interactive + Execute In Interactive - - Comment/Uncomment Selection Command Handler - Comment/Uncomment Selection Command Handler + + Extract Interface + Extract Interface - - Code Completion Command Handler - Code Completion Command Handler + + Go To Adjacent Member + Go To Adjacent Member - - Documentation Comment Command Handler - Documentation Comment Command Handler + + Interactive + Interactive - - Encapsulate Field Command Handler - Encapsulate Field Command Handler + + Navigate To Highlighted Reference + Navigate To Highlighted Reference - - Execute In Interactive Command Handler - Execute In Interactive Command Handler + + Outlining + Outlining - - Extract Interface Command Handler - Extract Interface Command Handler + + Rename Tracking Cancellation + Rename Tracking Cancellation - - Extract Method Command Handler - Extract Method Command Handler + + Signature Help + Signature Help - - Find References Command Handler - Find References Command Handler + + Smart Token Formatter + Smart Token Formatter - - Format Command Handler - Format Command Handler - - - - Go To Adjacent Member Command Handler - Go To Adjacent Member Command Handler - - - - Go To Definition Command Handler - Go To Definition Command Handler - - - - Go To Implementation Command Handler - Go To Implementation Command Handler - - - - IntelliSense Command Handler - IntelliSense Command Handler - - - - Interactive Command Handler - Interactive Command Handler - - - - Interactive Paste Command Handler - Interactive Paste Command Handler - - - - Navigate To Highlighted Reference Command Handler - Navigate To Highlighted Reference Command Handler - - - - Organize Document Command Handler - Organize Document Command Handler - - - - Outlining Command Handler - Outlining Command Handler - - - - Rename Command Handler - Rename Command Handler - - - - Rename Tracking Cancellation Command Handler - Rename Tracking Cancellation Command Handler - - - - Signature Help Command Handler - Signature Help Command Handler - - - - Smart Token Formatter Command Handler - Smart Token Formatter Command Handler - - - - XML Tag Completion Command Handler - XML Tag Completion Command Handler + + Paste in Interactive + Paste in Interactive diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf index 2aa8e0e87d2dd..c0836d59ffd07 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf @@ -1084,139 +1084,69 @@ Czy chcesz kontynuować? Tekst pola zmiany nazwy wstawionego elementu - - View Call Hierarchy Command Handler - View Call Hierarchy Command Handler + + Block Comment Editing + Block Comment Editing - - Automatic Line Ender Command Handler - Automatic Line Ender Command Handler + + Comment/Uncomment Selection + Comment/Uncomment Selection - - Block Comment Editing Command Handler - Block Comment Editing Command Handler + + Code Completion + Code Completion - - Change Signature Command Handler - Change Signature Command Handler + + Execute In Interactive + Execute In Interactive - - Comment/Uncomment Selection Command Handler - Comment/Uncomment Selection Command Handler + + Extract Interface + Extract Interface - - Code Completion Command Handler - Code Completion Command Handler + + Go To Adjacent Member + Go To Adjacent Member - - Documentation Comment Command Handler - Documentation Comment Command Handler + + Interactive + Interactive - - Encapsulate Field Command Handler - Encapsulate Field Command Handler + + Navigate To Highlighted Reference + Navigate To Highlighted Reference - - Execute In Interactive Command Handler - Execute In Interactive Command Handler + + Outlining + Outlining - - Extract Interface Command Handler - Extract Interface Command Handler + + Rename Tracking Cancellation + Rename Tracking Cancellation - - Extract Method Command Handler - Extract Method Command Handler + + Signature Help + Signature Help - - Find References Command Handler - Find References Command Handler + + Smart Token Formatter + Smart Token Formatter - - Format Command Handler - Format Command Handler - - - - Go To Adjacent Member Command Handler - Go To Adjacent Member Command Handler - - - - Go To Definition Command Handler - Go To Definition Command Handler - - - - Go To Implementation Command Handler - Go To Implementation Command Handler - - - - IntelliSense Command Handler - IntelliSense Command Handler - - - - Interactive Command Handler - Interactive Command Handler - - - - Interactive Paste Command Handler - Interactive Paste Command Handler - - - - Navigate To Highlighted Reference Command Handler - Navigate To Highlighted Reference Command Handler - - - - Organize Document Command Handler - Organize Document Command Handler - - - - Outlining Command Handler - Outlining Command Handler - - - - Rename Command Handler - Rename Command Handler - - - - Rename Tracking Cancellation Command Handler - Rename Tracking Cancellation Command Handler - - - - Signature Help Command Handler - Signature Help Command Handler - - - - Smart Token Formatter Command Handler - Smart Token Formatter Command Handler - - - - XML Tag Completion Command Handler - XML Tag Completion Command Handler + + Paste in Interactive + Paste in Interactive diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf index 8ebf87c9442ca..97a9e9385fb72 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf @@ -1084,139 +1084,69 @@ Deseja continuar? Texto do Campo de Renomeação Embutida - - View Call Hierarchy Command Handler - View Call Hierarchy Command Handler + + Block Comment Editing + Block Comment Editing - - Automatic Line Ender Command Handler - Automatic Line Ender Command Handler + + Comment/Uncomment Selection + Comment/Uncomment Selection - - Block Comment Editing Command Handler - Block Comment Editing Command Handler + + Code Completion + Code Completion - - Change Signature Command Handler - Change Signature Command Handler + + Execute In Interactive + Execute In Interactive - - Comment/Uncomment Selection Command Handler - Comment/Uncomment Selection Command Handler + + Extract Interface + Extract Interface - - Code Completion Command Handler - Code Completion Command Handler + + Go To Adjacent Member + Go To Adjacent Member - - Documentation Comment Command Handler - Documentation Comment Command Handler + + Interactive + Interactive - - Encapsulate Field Command Handler - Encapsulate Field Command Handler + + Navigate To Highlighted Reference + Navigate To Highlighted Reference - - Execute In Interactive Command Handler - Execute In Interactive Command Handler + + Outlining + Outlining - - Extract Interface Command Handler - Extract Interface Command Handler + + Rename Tracking Cancellation + Rename Tracking Cancellation - - Extract Method Command Handler - Extract Method Command Handler + + Signature Help + Signature Help - - Find References Command Handler - Find References Command Handler + + Smart Token Formatter + Smart Token Formatter - - Format Command Handler - Format Command Handler - - - - Go To Adjacent Member Command Handler - Go To Adjacent Member Command Handler - - - - Go To Definition Command Handler - Go To Definition Command Handler - - - - Go To Implementation Command Handler - Go To Implementation Command Handler - - - - IntelliSense Command Handler - IntelliSense Command Handler - - - - Interactive Command Handler - Interactive Command Handler - - - - Interactive Paste Command Handler - Interactive Paste Command Handler - - - - Navigate To Highlighted Reference Command Handler - Navigate To Highlighted Reference Command Handler - - - - Organize Document Command Handler - Organize Document Command Handler - - - - Outlining Command Handler - Outlining Command Handler - - - - Rename Command Handler - Rename Command Handler - - - - Rename Tracking Cancellation Command Handler - Rename Tracking Cancellation Command Handler - - - - Signature Help Command Handler - Signature Help Command Handler - - - - Smart Token Formatter Command Handler - Smart Token Formatter Command Handler - - - - XML Tag Completion Command Handler - XML Tag Completion Command Handler + + Paste in Interactive + Paste in Interactive diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf index a558681fe3b25..2823ea8687367 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf @@ -1084,139 +1084,69 @@ Do you want to proceed? Текст поля "Встроенное переименование" - - View Call Hierarchy Command Handler - View Call Hierarchy Command Handler + + Block Comment Editing + Block Comment Editing - - Automatic Line Ender Command Handler - Automatic Line Ender Command Handler + + Comment/Uncomment Selection + Comment/Uncomment Selection - - Block Comment Editing Command Handler - Block Comment Editing Command Handler + + Code Completion + Code Completion - - Change Signature Command Handler - Change Signature Command Handler + + Execute In Interactive + Execute In Interactive - - Comment/Uncomment Selection Command Handler - Comment/Uncomment Selection Command Handler + + Extract Interface + Extract Interface - - Code Completion Command Handler - Code Completion Command Handler + + Go To Adjacent Member + Go To Adjacent Member - - Documentation Comment Command Handler - Documentation Comment Command Handler + + Interactive + Interactive - - Encapsulate Field Command Handler - Encapsulate Field Command Handler + + Navigate To Highlighted Reference + Navigate To Highlighted Reference - - Execute In Interactive Command Handler - Execute In Interactive Command Handler + + Outlining + Outlining - - Extract Interface Command Handler - Extract Interface Command Handler + + Rename Tracking Cancellation + Rename Tracking Cancellation - - Extract Method Command Handler - Extract Method Command Handler + + Signature Help + Signature Help - - Find References Command Handler - Find References Command Handler + + Smart Token Formatter + Smart Token Formatter - - Format Command Handler - Format Command Handler - - - - Go To Adjacent Member Command Handler - Go To Adjacent Member Command Handler - - - - Go To Definition Command Handler - Go To Definition Command Handler - - - - Go To Implementation Command Handler - Go To Implementation Command Handler - - - - IntelliSense Command Handler - IntelliSense Command Handler - - - - Interactive Command Handler - Interactive Command Handler - - - - Interactive Paste Command Handler - Interactive Paste Command Handler - - - - Navigate To Highlighted Reference Command Handler - Navigate To Highlighted Reference Command Handler - - - - Organize Document Command Handler - Organize Document Command Handler - - - - Outlining Command Handler - Outlining Command Handler - - - - Rename Command Handler - Rename Command Handler - - - - Rename Tracking Cancellation Command Handler - Rename Tracking Cancellation Command Handler - - - - Signature Help Command Handler - Signature Help Command Handler - - - - Smart Token Formatter Command Handler - Smart Token Formatter Command Handler - - - - XML Tag Completion Command Handler - XML Tag Completion Command Handler + + Paste in Interactive + Paste in Interactive diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf index f9345932f5ae7..53e53e23d8d22 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf @@ -1084,139 +1084,69 @@ Devam etmek istiyor musunuz? Satır İçi Alan Metnini Yeniden Adlandır - - View Call Hierarchy Command Handler - View Call Hierarchy Command Handler + + Block Comment Editing + Block Comment Editing - - Automatic Line Ender Command Handler - Automatic Line Ender Command Handler + + Comment/Uncomment Selection + Comment/Uncomment Selection - - Block Comment Editing Command Handler - Block Comment Editing Command Handler + + Code Completion + Code Completion - - Change Signature Command Handler - Change Signature Command Handler + + Execute In Interactive + Execute In Interactive - - Comment/Uncomment Selection Command Handler - Comment/Uncomment Selection Command Handler + + Extract Interface + Extract Interface - - Code Completion Command Handler - Code Completion Command Handler + + Go To Adjacent Member + Go To Adjacent Member - - Documentation Comment Command Handler - Documentation Comment Command Handler + + Interactive + Interactive - - Encapsulate Field Command Handler - Encapsulate Field Command Handler + + Navigate To Highlighted Reference + Navigate To Highlighted Reference - - Execute In Interactive Command Handler - Execute In Interactive Command Handler + + Outlining + Outlining - - Extract Interface Command Handler - Extract Interface Command Handler + + Rename Tracking Cancellation + Rename Tracking Cancellation - - Extract Method Command Handler - Extract Method Command Handler + + Signature Help + Signature Help - - Find References Command Handler - Find References Command Handler + + Smart Token Formatter + Smart Token Formatter - - Format Command Handler - Format Command Handler - - - - Go To Adjacent Member Command Handler - Go To Adjacent Member Command Handler - - - - Go To Definition Command Handler - Go To Definition Command Handler - - - - Go To Implementation Command Handler - Go To Implementation Command Handler - - - - IntelliSense Command Handler - IntelliSense Command Handler - - - - Interactive Command Handler - Interactive Command Handler - - - - Interactive Paste Command Handler - Interactive Paste Command Handler - - - - Navigate To Highlighted Reference Command Handler - Navigate To Highlighted Reference Command Handler - - - - Organize Document Command Handler - Organize Document Command Handler - - - - Outlining Command Handler - Outlining Command Handler - - - - Rename Command Handler - Rename Command Handler - - - - Rename Tracking Cancellation Command Handler - Rename Tracking Cancellation Command Handler - - - - Signature Help Command Handler - Signature Help Command Handler - - - - Smart Token Formatter Command Handler - Smart Token Formatter Command Handler - - - - XML Tag Completion Command Handler - XML Tag Completion Command Handler + + Paste in Interactive + Paste in Interactive diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf index 5fbb3ff3e57e9..e645bfa8d3441 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf @@ -1084,139 +1084,69 @@ Do you want to proceed? 内联重命名字段文本 - - View Call Hierarchy Command Handler - View Call Hierarchy Command Handler + + Block Comment Editing + Block Comment Editing - - Automatic Line Ender Command Handler - Automatic Line Ender Command Handler + + Comment/Uncomment Selection + Comment/Uncomment Selection - - Block Comment Editing Command Handler - Block Comment Editing Command Handler + + Code Completion + Code Completion - - Change Signature Command Handler - Change Signature Command Handler + + Execute In Interactive + Execute In Interactive - - Comment/Uncomment Selection Command Handler - Comment/Uncomment Selection Command Handler + + Extract Interface + Extract Interface - - Code Completion Command Handler - Code Completion Command Handler + + Go To Adjacent Member + Go To Adjacent Member - - Documentation Comment Command Handler - Documentation Comment Command Handler + + Interactive + Interactive - - Encapsulate Field Command Handler - Encapsulate Field Command Handler + + Navigate To Highlighted Reference + Navigate To Highlighted Reference - - Execute In Interactive Command Handler - Execute In Interactive Command Handler + + Outlining + Outlining - - Extract Interface Command Handler - Extract Interface Command Handler + + Rename Tracking Cancellation + Rename Tracking Cancellation - - Extract Method Command Handler - Extract Method Command Handler + + Signature Help + Signature Help - - Find References Command Handler - Find References Command Handler + + Smart Token Formatter + Smart Token Formatter - - Format Command Handler - Format Command Handler - - - - Go To Adjacent Member Command Handler - Go To Adjacent Member Command Handler - - - - Go To Definition Command Handler - Go To Definition Command Handler - - - - Go To Implementation Command Handler - Go To Implementation Command Handler - - - - IntelliSense Command Handler - IntelliSense Command Handler - - - - Interactive Command Handler - Interactive Command Handler - - - - Interactive Paste Command Handler - Interactive Paste Command Handler - - - - Navigate To Highlighted Reference Command Handler - Navigate To Highlighted Reference Command Handler - - - - Organize Document Command Handler - Organize Document Command Handler - - - - Outlining Command Handler - Outlining Command Handler - - - - Rename Command Handler - Rename Command Handler - - - - Rename Tracking Cancellation Command Handler - Rename Tracking Cancellation Command Handler - - - - Signature Help Command Handler - Signature Help Command Handler - - - - Smart Token Formatter Command Handler - Smart Token Formatter Command Handler - - - - XML Tag Completion Command Handler - XML Tag Completion Command Handler + + Paste in Interactive + Paste in Interactive diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf index 44d45b7e2e390..ae7422cb6f468 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf @@ -1084,139 +1084,69 @@ Do you want to proceed? 內嵌重新命名欄位的文字 - - View Call Hierarchy Command Handler - View Call Hierarchy Command Handler + + Block Comment Editing + Block Comment Editing - - Automatic Line Ender Command Handler - Automatic Line Ender Command Handler + + Comment/Uncomment Selection + Comment/Uncomment Selection - - Block Comment Editing Command Handler - Block Comment Editing Command Handler + + Code Completion + Code Completion - - Change Signature Command Handler - Change Signature Command Handler + + Execute In Interactive + Execute In Interactive - - Comment/Uncomment Selection Command Handler - Comment/Uncomment Selection Command Handler + + Extract Interface + Extract Interface - - Code Completion Command Handler - Code Completion Command Handler + + Go To Adjacent Member + Go To Adjacent Member - - Documentation Comment Command Handler - Documentation Comment Command Handler + + Interactive + Interactive - - Encapsulate Field Command Handler - Encapsulate Field Command Handler + + Navigate To Highlighted Reference + Navigate To Highlighted Reference - - Execute In Interactive Command Handler - Execute In Interactive Command Handler + + Outlining + Outlining - - Extract Interface Command Handler - Extract Interface Command Handler + + Rename Tracking Cancellation + Rename Tracking Cancellation - - Extract Method Command Handler - Extract Method Command Handler + + Signature Help + Signature Help - - Find References Command Handler - Find References Command Handler + + Smart Token Formatter + Smart Token Formatter - - Format Command Handler - Format Command Handler - - - - Go To Adjacent Member Command Handler - Go To Adjacent Member Command Handler - - - - Go To Definition Command Handler - Go To Definition Command Handler - - - - Go To Implementation Command Handler - Go To Implementation Command Handler - - - - IntelliSense Command Handler - IntelliSense Command Handler - - - - Interactive Command Handler - Interactive Command Handler - - - - Interactive Paste Command Handler - Interactive Paste Command Handler - - - - Navigate To Highlighted Reference Command Handler - Navigate To Highlighted Reference Command Handler - - - - Organize Document Command Handler - Organize Document Command Handler - - - - Outlining Command Handler - Outlining Command Handler - - - - Rename Command Handler - Rename Command Handler - - - - Rename Tracking Cancellation Command Handler - Rename Tracking Cancellation Command Handler - - - - Signature Help Command Handler - Signature Help Command Handler - - - - Smart Token Formatter Command Handler - Smart Token Formatter Command Handler - - - - XML Tag Completion Command Handler - XML Tag Completion Command Handler + + Paste in Interactive + Paste in Interactive diff --git a/src/EditorFeatures/VisualBasic/EndConstructGeneration/EndConstructCommandHandler.vb b/src/EditorFeatures/VisualBasic/EndConstructGeneration/EndConstructCommandHandler.vb index 6a5d59596e8d0..fff3a56563224 100644 --- a/src/EditorFeatures/VisualBasic/EndConstructGeneration/EndConstructCommandHandler.vb +++ b/src/EditorFeatures/VisualBasic/EndConstructGeneration/EndConstructCommandHandler.vb @@ -32,7 +32,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.EndConstructGeneration Public ReadOnly Property DisplayName As String Implements INamed.DisplayName Get - Return VBEditorResources.End_Construct_Command_Handler + Return VBEditorResources.End_Construct End Get End Property diff --git a/src/EditorFeatures/VisualBasic/LineCommit/CommitCommandHandler.vb b/src/EditorFeatures/VisualBasic/LineCommit/CommitCommandHandler.vb index 9bd8b48e4b1be..732dfc487dd40 100644 --- a/src/EditorFeatures/VisualBasic/LineCommit/CommitCommandHandler.vb +++ b/src/EditorFeatures/VisualBasic/LineCommit/CommitCommandHandler.vb @@ -41,7 +41,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LineCommit Public ReadOnly Property DisplayName As String Implements INamed.DisplayName Get - Return VBEditorResources.Commit_Command_Handler + Return VBEditorResources.Line_commit End Get End Property diff --git a/src/EditorFeatures/VisualBasic/Utilities/CommandHandlers/AbstractImplementAbstractClassOrInterfaceCommandHandler.vb b/src/EditorFeatures/VisualBasic/Utilities/CommandHandlers/AbstractImplementAbstractClassOrInterfaceCommandHandler.vb index cd58fd3cebcad..947ba3f42113d 100644 --- a/src/EditorFeatures/VisualBasic/Utilities/CommandHandlers/AbstractImplementAbstractClassOrInterfaceCommandHandler.vb +++ b/src/EditorFeatures/VisualBasic/Utilities/CommandHandlers/AbstractImplementAbstractClassOrInterfaceCommandHandler.vb @@ -23,7 +23,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.Utilities.CommandHandlers Public ReadOnly Property DisplayName As String Implements INamed.DisplayName Get - Return VBEditorResources.Implement_Abstract_Class_Or_Interface_Command_Handler + Return VBEditorResources.Implement_Abstract_Class_Or_Interface End Get End Property diff --git a/src/EditorFeatures/VisualBasic/VBEditorResources.Designer.vb b/src/EditorFeatures/VisualBasic/VBEditorResources.Designer.vb index 04effd483120e..3bebcbb15a747 100644 --- a/src/EditorFeatures/VisualBasic/VBEditorResources.Designer.vb +++ b/src/EditorFeatures/VisualBasic/VBEditorResources.Designer.vb @@ -86,16 +86,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.VBEditorResources Return ResourceManager.GetString("Case_Correction", resourceCulture) End Get End Property - - ''' - ''' Looks up a localized string similar to Line Commit Command Handler. - ''' - Friend ReadOnly Property Commit_Command_Handler() As String - Get - Return ResourceManager.GetString("Commit_Command_Handler", resourceCulture) - End Get - End Property - + ''' ''' Looks up a localized string similar to Committing line. ''' @@ -104,7 +95,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.VBEditorResources Return ResourceManager.GetString("Committing_line", resourceCulture) End Get End Property - + ''' ''' Looks up a localized string similar to Correcting word casing.... ''' @@ -113,7 +104,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.VBEditorResources Return ResourceManager.GetString("Correcting_word_casing", resourceCulture) End Get End Property - + ''' ''' Looks up a localized string similar to End Construct. ''' @@ -122,16 +113,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.VBEditorResources Return ResourceManager.GetString("End_Construct", resourceCulture) End Get End Property - - ''' - ''' Looks up a localized string similar to End Construct Command Handler. - ''' - Friend ReadOnly Property End_Construct_Command_Handler() As String - Get - Return ResourceManager.GetString("End_Construct_Command_Handler", resourceCulture) - End Get - End Property - + ''' ''' Looks up a localized string similar to Format Document. ''' @@ -140,7 +122,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.VBEditorResources Return ResourceManager.GetString("Format_Document", resourceCulture) End Get End Property - + ''' ''' Looks up a localized string similar to Format on Save. ''' @@ -149,7 +131,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.VBEditorResources Return ResourceManager.GetString("Format_on_Save", resourceCulture) End Get End Property - + ''' ''' Looks up a localized string similar to Format Paste. ''' @@ -158,7 +140,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.VBEditorResources Return ResourceManager.GetString("Format_Paste", resourceCulture) End Get End Property - + ''' ''' Looks up a localized string similar to Formatting Document.... ''' @@ -167,7 +149,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.VBEditorResources Return ResourceManager.GetString("Formatting_Document", resourceCulture) End Get End Property - + ''' ''' Looks up a localized string similar to Formatting pasted text.... ''' @@ -176,7 +158,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.VBEditorResources Return ResourceManager.GetString("Formatting_pasted_text", resourceCulture) End Get End Property - + ''' ''' Looks up a localized string similar to Generate Member. ''' @@ -185,13 +167,13 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.VBEditorResources Return ResourceManager.GetString("Generate_Member", resourceCulture) End Get End Property - + ''' - ''' Looks up a localized string similar to Implement Abstract Class Or Interface Command Handler. + ''' Looks up a localized string similar to Implement Abstract Class Or Interface. ''' - Friend ReadOnly Property Implement_Abstract_Class_Or_Interface_Command_Handler() As String + Friend ReadOnly Property Implement_Abstract_Class_Or_Interface() As String Get - Return ResourceManager.GetString("Implement_Abstract_Class_Or_Interface_Command_Handler", resourceCulture) + Return ResourceManager.GetString("Implement_Abstract_Class_Or_Interface", resourceCulture) End Get End Property diff --git a/src/EditorFeatures/VisualBasic/VBEditorResources.resx b/src/EditorFeatures/VisualBasic/VBEditorResources.resx index 0764dc822e318..69fbd33ec491b 100644 --- a/src/EditorFeatures/VisualBasic/VBEditorResources.resx +++ b/src/EditorFeatures/VisualBasic/VBEditorResources.resx @@ -180,13 +180,7 @@ Line commit - - Line Commit Command Handler - - - End Construct Command Handler - - - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface \ No newline at end of file diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.cs.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.cs.xlf index 1f371f572f79b..a631e41c61da7 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.cs.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.cs.xlf @@ -107,19 +107,9 @@ Potvrzení změn řádku - - Line Commit Command Handler - Line Commit Command Handler - - - - End Construct Command Handler - End Construct Command Handler - - - - Implement Abstract Class Or Interface Command Handler - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface + Implement Abstract Class Or Interface diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.de.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.de.xlf index 608ff1e0d7af6..775c0515f1e39 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.de.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.de.xlf @@ -107,19 +107,9 @@ Zeilencommit - - Line Commit Command Handler - Line Commit Command Handler - - - - End Construct Command Handler - End Construct Command Handler - - - - Implement Abstract Class Or Interface Command Handler - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface + Implement Abstract Class Or Interface diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.es.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.es.xlf index 867e0f8d1620b..1ff39d61622a2 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.es.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.es.xlf @@ -107,19 +107,9 @@ Confirmación de línea - - Line Commit Command Handler - Line Commit Command Handler - - - - End Construct Command Handler - End Construct Command Handler - - - - Implement Abstract Class Or Interface Command Handler - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface + Implement Abstract Class Or Interface diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.fr.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.fr.xlf index 505e37b8aace5..f387d97bd7d2c 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.fr.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.fr.xlf @@ -107,19 +107,9 @@ Validation de ligne - - Line Commit Command Handler - Line Commit Command Handler - - - - End Construct Command Handler - End Construct Command Handler - - - - Implement Abstract Class Or Interface Command Handler - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface + Implement Abstract Class Or Interface diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.it.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.it.xlf index c59664a4ebcd9..3414e733b8185 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.it.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.it.xlf @@ -107,19 +107,9 @@ Commit riga - - Line Commit Command Handler - Line Commit Command Handler - - - - End Construct Command Handler - End Construct Command Handler - - - - Implement Abstract Class Or Interface Command Handler - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface + Implement Abstract Class Or Interface diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ja.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ja.xlf index 2f07f0331a906..8b1892443c683 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ja.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ja.xlf @@ -107,19 +107,9 @@ 行コミット - - Line Commit Command Handler - Line Commit Command Handler - - - - End Construct Command Handler - End Construct Command Handler - - - - Implement Abstract Class Or Interface Command Handler - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface + Implement Abstract Class Or Interface diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ko.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ko.xlf index 3d2fd468b7fd0..a097e7223f0e6 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ko.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ko.xlf @@ -107,19 +107,9 @@ 줄 커밋 - - Line Commit Command Handler - Line Commit Command Handler - - - - End Construct Command Handler - End Construct Command Handler - - - - Implement Abstract Class Or Interface Command Handler - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface + Implement Abstract Class Or Interface diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pl.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pl.xlf index 56e3ee931fe29..bfa1305e66466 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pl.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pl.xlf @@ -107,19 +107,9 @@ Zatwierdzenie wiersza - - Line Commit Command Handler - Line Commit Command Handler - - - - End Construct Command Handler - End Construct Command Handler - - - - Implement Abstract Class Or Interface Command Handler - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface + Implement Abstract Class Or Interface diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pt-BR.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pt-BR.xlf index 2d6fe17749db9..08550419b0b82 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pt-BR.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pt-BR.xlf @@ -107,19 +107,9 @@ Confirmação de linha - - Line Commit Command Handler - Line Commit Command Handler - - - - End Construct Command Handler - End Construct Command Handler - - - - Implement Abstract Class Or Interface Command Handler - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface + Implement Abstract Class Or Interface diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ru.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ru.xlf index 0844db21ab858..c2cc620bf887b 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ru.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ru.xlf @@ -107,19 +107,9 @@ Фиксация строки - - Line Commit Command Handler - Line Commit Command Handler - - - - End Construct Command Handler - End Construct Command Handler - - - - Implement Abstract Class Or Interface Command Handler - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface + Implement Abstract Class Or Interface diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.tr.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.tr.xlf index eb2393a6bd2a5..e6df38b81c564 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.tr.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.tr.xlf @@ -107,19 +107,9 @@ Satır işleme - - Line Commit Command Handler - Line Commit Command Handler - - - - End Construct Command Handler - End Construct Command Handler - - - - Implement Abstract Class Or Interface Command Handler - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface + Implement Abstract Class Or Interface diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hans.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hans.xlf index 91faa980609dc..ca091ca56e572 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hans.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hans.xlf @@ -107,19 +107,9 @@ 行提交 - - Line Commit Command Handler - Line Commit Command Handler - - - - End Construct Command Handler - End Construct Command Handler - - - - Implement Abstract Class Or Interface Command Handler - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface + Implement Abstract Class Or Interface diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hant.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hant.xlf index 667be9914a1a9..0d92e09ff28ff 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hant.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hant.xlf @@ -107,19 +107,9 @@ 行認可 - - Line Commit Command Handler - Line Commit Command Handler - - - - End Construct Command Handler - End Construct Command Handler - - - - Implement Abstract Class Or Interface Command Handler - Implement Abstract Class Or Interface Command Handler + + Implement Abstract Class Or Interface + Implement Abstract Class Or Interface diff --git a/src/Interactive/EditorFeatures/Core/Extensibility/Interactive/InteractiveCommandHandler.cs b/src/Interactive/EditorFeatures/Core/Extensibility/Interactive/InteractiveCommandHandler.cs index ea545ef1533bd..89598c23c3a27 100644 --- a/src/Interactive/EditorFeatures/Core/Extensibility/Interactive/InteractiveCommandHandler.cs +++ b/src/Interactive/EditorFeatures/Core/Extensibility/Interactive/InteractiveCommandHandler.cs @@ -43,7 +43,7 @@ protected InteractiveCommandHandler( protected abstract ISendToInteractiveSubmissionProvider SendToInteractiveSubmissionProvider { get; } - public string DisplayName => EditorFeaturesResources.Interactive_Command_Handler; + public string DisplayName => EditorFeaturesResources.Interactive; private string GetSelectedText(EditorCommandArgs args, CancellationToken cancellationToken) { diff --git a/src/VisualStudio/CSharp/Impl/CSharpVSResources.Designer.cs b/src/VisualStudio/CSharp/Impl/CSharpVSResources.Designer.cs index d412424f47ec4..edfde863d7d29 100644 --- a/src/VisualStudio/CSharp/Impl/CSharpVSResources.Designer.cs +++ b/src/VisualStudio/CSharp/Impl/CSharpVSResources.Designer.cs @@ -195,15 +195,6 @@ internal static string Enter_outlining_mode_when_files_open { } } - /// - /// Looks up a localized string similar to Generate Event Subscription Command Handler. - /// - internal static string Event_Hookup_Command_Handler { - get { - return ResourceManager.GetString("Event_Hookup_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Extract Method. /// @@ -231,6 +222,15 @@ internal static string For_built_in_types { } } + /// + /// Looks up a localized string similar to Generate Event Subscription. + /// + internal static string Generate_Event_Subscription { + get { + return ResourceManager.GetString("Generate Event Subscription", resourceCulture); + } + } + /// /// Looks up a localized string similar to _Generate XML documentation comments for ///. /// diff --git a/src/VisualStudio/CSharp/Impl/CSharpVSResources.resx b/src/VisualStudio/CSharp/Impl/CSharpVSResources.resx index 8fbb1a64ec74a..26d15dc503349 100644 --- a/src/VisualStudio/CSharp/Impl/CSharpVSResources.resx +++ b/src/VisualStudio/CSharp/Impl/CSharpVSResources.resx @@ -531,7 +531,7 @@ Show name s_uggestions - - Generate Event Subscription Command Handler + + Generate Event Subscription \ No newline at end of file diff --git a/src/VisualStudio/CSharp/Impl/EventHookup/EventHookupCommandHandler_SessionCancellingCommands.cs b/src/VisualStudio/CSharp/Impl/EventHookup/EventHookupCommandHandler_SessionCancellingCommands.cs index 57f6b2b1afe3c..ad3c195a208e1 100644 --- a/src/VisualStudio/CSharp/Impl/EventHookup/EventHookupCommandHandler_SessionCancellingCommands.cs +++ b/src/VisualStudio/CSharp/Impl/EventHookup/EventHookupCommandHandler_SessionCancellingCommands.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.EventHookup internal partial class EventHookupCommandHandler : VSCommanding.ICommandHandler { - public string DisplayName => CSharpVSResources.Event_Hookup_Command_Handler; + public string DisplayName => CSharpVSResources.Generate_Event_Subscription; public bool ExecuteCommand(EscapeKeyCommandArgs args, CommandExecutionContext context) { diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.cs.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.cs.xlf index 8f0ed3439625e..d3c7e8b325e74 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.cs.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.cs.xlf @@ -692,9 +692,9 @@ Zobrazovat návr_hy názvů - - Generate Event Subscription Command Handler - Generate Event Subscription Command Handler + + Generate Event Subscription + Generate Event Subscription diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.de.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.de.xlf index f70e7495cfd8d..dd541f92187e5 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.de.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.de.xlf @@ -692,9 +692,9 @@ Namensv_orschläge anzeigen - - Generate Event Subscription Command Handler - Generate Event Subscription Command Handler + + Generate Event Subscription + Generate Event Subscription diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.es.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.es.xlf index dffdb8c71b4f6..7d91be6f1e8b1 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.es.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.es.xlf @@ -692,9 +692,9 @@ Mostrar s_ugerencias de nombres - - Generate Event Subscription Command Handler - Generate Event Subscription Command Handler + + Generate Event Subscription + Generate Event Subscription diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.fr.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.fr.xlf index 9a309896f2938..9cc8ac1995051 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.fr.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.fr.xlf @@ -692,9 +692,9 @@ Afficher les s_uggestions de nom - - Generate Event Subscription Command Handler - Generate Event Subscription Command Handler + + Generate Event Subscription + Generate Event Subscription diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.it.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.it.xlf index cece8b5fe2b48..61a5627d1ca4b 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.it.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.it.xlf @@ -692,9 +692,9 @@ Mostra s_uggerimenti per nomi - - Generate Event Subscription Command Handler - Generate Event Subscription Command Handler + + Generate Event Subscription + Generate Event Subscription diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ja.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ja.xlf index 0cf199d428bac..a909aaade748f 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ja.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ja.xlf @@ -692,9 +692,9 @@ 名前の提案を表示(_U) - - Generate Event Subscription Command Handler - Generate Event Subscription Command Handler + + Generate Event Subscription + Generate Event Subscription diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ko.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ko.xlf index 608bd38669a78..962d5b078f013 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ko.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ko.xlf @@ -692,9 +692,9 @@ 이름 제안 표시(_U) - - Generate Event Subscription Command Handler - Generate Event Subscription Command Handler + + Generate Event Subscription + Generate Event Subscription diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pl.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pl.xlf index 7518509e5bc55..896591657188a 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pl.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pl.xlf @@ -692,9 +692,9 @@ Pokaż s_ugestie dotyczące nazwy - - Generate Event Subscription Command Handler - Generate Event Subscription Command Handler + + Generate Event Subscription + Generate Event Subscription diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pt-BR.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pt-BR.xlf index 46b3cfb17915c..8f9de8d72d18a 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pt-BR.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pt-BR.xlf @@ -692,9 +692,9 @@ Mostrar s_ugestões de nomes - - Generate Event Subscription Command Handler - Generate Event Subscription Command Handler + + Generate Event Subscription + Generate Event Subscription diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ru.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ru.xlf index ffe35ead8fc18..f9927d291e36b 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ru.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ru.xlf @@ -692,9 +692,9 @@ Показывать в_арианты имен - - Generate Event Subscription Command Handler - Generate Event Subscription Command Handler + + Generate Event Subscription + Generate Event Subscription diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.tr.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.tr.xlf index ef352ca61d1c2..b11c3f7518ea2 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.tr.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.tr.xlf @@ -692,9 +692,9 @@ Ad ö_nerilerini göster - - Generate Event Subscription Command Handler - Generate Event Subscription Command Handler + + Generate Event Subscription + Generate Event Subscription diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hans.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hans.xlf index 56e33c7cf7756..b6d1f62d22699 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hans.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hans.xlf @@ -692,9 +692,9 @@ 显示名称建议(_U) - - Generate Event Subscription Command Handler - Generate Event Subscription Command Handler + + Generate Event Subscription + Generate Event Subscription diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hant.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hant.xlf index 8416f0e4f8bd2..c07c4064b9b13 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hant.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hant.xlf @@ -692,9 +692,9 @@ 顯示名稱建議(_U) - - Generate Event Subscription Command Handler - Generate Event Subscription Command Handler + + Generate Event Subscription + Generate Event Subscription diff --git a/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyCommandHandler.cs b/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyCommandHandler.cs index 70fa1d5f15695..464d45caf7090 100644 --- a/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyCommandHandler.cs +++ b/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyCommandHandler.cs @@ -26,7 +26,7 @@ internal class CallHierarchyCommandHandler : VSCommanding.ICommandHandler EditorFeaturesResources.View_Call_Hierarchy_Command_Handler; + public string DisplayName => EditorFeaturesResources.Call_Hierarchy; [ImportingConstructor] public CallHierarchyCommandHandler([ImportMany] IEnumerable presenters, CallHierarchyProvider provider) diff --git a/src/VisualStudio/Core/Def/Implementation/Library/ClassView/AbstractSyncClassViewCommandHandler.cs b/src/VisualStudio/Core/Def/Implementation/Library/ClassView/AbstractSyncClassViewCommandHandler.cs index baa8db7493fb3..e1b26a8124132 100644 --- a/src/VisualStudio/Core/Def/Implementation/Library/ClassView/AbstractSyncClassViewCommandHandler.cs +++ b/src/VisualStudio/Core/Def/Implementation/Library/ClassView/AbstractSyncClassViewCommandHandler.cs @@ -22,7 +22,7 @@ internal abstract class AbstractSyncClassViewCommandHandler : ForegroundThreadAf private readonly IServiceProvider _serviceProvider; - public string DisplayName => ServicesVSResources.Sync_Class_View_Command_Handler; + public string DisplayName => ServicesVSResources.Sync_Class_View; protected AbstractSyncClassViewCommandHandler( SVsServiceProvider serviceProvider) diff --git a/src/VisualStudio/Core/Def/Implementation/Snippets/AbstractSnippetCommandHandler.cs b/src/VisualStudio/Core/Def/Implementation/Snippets/AbstractSnippetCommandHandler.cs index c76952fadaa9e..3880c420574b2 100644 --- a/src/VisualStudio/Core/Def/Implementation/Snippets/AbstractSnippetCommandHandler.cs +++ b/src/VisualStudio/Core/Def/Implementation/Snippets/AbstractSnippetCommandHandler.cs @@ -33,7 +33,7 @@ internal abstract class AbstractSnippetCommandHandler : protected readonly IVsEditorAdaptersFactoryService EditorAdaptersFactoryService; protected readonly SVsServiceProvider ServiceProvider; - public string DisplayName => ServicesVSResources.Snippet_Command_Handler; + public string DisplayName => FeaturesResources.Snippets; public AbstractSnippetCommandHandler(IVsEditorAdaptersFactoryService editorAdaptersFactoryService, SVsServiceProvider serviceProvider) { diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs b/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs index d8ae04fe02efa..21b7ef33cc061 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs +++ b/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs @@ -2205,15 +2205,6 @@ internal static string Show_outlining_for_declaration_level_constructs { } } - /// - /// Looks up a localized string similar to Snippet Command Handler. - /// - internal static string Snippet_Command_Handler { - get { - return ResourceManager.GetString("Snippet_Command_Handler", resourceCulture); - } - } - /// /// Looks up a localized string similar to Some naming rules are incomplete. Please complete or remove them.. /// @@ -2314,11 +2305,11 @@ internal static string Symbol_Specification_Title_colon { } /// - /// Looks up a localized string similar to Sync Class View Command Handler. + /// Looks up a localized string similar to Sync Class View. /// - internal static string Sync_Class_View_Command_Handler { + internal static string Sync_Class_View { get { - return ResourceManager.GetString("Sync_Class_View_Command_Handler", resourceCulture); + return ResourceManager.GetString("Sync_Class_View", resourceCulture); } } diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx index 90125c1793d57..74bcdeca15b32 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.resx +++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx @@ -986,11 +986,8 @@ Additional information: {1} Search found no results - - Snippet Command Handler - - - Sync Class View Command Handler + + Sync Class View Restore Visual Studio keybindings diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index 04c556308dd37..52d0dcc21a6e3 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -1498,14 +1498,9 @@ Souhlasím se všemi výše uvedenými podmínkami: The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files. - - Snippet Command Handler - Snippet Command Handler - - - - Sync Class View Command Handler - Sync Class View Command Handler + + Sync Class View + Sync Class View diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index 6b06cc0116a66..c2609f1bb4043 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -1498,14 +1498,9 @@ Ich stimme allen vorstehenden Bedingungen zu: The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files. - - Snippet Command Handler - Snippet Command Handler - - - - Sync Class View Command Handler - Sync Class View Command Handler + + Sync Class View + Sync Class View diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index 4e18cc973139b..343cdaad2fe70 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -1498,14 +1498,9 @@ Estoy de acuerdo con todo lo anterior: The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files. - - Snippet Command Handler - Snippet Command Handler - - - - Sync Class View Command Handler - Sync Class View Command Handler + + Sync Class View + Sync Class View diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index a6e91e27195d6..243004e11a5a6 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -1498,14 +1498,9 @@ Je suis d'accord avec tout ce qui précède : The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files. - - Snippet Command Handler - Snippet Command Handler - - - - Sync Class View Command Handler - Sync Class View Command Handler + + Sync Class View + Sync Class View diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index 8500aa893806b..e84868172c967 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -1498,14 +1498,9 @@ L'utente accetta le condizioni sopra riportate: The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files. - - Snippet Command Handler - Snippet Command Handler - - - - Sync Class View Command Handler - Sync Class View Command Handler + + Sync Class View + Sync Class View diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index afbd48afc02b1..79fca7a4090d7 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -1498,14 +1498,9 @@ I agree to all of the foregoing: The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files. - - Snippet Command Handler - Snippet Command Handler - - - - Sync Class View Command Handler - Sync Class View Command Handler + + Sync Class View + Sync Class View diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index 93543b92cedd6..e0aa9f16f7bd3 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -1498,14 +1498,9 @@ I agree to all of the foregoing: The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files. - - Snippet Command Handler - Snippet Command Handler - - - - Sync Class View Command Handler - Sync Class View Command Handler + + Sync Class View + Sync Class View diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index 6b96c973d64b1..5dd4f2fb515e1 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -1498,14 +1498,9 @@ Wyrażam zgodę na wszystkie następujące postanowienia: The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files. - - Snippet Command Handler - Snippet Command Handler - - - - Sync Class View Command Handler - Sync Class View Command Handler + + Sync Class View + Sync Class View diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index 6bda0a4f4bab3..5eed9ea40a19b 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -1498,14 +1498,9 @@ Eu concordo com todo o conteúdo supracitado: The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files. - - Snippet Command Handler - Snippet Command Handler - - - - Sync Class View Command Handler - Sync Class View Command Handler + + Sync Class View + Sync Class View diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index 5b7f0acc5e2b9..c9c96981e1637 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -1498,14 +1498,9 @@ I agree to all of the foregoing: The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files. - - Snippet Command Handler - Snippet Command Handler - - - - Sync Class View Command Handler - Sync Class View Command Handler + + Sync Class View + Sync Class View diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index e01615aa0b8a7..ac2d5020203be 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -1498,14 +1498,9 @@ Aşağıdakilerin tümünü onaylıyorum: The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files. - - Snippet Command Handler - Snippet Command Handler - - - - Sync Class View Command Handler - Sync Class View Command Handler + + Sync Class View + Sync Class View diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index 1dd873c84b32e..b6244b254a767 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -1498,14 +1498,9 @@ I agree to all of the foregoing: The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files. - - Snippet Command Handler - Snippet Command Handler - - - - Sync Class View Command Handler - Sync Class View Command Handler + + Sync Class View + Sync Class View diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index 106db2c789f9a..a2fe6e62e918f 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -1498,14 +1498,9 @@ I agree to all of the foregoing: The settings configured here only apply to your machine. To configure these settings to travel with your solution, use .editorconfig files. - - Snippet Command Handler - Snippet Command Handler - - - - Sync Class View Command Handler - Sync Class View Command Handler + + Sync Class View + Sync Class View From 6e9d56a29c45177a3417e1404140f15622f6226a Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Fri, 2 Feb 2018 15:38:57 -0800 Subject: [PATCH 04/43] Merge dev15.7.x to dev15.7.x-vs-deps (#24598) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove duplicate lock DocumentState.s_syntaxTreeToIdMapLock This lock is only being used to protect access to an instance which contains internal synchronization. * Better handle surrounding directives when inlining a local variable. * Add tests. * Share code between VB and C#. * Reduce allocations in UnboundLambda Fixes #23463 * Restore ReturnInferenceCacheKey as the key for _returnInferenceCache * Update code to more closely follow patterns of the original code * Cleanup from code review * basic fix for intellisense in Immediate window * better comments and cleanup * Add basic integration tests * cleanup inproc Immediate window integration test helper * fix incorrect comment * address PR feedback * create Immediate window on ImmediateWindow_InProc.GetText() * Verify MSBuild version in Developer CMD prompt Roslyn is designed to have the simplest possible contribution story: clone then build. Every pre-req needed is either located on the machine or bootstrapped via NuGet. All the way down to using an xcopy MSBuild if needed. The one case which causes a problem is the VS command prompt. In this case MSBuild is pre-installed on the machine and may or may not be suitable for building Roslyn. Previously when building from a VS command prompt we just used whatever MSBuild was provided. The assumption being a developer command prompt was an explicit statement of whath MSBuild you wanted to use. Based on all of our customer reports though this does not seem to be the assumption that consumers of our repo have. The build gave them no explicit errors about the provided toolset and hence when the build failed they assigned flakiness to our repo. Going forward we are applying the same version validation to MSBuild when provided via a developer command prompt. If it doesn't match we will refuse to build asking the user to upgrade VS or build from a normal command prompt. * Remove unneeded debugging line * Comment about pre-release * Added minimum version * Add Omit If Default style option * Add space to be like test without the omit * Add/Remove without needing a property * Reformat * PR feedback * Fix VB diagnostic based on feedback * Handle case of NotApplicable modifier and field declaration list * Fix tests * PR feedback * PR feedback * PreviewCodeAction was overriding ComputeOperations but returning a post-processed operation from original action. This results in another PostProcess being called on the codeaction. If postprocess was overriden in originalaction that'll be ignored the second time (#23920) * Support negative null-check when we are suggesting to inline type checks Fixes #21097 Fixes #24286 * fix a case where persistent storage registration fails and some clean… (#24458) * fix a case where persistent storage registration fails and some clean up code around it. * added readonly * address PR feedback * removed comments no longer relevant * renamed lock name * moved waiter from diagnostics.dll to features.dll where all interfaces are defined. (#24512) * put listener change back in (https://github.com/dotnet/roslyn/pull/24120) * leave old types in legacy folder until partner teams move to new interface * added legacy waiter to support partner teams * Remove methods indirecting access to _metadataFileNameToConvertedProjectReference This field is documented as being written and read from any thread, but in practice all uses are guarded by an AssertIsForeground(). Thus we can get rid of the helper methods that are trying to "help" by locking before accessing the fields, making it really hard to track all the real uses of it. * Make method static that doesn't need state * add a comment to address PR feedback * Fix up tests of P2P to metadata reference conversion It turns out we had some tests, but the tests were disabled. This was because the tests weren't working properly anyways: they were calling into UpdateProjectBinPath which only updated some (but not all) of the project state. That was an internal helper method that shouldn't be used by tests. Updating the tests to use SetBinOutputPathAndRelatedData works better. * Delete debug-only reference validation This was some legacy code that tried to verify that the references we have from the project system match up to what DTE and other sources say. This was debug-only, and the actual asserts were commented out. This is deadweight at this point, so delete it. * added and cleaned up logs around build and live diagnostics. (#24551) also added RoslynActivityLogger that can be enabled through project-system-tool * Avoid closure allocations on the BindSyntaxTreeToId fast path * CS1628 error text mentions in parameters; fixes #24584 * Small cleanup of completion logic. * Move to xunit.console for CoreClr tests Previously we were using xunit.console for desktop tests and dotnet-xunit for our CoreClr tests. This change unifies us on top of xunit.console (now that it has a netcoreapp2.0 version available). * Move unix builds to xunit.runner.console as well * Get actual directory name, not file * Fix dir name issue * fixed build break --- build/Targets/Tools.props | 1 + build/scripts/build-utils.ps1 | 33 +- build/scripts/build.ps1 | 2 +- build/scripts/tests.sh | 4 +- .../Portable/BoundTree/UnboundLambda.cs | 32 +- .../Portable/CSharpResources.Designer.cs | 2 +- .../CSharp/Portable/CSharpResources.resx | 2 +- .../Portable/Syntax/SyntaxNodeRemover.cs | 18 +- .../Portable/xlf/CSharpResources.cs.xlf | 4 +- .../Portable/xlf/CSharpResources.de.xlf | 4 +- .../Portable/xlf/CSharpResources.es.xlf | 4 +- .../Portable/xlf/CSharpResources.fr.xlf | 4 +- .../Portable/xlf/CSharpResources.it.xlf | 4 +- .../Portable/xlf/CSharpResources.ja.xlf | 4 +- .../Portable/xlf/CSharpResources.ko.xlf | 4 +- .../Portable/xlf/CSharpResources.pl.xlf | 4 +- .../Portable/xlf/CSharpResources.pt-BR.xlf | 4 +- .../Portable/xlf/CSharpResources.ru.xlf | 4 +- .../Portable/xlf/CSharpResources.tr.xlf | 4 +- .../Portable/xlf/CSharpResources.zh-Hans.xlf | 4 +- .../Portable/xlf/CSharpResources.zh-Hant.xlf | 4 +- .../Test/Syntax/Syntax/SyntaxNodeTests.cs | 145 +++++++ .../Syntax/CommonSyntaxNodeRemover.cs | 48 +++ .../Portable/Syntax/SyntaxNodeRemover.vb | 17 +- .../Test/Syntax/TestSyntaxNodes.vb | 29 ++ .../EncapsulateFieldCommandHandler.cs | 4 +- .../AddAccessibilityModifiersTests.cs | 166 ++++++++ .../Classification/SemanticClassifierTests.cs | 18 +- .../Classification/SyntacticTaggerTests.cs | 2 +- .../InlineTemporary/InlineTemporaryTests.cs | 6 +- .../EncapsulateFieldCommandHandlerTests.cs | 2 +- .../EncapsulateFieldTestState.cs | 2 +- .../InteractiveBraceHighlightingTests.cs | 2 +- .../CSharpTest/NavigateTo/NavigateToTests.cs | 4 +- .../CSharpAsAndNullCheckTests.cs | 340 +++++++++-------- .../CSharpAsAndNullCheckTests_FixAllTests.cs | 4 +- .../CSharpTest/Workspaces/WorkspaceTests.cs | 20 +- .../AbstractAdornmentManagerProvider.cs | 6 +- .../InlineRename/InlineRenameService.cs | 8 +- .../LineSeparatorAdornmentManagerProvider.cs | 4 +- .../LineSeparatorTaggerProvider.cs | 4 +- .../NavigateToItemProviderFactory.cs | 9 +- .../AbstractStructureTaggerProvider.cs | 10 +- .../VisualStudio14StructureTaggerProvider.cs | 4 +- .../VisualStudio15StructureTaggerProvider.cs | 4 +- .../FixAll/FixMultipleOccurrencesService.cs | 8 +- .../SuggestedActionsSourceProvider.cs | 4 +- ...uickInfoCommandHandlerAndSourceProvider.cs | 17 +- .../SignatureHelpCommandHandler.cs | 15 +- .../FindReferencesCommandHandler.cs | 7 +- .../BraceHighlightingViewTaggerProvider.cs | 4 +- ...anticClassificationBufferTaggerProvider.cs | 4 +- ...emanticClassificationViewTaggerProvider.cs | 6 +- .../SyntacticClassificationTaggerProvider.cs | 9 +- ...tractDiagnosticsAdornmentTaggerProvider.cs | 4 +- ...DiagnosticsClassificationTaggerProvider.cs | 4 +- .../DiagnosticsSquiggleTaggerProvider.cs | 4 +- .../DiagnosticsSuggestionTaggerProvider.cs | 4 +- .../AbstractEncapsulateFieldCommandHandler.cs | 6 +- .../Completion/AsyncCompletionService.cs | 17 +- .../HighlighterViewTaggerProvider.cs | 4 +- .../NavigationBarControllerFactoryService.cs | 6 +- .../RenameTrackingTaggerProvider.cs | 4 +- .../Workspaces/EditorTaskSchedulerFactory.cs | 8 +- ...ReferenceHighlightingViewTaggerProvider.cs | 6 +- .../Diagnostics/DiagnosticServiceTests.cs | 4 +- .../DiagnosticsSquiggleTaggerProviderTests.cs | 20 +- ...tAndContinueDiagnosticUpdateSourceTests.cs | 2 +- .../LineSeparators/AdornmentManagerTests.cs | 5 +- .../Test/Preview/PreviewWorkspaceTests.cs | 13 +- .../RenameTracking/RenameTrackingTestState.cs | 13 +- .../RenameTracking/RenameTrackingWaiter.cs | 15 - .../SolutionCrawler/WorkCoordinatorTests.cs | 50 +-- .../Test/Structure/StructureTaggerTests.cs | 2 +- .../Test/Tagging/AsynchronousTaggerTests.cs | 9 +- .../Test/Threading/AsynchronousWorkerTests.cs | 15 +- .../AsynchronousOperationListenerTests.cs | 22 +- .../Classification/ClassificationTests.vb | 9 +- .../FindReferencesCommandHandlerTests.vb | 11 +- .../IntelliSense/QuickInfoControllerTests.vb | 6 +- .../SignatureHelpControllerTests.vb | 8 +- .../AbstractKeywordHighlightingTests.vb | 2 +- .../NavigationBarPresenterTests.vb | 37 +- .../AbstractReferenceHighlightingTests.vb | 2 +- .../Test2/Rename/DashboardTests.vb | 3 - .../Test2/Rename/RenameTestHelpers.vb | 10 +- .../Test2/Rename/RenameWaiter.vb | 14 - .../AbstractCommandHandlerTestState.cs | 8 +- ...AsynchronousOperationListenerExtensions.cs | 16 + .../AbstractBraceHighlightingTests.cs | 2 +- .../Diagnostics/DiagnosticTaggerWrapper.cs | 19 +- .../EventHookup/EventHookupWaiter.cs | 15 - .../MinimalTestExportProvider.cs | 4 + .../NavigateTo/AbstractNavigateToTests.cs | 4 +- .../TestUtilities/TestExportProvider.cs | 1 + .../Intellisense/CompletionWaiter.vb | 15 - .../Intellisense/SignatureHelpWaiter.vb | 15 - .../TestUtilities2/Intellisense/TestState.vb | 15 +- .../EncapsulateFieldCommandHandler.vb | 4 +- .../AddAccessibilityModifiersTests.vb | 232 +++++++++++- .../BraceMatching/BraceHighlightingTests.vb | 2 +- .../EncapsulateFieldCommandHandlerTests.vb | 2 +- .../EncapsulateFieldTestState.vb | 2 +- .../QuickInfo/SemanticQuickInfoSourceTests.vb | 7 - .../ExpressionCompilerTests.cs | 2 +- ...ccessibilityModifiersDiagnosticAnalyzer.cs | 54 ++- .../InlineTemporaryCodeRefactoringProvider.cs | 9 +- .../CSharpAsAndNullCheckCodeFixProvider.cs | 10 +- .../CSharpAsAndNullCheckDiagnosticAnalyzer.cs | 190 ++++++---- ...ddAccessibilityModifiersCodeFixProvider.cs | 7 +- .../Diagnostics/DiagnosticAnalyzerService.cs | 6 +- .../Portable/Diagnostics/DiagnosticService.cs | 4 +- .../DiagnosticIncrementalAnalyzer.Executor.cs | 79 ++-- .../EngineV2/DiagnosticIncrementalAnalyzer.cs | 12 +- ...ncrementalAnalyzer_BuildSynchronization.cs | 88 +++-- ...synchronousOperationListener.AsyncToken.cs | 2 +- ...sOperationListener.DiagnosticAsyncToken.cs | 4 +- .../AsynchronousOperationListener.cs | 46 +-- .../IAsynchronousOperationListenerProvider.cs | 227 +++++++++++ .../TestHooks/IAsynchronousOperationWaiter.cs | 56 --- .../AggregateAsynchronousOperationListener.cs | 0 .../Legacy/AsynchronousOperationListener.cs | 30 ++ .../{ => Legacy}/FeatureAttribute.cs | 0 .../TestHooks/{ => Legacy}/FeatureMetadata.cs | 0 .../SolutionCrawlerRegistrationService.cs | 4 +- .../WorkCoordinator.HighPriorityProcessor.cs | 2 +- ...oordinator.IncrementalAnalyzerProcessor.cs | 2 +- .../WorkCoordinator.LowPriorityProcessor.cs | 2 +- ...WorkCoordinator.NormalPriorityProcessor.cs | 2 +- .../WorkCoordinator.WorkItem.cs | 6 + .../ProjectCacheService.SimpleMRUCache.cs | 2 +- ...ccessibilityModifiersDiagnosticAnalyzer.vb | 47 ++- .../CSharpTest/CommandLineRunnerTests.cs | 5 +- .../Diagnostics/TestingOnly_WaitingService.cs | 97 ++--- .../Waiters/AutomaticCompletionWaiter.cs | 13 - .../AutomaticEndConstructCorrectionWaiter.cs | 13 - .../Waiters/BraceHighlightingWaiter.cs | 13 - .../Waiters/ClassificationWaiter.cs | 13 - .../Waiters/CompletionSetWaiter.cs | 13 - .../Waiters/DesignerAttributeWaiter.cs | 13 - .../Waiters/DiagnosticServiceWaiter.cs | 13 - .../Waiters/EditorAdornmentWaiter.cs | 26 -- .../Waiters/EncapsulateFieldWaiter.cs | 13 - .../Diagnostics/Waiters/ErrorListWaiter.cs | 13 - .../Waiters/ErrorSquiggleWaiter.cs | 13 - .../Diagnostics/Waiters/EventHookupWaiter.cs | 13 - .../Waiters/FindReferencesWaiter.cs | 13 - .../Waiters/GlobalOperationWatier.cs | 13 - .../Waiters/GraphProviderWaiter.cs | 15 - .../Waiters/KeywordHighlightingWaiter.cs | 13 - .../Diagnostics/Waiters/LightBulbWaiter.cs | 13 - .../Waiters/LineSeparatorWaiter.cs | 15 - .../Diagnostics/Waiters/NavigateToWaiter.cs | 13 - .../Waiters/NavigationBarWaiter.cs | 13 - .../Diagnostics/Waiters/OutliningWaiter.cs | 13 - .../Diagnostics/Waiters/QuickInfoWaiter.cs | 13 - .../Waiters/ReferenceHighlightingWaiter.cs | 13 - .../Waiters/RemoteHostClientWaiter.cs | 13 - src/Test/Diagnostics/Waiters/RenameWaiter.cs | 13 - .../Waiters/SignatureHelpWaiter.cs | 13 - src/Test/Diagnostics/Waiters/SnippetWaiter.cs | 13 - .../Waiters/SolutionCrawlerWaiter.cs | 13 - .../Waiters/TodoCommentListWaiter.cs | 13 - .../Diagnostics/Waiters/WorkspaceWaiter.cs | 13 - .../Diagnostics/Waiters_Legacy/WaiterBase.cs | 41 ++ .../Diagnostics/Waiters_Legacy/Waiters.cs | 355 ++++++++++++++++++ .../Portable/Compilation/RuntimeUtilities.cs | 15 + .../Portable/Metadata/IlasmUtilities.cs | 4 +- .../EventHookup/EventHookupCommandHandler.cs | 6 +- .../EventHookup/EventHookupSessionManager.cs | 2 +- .../Impl/Progression/CSharpGraphProvider.cs | 4 +- .../Impl/Snippets/CSharpSnippetInfoService.cs | 4 +- .../Test/EventHookup/EventHookupTestState.cs | 4 +- .../LegacyProject/CSharpReferencesTests.cs | 55 ++- .../CallHierarchy/CallHierarchyProvider.cs | 4 +- .../DesignerAttributeIncrementalAnalyzer.cs | 4 +- ...nerAttributeIncrementalAnalyzerProvider.cs | 8 +- .../InfoBar/VisualStudioInfoBarService.cs | 4 +- .../Progression/GraphProvider.cs | 4 +- .../Progression/GraphQueryManager.cs | 2 +- .../ProjectSystem/AbstractProject.cs | 92 +---- .../Legacy/AbstractLegacyProject.cs | 89 ----- .../VisualStudioRuleSetManagerFactory.cs | 4 +- .../VisualStudioProjectTracker.cs | 2 +- .../Remote/RemoteHostClientServiceFactory.cs | 4 +- .../Snippets/AbstractSnippetInfoService.cs | 6 +- ...DiagnosticListTable.LiveTableDataSource.cs | 4 +- .../ExternalErrorDiagnosticUpdateSource.cs | 39 +- ...obalOperationNotificationServiceFactory.cs | 4 +- .../VisualStudioTaskSchedulerFactory.cs | 4 +- .../Core/Def/RoslynActivityLogger.cs | 92 +++++ .../CodeModel/CodeModelIncrementalAnalyzer.cs | 4 +- .../Core/Test.Next/Mocks/TestHostServices.cs | 17 +- .../RemoteHostClientServiceFactoryTests.cs | 18 +- .../TestCSharpSnippetInfoService.vb | 4 +- .../TestVisualBasicSnippetInfoService.vb | 4 +- .../DebuggerIntelliSense/CompletionWaiter.vb | 16 - .../SignatureHelpWaiter.vb | 16 - .../Test/DebuggerIntelliSense/TestState.vb | 8 +- .../DefaultDiagnosticUpdateSourceTests.vb | 59 ++- .../DiagnosticTableDataSourceTests.vb | 23 +- .../ExternalDiagnosticUpdateSourceTests.vb | 18 +- .../VisualBasicSpecialReferencesTests.vb | 8 +- .../VisualStudioRuleSetTests.vb | 12 +- .../Test/Snippets/SnippetServiceWaiter.vb | 15 - .../Core/Test/Snippets/SnippetTestState.vb | 5 +- .../CSharp/CSharpKeywordHighlighting.cs | 12 +- .../CSharp/CSharpReferenceHighlighting.cs | 22 +- .../VisualBasic/BasicKeywordHighlighting.cs | 14 +- .../VisualBasic/BasicReferenceHighlighting.cs | 22 +- .../InProcess/VisualStudioWorkspace_InProc.cs | 26 +- .../VisualStudioWorkspace_OutOfProc.cs | 4 +- .../Framework/TestEnvironment.vb | 2 +- .../Progression/VisualBasicGraphProvider.vb | 4 +- .../ProjectSystemShim/VisualBasicProject.vb | 8 - .../Snippets/VisualBasicSnippetInfoService.vb | 4 +- .../CSharpRecommendationService.cs | 16 +- .../Storage/PersistentStorageService.cs | 205 ++++++---- .../AccessibilityModifiersRequired.cs | 6 + .../Portable/CodeStyle/CodeStyleOptions.cs | 2 + .../Core/Portable/Log/FunctionId.cs | 2 + .../Core/Portable/Log/KeyValueLogMessage.cs | 13 +- .../SolutionCrawler/InvocationReasons.cs | 5 + .../Workspace/Solution/DocumentState.cs | 23 +- .../Remote/Core/Services/AssetService.cs | 3 +- .../ServiceHub/Services/RemoteHostService.cs | 5 +- .../VisualBasicSyntaxGenerator.vb | 7 + 227 files changed, 2754 insertions(+), 1916 deletions(-) create mode 100644 src/Compilers/Core/Portable/Syntax/CommonSyntaxNodeRemover.cs delete mode 100644 src/EditorFeatures/Test/RenameTracking/RenameTrackingWaiter.cs delete mode 100644 src/EditorFeatures/Test2/Rename/RenameWaiter.vb create mode 100644 src/EditorFeatures/TestUtilities/AsynchronousOperationListenerExtensions.cs delete mode 100644 src/EditorFeatures/TestUtilities/EventHookup/EventHookupWaiter.cs delete mode 100644 src/EditorFeatures/TestUtilities2/Intellisense/CompletionWaiter.vb delete mode 100644 src/EditorFeatures/TestUtilities2/Intellisense/SignatureHelpWaiter.vb create mode 100644 src/Features/Core/Portable/Shared/TestHooks/IAsynchronousOperationListenerProvider.cs rename src/Features/Core/Portable/Shared/TestHooks/{ => Legacy}/AggregateAsynchronousOperationListener.cs (100%) create mode 100644 src/Features/Core/Portable/Shared/TestHooks/Legacy/AsynchronousOperationListener.cs rename src/Features/Core/Portable/Shared/TestHooks/{ => Legacy}/FeatureAttribute.cs (100%) rename src/Features/Core/Portable/Shared/TestHooks/{ => Legacy}/FeatureMetadata.cs (100%) delete mode 100644 src/Test/Diagnostics/Waiters/AutomaticCompletionWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/AutomaticEndConstructCorrectionWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/BraceHighlightingWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/ClassificationWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/CompletionSetWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/DesignerAttributeWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/DiagnosticServiceWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/EditorAdornmentWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/EncapsulateFieldWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/ErrorListWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/ErrorSquiggleWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/EventHookupWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/FindReferencesWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/GlobalOperationWatier.cs delete mode 100644 src/Test/Diagnostics/Waiters/GraphProviderWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/KeywordHighlightingWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/LightBulbWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/LineSeparatorWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/NavigateToWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/NavigationBarWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/OutliningWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/QuickInfoWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/ReferenceHighlightingWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/RemoteHostClientWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/RenameWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/SignatureHelpWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/SnippetWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/SolutionCrawlerWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/TodoCommentListWaiter.cs delete mode 100644 src/Test/Diagnostics/Waiters/WorkspaceWaiter.cs create mode 100644 src/Test/Diagnostics/Waiters_Legacy/WaiterBase.cs create mode 100644 src/Test/Diagnostics/Waiters_Legacy/Waiters.cs create mode 100644 src/VisualStudio/Core/Def/RoslynActivityLogger.cs delete mode 100644 src/VisualStudio/Core/Test/DebuggerIntelliSense/CompletionWaiter.vb delete mode 100644 src/VisualStudio/Core/Test/DebuggerIntelliSense/SignatureHelpWaiter.vb delete mode 100644 src/VisualStudio/Core/Test/Snippets/SnippetServiceWaiter.vb diff --git a/build/Targets/Tools.props b/build/Targets/Tools.props index f0a91fd189bf3..d7ea1e60a1e55 100644 --- a/build/Targets/Tools.props +++ b/build/Targets/Tools.props @@ -6,5 +6,6 @@ 2.2.0-preview1-007622 4.3.0 5.8.0.88 + 15.3 diff --git a/build/scripts/build-utils.ps1 b/build/scripts/build-utils.ps1 index e059790f2a2ee..88cabf7fd2dff 100644 --- a/build/scripts/build-utils.ps1 +++ b/build/scripts/build-utils.ps1 @@ -312,15 +312,22 @@ function Get-MSBuildKindAndDir([switch]$xcopy = $false) { return } - # MSBuild from an active VS command prompt. + # MSBuild from an active VS command prompt. Use the MSBuild here so long as it's from a + # compatible Visual Studio. If not though throw and error out. Given the number of + # environment variable changes in a developer command prompt it's hard to make guarantees + # about subbing in a new MSBuild instance if (${env:VSINSTALLDIR} -ne $null) { $command = (Get-Command msbuild -ErrorAction SilentlyContinue) - if ($command -ne $null) { + if ((Test-SupportedVisualStudioVersion ${env:VSCMD_VER}) -and ($command -ne $null) ) { $p = Split-Path -parent $command.Path Write-Output "vscmd" Write-Output $p return } + else { + $vsMinimumVersion = Get-ToolVersion "vsMinimum" + throw "Developer Command Prompt for VS $(${env:VSCMD_VER}) is not recent enough. Please upgrade to {$vsMinimumVersion} or build from a normal CMD window" + } } # Look for a valid VS installation @@ -353,6 +360,22 @@ function Get-MSBuildDir([switch]$xcopy = $false) { return $both[1] } + +# Dose this version of Visual Studio meet our minimum requirements for building. +function Test-SupportedVisualStudioVersion([string]$version) { + # This regex allows us to strip off any pre-release info that gets attached + # to the version string. VS uses NuGet style pre-release by suffing version + # with - + if (-not ($version -match "^([\d.]+)(\+|-)?.*$")) { + return $false + } + + $vsMinimumVersion = Get-ToolVersion "vsMinimum" + $V = New-Object System.Version $matches[1] + $min = New-Object System.Version $vsMinimumVersion + return $v -ge $min; +} + # Get the directory and instance ID of the first Visual Studio version which # meets our minimal requirements for the Roslyn repo. function Get-VisualStudioDirAndId() { @@ -365,10 +388,8 @@ function Get-VisualStudioDirAndId() { # set of SDK fixes. Parsing the installationName is the only place where this is # recorded in that form. $name = $obj.installationName - if ($name -match "VisualStudio(Preview)?/([\d.]+)(\+|-).*") { - $minVersion = New-Object System.Version "15.3.0" - $version = New-Object System.Version $matches[2] - if ($version -ge $minVersion) { + if ($name -match "VisualStudio(Preview)?/(.*)") { + if (Test-SupportedVisualStudioVersion $matches[2]) { Write-Output $obj.installationPath Write-Output $obj.instanceId return diff --git a/build/scripts/build.ps1 b/build/scripts/build.ps1 index 69a24caecf272..ac4ed290a8274 100644 --- a/build/scripts/build.ps1 +++ b/build/scripts/build.ps1 @@ -393,7 +393,7 @@ function Test-XUnitCoreClr() { $tf = "netcoreapp2.0" $logDir = Join-Path $unitDir "xUnitResults" Create-Directory $logDir - $xunitConsole = Join-Path (Get-PackageDir "dotnet-xunit") "tools\$tf\xunit.console.dll" + $xunitConsole = Join-Path (Get-PackageDir "xunit.runner.console") "tools\$tf\xunit.console.dll" $dlls = @() $allGood = $true diff --git a/build/scripts/tests.sh b/build/scripts/tests.sh index 1e4e595d6e0ed..1613f5c61b933 100755 --- a/build/scripts/tests.sh +++ b/build/scripts/tests.sh @@ -20,11 +20,11 @@ xunit_console_version="$(get_package_version dotnet-xunit)" if [[ "${runtime}" == "dotnet" ]]; then target_framework=netcoreapp2.0 - xunit_console="${nuget_dir}"/dotnet-xunit/"${xunit_console_version}"/tools/${target_framework}/xunit.console.dll + xunit_console="${nuget_dir}"/xunit.runner.console/"${xunit_console_version}"/tools/${target_framework}/xunit.console.dll elif [[ "${runtime}" == "mono" ]]; then source ${root_path}/build/scripts/obtain_mono.sh target_framework=net461 - xunit_console="${nuget_dir}"/dotnet-xunit/"${xunit_console_version}"/tools/net452/xunit.console.exe + xunit_console="${nuget_dir}"/xunit.runner.console/"${xunit_console_version}"/tools/net452/xunit.console.exe else echo "Unknown runtime: ${runtime}" exit 1 diff --git a/src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs b/src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs index 73a4462b828d1..292e1ea205607 100644 --- a/src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs +++ b/src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs @@ -298,9 +298,16 @@ internal abstract class UnboundLambdaState { private UnboundLambda _unboundLambda; // we would prefer this readonly, but we have an initialization cycle. protected readonly Binder binder; - private readonly ConcurrentDictionary _bindingCache = new ConcurrentDictionary(); - private readonly ConcurrentDictionary _returnInferenceCache = new ConcurrentDictionary(); + [PerformanceSensitive( + "https://github.com/dotnet/roslyn/issues/23582", + Constraint = "Avoid " + nameof(ConcurrentDictionary) + " which has a large default size, but this cache is normally small.")] + private ImmutableDictionary _bindingCache = ImmutableDictionary.Empty; + + [PerformanceSensitive( + "https://github.com/dotnet/roslyn/issues/23582", + Constraint = "Avoid " + nameof(ConcurrentDictionary) + " which has a large default size, but this cache is normally small.")] + private ImmutableDictionary _returnInferenceCache = ImmutableDictionary.Empty; private BoundLambda _errorBinding; @@ -346,7 +353,7 @@ public BoundLambda Bind(NamedTypeSymbol delegateType) if (!_bindingCache.TryGetValue(delegateType, out result)) { result = ReallyBind(delegateType); - _bindingCache.TryAdd(delegateType, result); + result = ImmutableInterlocked.GetOrAdd(ref _bindingCache, delegateType, result); } return result; @@ -560,7 +567,7 @@ public BoundLambda BindForReturnTypeInference(NamedTypeSymbol delegateType) if (!_returnInferenceCache.TryGetValue(cacheKey, out result)) { result = ReallyInferReturnType(delegateType, cacheKey.ParameterTypes, cacheKey.ParameterRefKinds); - _returnInferenceCache.TryAdd(cacheKey, result); + result = ImmutableInterlocked.GetOrAdd(ref _returnInferenceCache, cacheKey, result); } return result; @@ -704,28 +711,29 @@ private BoundLambda ReallyBindForErrorRecovery() // and bind. return - GuessBestBoundLambda(_bindingCache.Values) - ?? GuessBestBoundLambda(_returnInferenceCache.Values) + GuessBestBoundLambda(_bindingCache) + ?? GuessBestBoundLambda(_returnInferenceCache) ?? ReallyInferReturnType(null, ImmutableArray.Empty, ImmutableArray.Empty); } - private static BoundLambda GuessBestBoundLambda(ICollection candidates) + private static BoundLambda GuessBestBoundLambda(ImmutableDictionary candidates) { switch (candidates.Count) { case 0: return null; case 1: - return candidates.First(); + return candidates.First().Value; default: // Prefer candidates with fewer diagnostics. - IEnumerable minDiagnosticsGroup = candidates.GroupBy(lambda => lambda.Diagnostics.Length).OrderBy(group => group.Key).First(); + IEnumerable> minDiagnosticsGroup = candidates.GroupBy(lambda => lambda.Value.Diagnostics.Length).OrderBy(group => group.Key).First(); // If multiple candidates have the same number of diagnostics, order them by delegate type name. // It's not great, but it should be stable. return minDiagnosticsGroup - .OrderBy(lambda => GetLambdaSortString(lambda.Symbol)) - .FirstOrDefault(); + .OrderBy(lambda => GetLambdaSortString(lambda.Value.Symbol)) + .FirstOrDefault() + .Value; } } @@ -779,7 +787,7 @@ public bool GenerateSummaryErrors(DiagnosticBag diagnostics) // two errors; we can for example simply take the one that is lower in alphabetical // order when converted to a string. - var convBags = from boundLambda in _bindingCache.Values select boundLambda.Diagnostics; + var convBags = from boundLambda in _bindingCache select boundLambda.Value.Diagnostics; var retBags = from boundLambda in _returnInferenceCache.Values select boundLambda.Diagnostics; var allBags = convBags.Concat(retBags); diff --git a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs index 2010878cbe3e1..ad4ccc32a129d 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs +++ b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs @@ -377,7 +377,7 @@ internal static string ERR_AmbiguousAttribute { } /// - /// Looks up a localized string similar to Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression. + /// Looks up a localized string similar to Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression. /// internal static string ERR_AnonDelegateCantUse { get { diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx index b0d3343e7660d..610aafe8f7426 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.resx +++ b/src/Compilers/CSharp/Portable/CSharpResources.resx @@ -2754,7 +2754,7 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep Expression expected after yield return - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression Unsafe code may not appear in iterators diff --git a/src/Compilers/CSharp/Portable/Syntax/SyntaxNodeRemover.cs b/src/Compilers/CSharp/Portable/Syntax/SyntaxNodeRemover.cs index 5f319089d9423..324f7df8acd5e 100644 --- a/src/Compilers/CSharp/Portable/Syntax/SyntaxNodeRemover.cs +++ b/src/Compilers/CSharp/Portable/Syntax/SyntaxNodeRemover.cs @@ -203,7 +203,7 @@ public override SeparatedSyntaxList VisitList(SeparatedSyntaxList< } else { - var node = (TNode)(SyntaxNode)item.AsNode(); + var node = (TNode)item.AsNode(); if (this.IsForRemoval(node)) { @@ -213,16 +213,20 @@ public override SeparatedSyntaxList VisitList(SeparatedSyntaxList< alternate.Add(withSeps, 0, i); } - if (alternate.Count > 0 && alternate[alternate.Count - 1].IsToken) + CommonSyntaxNodeRemover.GetSeparatorInfo( + withSeps, i, (int)SyntaxKind.EndOfLineTrivia, + out bool nextTokenIsSeparator, out bool nextSeparatorBelongsToNode); + + if (!nextSeparatorBelongsToNode && + alternate.Count > 0 && + alternate[alternate.Count - 1].IsToken) { - // remove preceding separator if any var separator = alternate[alternate.Count - 1].AsToken(); this.AddTrivia(separator, node); alternate.RemoveLast(); } - else if (i + 1 < n && withSeps[i + 1].IsToken) + else if (nextTokenIsSeparator) { - // otherwise remove following separator if any var separator = withSeps[i + 1].AsToken(); this.AddTrivia(node, separator); removeNextSeparator = true; @@ -232,11 +236,11 @@ public override SeparatedSyntaxList VisitList(SeparatedSyntaxList< this.AddTrivia(node); } - visited = default(SyntaxNodeOrToken); + visited = default; } else { - visited = this.VisitListElement((TNode)(SyntaxNode)item.AsNode()); + visited = this.VisitListElement((TNode)item.AsNode()); } } diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf index 6374f21b666a1..8578247af0144 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf @@ -4391,8 +4391,8 @@ Blok catch() po bloku catch (System.Exception e) může zachytit výjimky, kter - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression - Parametr ref nebo out {0} uvnitř anonymní metody, lambda výrazu nebo výrazu dotazu + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression + Parametr ref nebo out {0} uvnitř anonymní metody, lambda výrazu nebo výrazu dotazu diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf index 9853e7756ac64..1fa9abf5a395f 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf @@ -4391,8 +4391,8 @@ Ein catch()-Block nach einem catch (System.Exception e)-Block kann nicht-CLS-Aus - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression - Der ref- oder out-Parameter "{0}" kann nicht in einer anonymen Methode, einem Lambdaausdruck oder einem Abfrageausdruck verwendet werden. + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression + Der ref- oder out-Parameter "{0}" kann nicht in einer anonymen Methode, einem Lambdaausdruck oder einem Abfrageausdruck verwendet werden. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf index 346e2560f7da4..5acc1a37bffe6 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf @@ -4391,8 +4391,8 @@ Un bloque catch() después de un bloque catch (System.Exception e) puede abarcar - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression - No se pueden usar los parámetros ref ni out '{0}' dentro de un método anónimo, una expresión lambda ni una expresión de consulta + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression + No se pueden usar los parámetros ref ni out '{0}' dentro de un método anónimo, una expresión lambda ni una expresión de consulta diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf index 982dd7f7c742b..ff15e09fe5de6 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf @@ -4391,8 +4391,8 @@ Un bloc catch() après un bloc catch (System.Exception e) peut intercepter des e - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression - Impossible d'utiliser le paramètre ref ou out '{0}' dans une méthode anonyme, une expression lambda ou une expression de requête + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression + Impossible d'utiliser le paramètre ref ou out '{0}' dans une méthode anonyme, une expression lambda ou une expression de requête diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf index a419ea59e8a0f..19091f8fdcdf5 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf @@ -4391,8 +4391,8 @@ Un blocco catch() dopo un blocco catch (System.Exception e) è in grado di rilev - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression - Non è possibile usare il parametro out o ref '{0}' all'interno di un metodo anonimo, un'espressione lambda o un'espressione di query + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression + Non è possibile usare il parametro out o ref '{0}' all'interno di un metodo anonimo, un'espressione lambda o un'espressione di query diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf index 6fbc5075bacdc..ada6d3662cfbc 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf @@ -4391,8 +4391,8 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression - ref または out パラメーター '{0}' は、匿名メソッド、ラムダ式、またはクエリ式の内部では使用できません。 + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression + ref または out パラメーター '{0}' は、匿名メソッド、ラムダ式、またはクエリ式の内部では使用できません。 diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf index 78997f9214e49..3412f707871b6 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf @@ -4391,8 +4391,8 @@ catch (System.Exception e) 블록 뒤의 catch() 블록은 RuntimeCompatibilityA - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression - 무명 메서드, 람다 식 또는 쿼리 식 안에서는 ref 또는 out 매개 변수 '{0}'을(를) 사용할 수 없습니다. + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression + 무명 메서드, 람다 식 또는 쿼리 식 안에서는 ref 또는 out 매개 변수 '{0}'을(를) 사용할 수 없습니다. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf index 40177a53f54a8..3d63549c25994 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf @@ -4391,8 +4391,8 @@ Blok catch() po bloku catch (System.Exception e) może przechwytywać wyjątki n - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression - Nie można użyć parametru ref ani out „{0}” wewnątrz metody anonimowej, wyrażenia lambda lub wyrażenia zapytania + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression + Nie można użyć parametru ref ani out „{0}” wewnątrz metody anonimowej, wyrażenia lambda lub wyrażenia zapytania diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf index 8abc9adca0aa1..6309f1f8b5ac1 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf @@ -4391,8 +4391,8 @@ Um bloco catch() depois de um bloco catch (System.Exception e) poderá capturar - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression - Não é possível usar parâmetro ref ou out "{0}" dentro de um método anônimo, expressão lambda ou expressão de consulta + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression + Não é possível usar parâmetro ref ou out "{0}" dentro de um método anônimo, expressão lambda ou expressão de consulta diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf index 05c2859ed58cb..4c034bf19f40b 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf @@ -4391,8 +4391,8 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression - Нельзя использовать параметр "{0}" с ключевым словом ref или out внутри анонимного метода, лямбда-выражения или выражения запроса. + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression + Нельзя использовать параметр "{0}" с ключевым словом ref или out внутри анонимного метода, лямбда-выражения или выражения запроса. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf index d5bf20d41745f..8b52959fe02d6 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf @@ -4391,8 +4391,8 @@ RuntimeCompatibilityAttribute AssemblyInfo.cs dosyasında false olarak ayarlanm - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression - Anonim yöntem, lambda ifadesi veya sorgu ifadesi içinde '{0}' ref veya out parametresi kullanılamaz + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression + Anonim yöntem, lambda ifadesi veya sorgu ifadesi içinde '{0}' ref veya out parametresi kullanılamaz diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf index 093f9f9460009..af75a35d15efc 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf @@ -4391,8 +4391,8 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression - 不能在匿名方法、lambda 表达式或查询表达式中使用 ref 或 out 参数“{0}” + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression + 不能在匿名方法、lambda 表达式或查询表达式中使用 ref 或 out 参数“{0}” diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf index 1c009cd6751c2..200b9635fb7c1 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf @@ -4391,8 +4391,8 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep - Cannot use ref or out parameter '{0}' inside an anonymous method, lambda expression, or query expression - 無法在匿名方法、Lambda 運算式或查詢運算式內使用 ref 或 out 參數 '{0}'。 + Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, or query expression + 無法在匿名方法、Lambda 運算式或查詢運算式內使用 ref 或 out 參數 '{0}'。 diff --git a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNodeTests.cs b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNodeTests.cs index eab3eddcdcaa3..4313345c83012 100644 --- a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNodeTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNodeTests.cs @@ -2186,6 +2186,80 @@ public void TestRemoveNodeInSeparatedList_KeepExteriorTrivia() Assert.Equal("m(a , /* trivia */ c)", text); } + [Fact] + public void TestRemoveNodeInSeparatedList_KeepExteriorTrivia_2() + { + var expr = SyntaxFactory.ParseExpression(@"m(a, b, /* trivia */ +c)"); + + var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf()).FirstOrDefault(); + Assert.NotNull(b); + + var expr2 = expr.RemoveNode(b, SyntaxRemoveOptions.KeepExteriorTrivia); + + var text = expr2.ToFullString(); + Assert.Equal(@"m(a, /* trivia */ +c)", text); + } + + [Fact] + public void TestRemoveNodeInSeparatedList_KeepExteriorTrivia_3() + { + var expr = SyntaxFactory.ParseExpression(@"m(a, b, +/* trivia */ c)"); + + var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf()).FirstOrDefault(); + Assert.NotNull(b); + + var expr2 = expr.RemoveNode(b, SyntaxRemoveOptions.KeepExteriorTrivia); + + var text = expr2.ToFullString(); + Assert.Equal(@"m(a, +/* trivia */ c)", text); + } + + [Fact] + public void TestRemoveNodeInSeparatedList_KeepExteriorTrivia_4() + { + var expr = SyntaxFactory.ParseExpression(@"SomeMethod(/*arg1:*/ a, + /*arg2:*/ b, + /*arg3:*/ c)"); + + var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf()).FirstOrDefault(); + Assert.NotNull(b); + + var expr2 = expr.RemoveNode(b, SyntaxRemoveOptions.KeepExteriorTrivia); + + var text = expr2.ToFullString(); + Assert.Equal(@"SomeMethod(/*arg1:*/ a, + /*arg2:*/ + /*arg3:*/ c)", text); + } + + [Fact] + public void TestRemoveNodeInSeparatedList_KeepExteriorTrivia_5() + { + var expr = SyntaxFactory.ParseExpression(@"SomeMethod(// comment about a + a, + // some comment about b + b, + // some comment about c + c)"); + + var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf()).FirstOrDefault(); + Assert.NotNull(b); + + var expr2 = expr.RemoveNode(b, SyntaxRemoveOptions.KeepExteriorTrivia); + + var text = expr2.ToFullString(); + Assert.Equal(@"SomeMethod(// comment about a + a, + // some comment about b + + // some comment about c + c)", text); + } + [Fact] public void TestRemoveNodeInSeparatedList_KeepNoTrivia() { @@ -2200,6 +2274,77 @@ public void TestRemoveNodeInSeparatedList_KeepNoTrivia() Assert.Equal("m(a, /* trivia */ c)", text); } + [Fact] + public void TestRemoveNodeInSeparatedList_KeepNoTrivia_2() + { + var expr = SyntaxFactory.ParseExpression( + @"m(a, b, /* trivia */ +c)"); + + var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf()).FirstOrDefault(); + Assert.NotNull(b); + + var expr2 = expr.RemoveNode(b, SyntaxRemoveOptions.KeepNoTrivia); + + var text = expr2.ToFullString(); + Assert.Equal(@"m(a, c)", text); + } + + [Fact] + public void TestRemoveNodeInSeparatedList_KeepNoTrivia_3() + { + var expr = SyntaxFactory.ParseExpression( + @"m(a, b, +/* trivia */ c)"); + + var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf()).FirstOrDefault(); + Assert.NotNull(b); + + var expr2 = expr.RemoveNode(b, SyntaxRemoveOptions.KeepNoTrivia); + + var text = expr2.ToFullString(); + Assert.Equal(@"m(a, /* trivia */ c)", text); + } + + [Fact] + public void TestRemoveNodeInSeparatedList_KeepNoTrivia_4() + { + var expr = SyntaxFactory.ParseExpression(@"SomeMethod(/*arg1:*/ a, + /*arg2:*/ b, + /*arg3:*/ c)"); + + var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf()).FirstOrDefault(); + Assert.NotNull(b); + + var expr2 = expr.RemoveNode(b, SyntaxRemoveOptions.KeepNoTrivia); + + var text = expr2.ToFullString(); + Assert.Equal(@"SomeMethod(/*arg1:*/ a, + /*arg3:*/ c)", text); + } + + [Fact] + public void TestRemoveNodeInSeparatedList_KeepNoTrivia_5() + { + var expr = SyntaxFactory.ParseExpression(@"SomeMethod(// comment about a + a, + // some comment about b + b, + // some comment about c + c)"); + + var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf()).FirstOrDefault(); + Assert.NotNull(b); + + var expr2 = expr.RemoveNode(b, SyntaxRemoveOptions.KeepNoTrivia); + + var text = expr2.ToFullString(); + Assert.Equal(@"SomeMethod(// comment about a + a, + // some comment about c + c)", text); + } + [Fact] public void TestRemoveOnlyNodeInSeparatedList_KeepExteriorTrivia() { diff --git a/src/Compilers/Core/Portable/Syntax/CommonSyntaxNodeRemover.cs b/src/Compilers/Core/Portable/Syntax/CommonSyntaxNodeRemover.cs new file mode 100644 index 0000000000000..5731598fcdf7e --- /dev/null +++ b/src/Compilers/Core/Portable/Syntax/CommonSyntaxNodeRemover.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.Syntax +{ + internal static class CommonSyntaxNodeRemover + { + public static void GetSeparatorInfo( + SyntaxNodeOrTokenList nodesAndSeparators, int nodeIndex, int endOfLineKind, + out bool nextTokenIsSeparator, out bool nextSeparatorBelongsToNode) + { + // remove preceding separator if any, except for the case where + // the following separator immediately touches the item in the list + // and is followed by a newline. + // + // In that case, we consider the next token to be more closely + // associated with the item, and it should be removed. + // + // For example, if you have: + // + // Goo(a, // a stuff + // b, // b stuff + // c); + // + // If we're removing 'b', we should remove the comma after it. + // + // If there is no next comma, or the next comma is not on the + // same line, then just remove the preceding comma if there is + // one. If there is no next or previous comma there's nothing + // in the list that needs to be fixed up. + + var node = nodesAndSeparators[nodeIndex].AsNode(); + + nextTokenIsSeparator = + nodeIndex + 1 < nodesAndSeparators.Count && + nodesAndSeparators[nodeIndex + 1].IsToken; + + nextSeparatorBelongsToNode = + nextTokenIsSeparator && + nodesAndSeparators[nodeIndex + 1].AsToken() is var nextSeparator && + !nextSeparator.HasLeadingTrivia && + !ContainsEndOfLine(node.GetTrailingTrivia(), endOfLineKind) && + ContainsEndOfLine(nextSeparator.TrailingTrivia, endOfLineKind); + } + + private static bool ContainsEndOfLine(SyntaxTriviaList triviaList, int endOfLineKind) + => triviaList.IndexOf(endOfLineKind) >= 0; + } +} diff --git a/src/Compilers/VisualBasic/Portable/Syntax/SyntaxNodeRemover.vb b/src/Compilers/VisualBasic/Portable/Syntax/SyntaxNodeRemover.vb index b294e3f400404..c5298095c2b66 100644 --- a/src/Compilers/VisualBasic/Portable/Syntax/SyntaxNodeRemover.vb +++ b/src/Compilers/VisualBasic/Portable/Syntax/SyntaxNodeRemover.vb @@ -154,7 +154,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax visited = Me.VisitListSeparator(item.AsToken()) End If Else - Dim node = DirectCast(DirectCast(item.AsNode(), SyntaxNode), TNode) + Dim node = DirectCast(item.AsNode(), TNode) If Me.IsForRemoval(node) Then If alternate Is Nothing Then @@ -162,13 +162,20 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax alternate.Add(withSeps, 0, i) End If - If alternate.Count > 0 AndAlso alternate(alternate.Count - 1).IsToken Then - ' remove preceding separator if any + Dim nextTokenIsSeparator, nextSeparatorBelongsToNode As Boolean + + CommonSyntaxNodeRemover.GetSeparatorInfo( + withSeps, i, SyntaxKind.EndOfLineTrivia, + nextTokenIsSeparator, nextSeparatorBelongsToNode) + + If Not nextSeparatorBelongsToNode AndAlso + alternate.Count > 0 AndAlso + alternate(alternate.Count - 1).IsToken Then + Dim separator = alternate(alternate.Count - 1).AsToken() Me.AddTrivia(separator, node) alternate.RemoveLast() - ElseIf i + 1 < n AndAlso withSeps(i + 1).IsToken Then - ' otherwise remove trailing separator if any + ElseIf nextTokenIsSeparator Then Dim separator = withSeps(i + 1).AsToken() Me.AddTrivia(node, separator) removeNextSeparator = True diff --git a/src/Compilers/VisualBasic/Test/Syntax/TestSyntaxNodes.vb b/src/Compilers/VisualBasic/Test/Syntax/TestSyntaxNodes.vb index 6b30991e7cdcc..442c48b178e22 100644 --- a/src/Compilers/VisualBasic/Test/Syntax/TestSyntaxNodes.vb +++ b/src/Compilers/VisualBasic/Test/Syntax/TestSyntaxNodes.vb @@ -2428,6 +2428,21 @@ a + b Assert.Equal("m(a , c)", text) End Sub + + Public Sub TestRemoveNodeInSeparatedList_KeepExteriorTrivia_2() + Dim expr = SyntaxFactory.ParseExpression("m(a, b, ' comment +c)") + + Dim n = expr.DescendantTokens().Where(Function(t) t.ToString() = "b").Select(Function(t) t.Parent.FirstAncestorOrSelf(Of ArgumentSyntax)()).FirstOrDefault() + Assert.NotNull(n) + + Dim expr2 = expr.RemoveNode(n, SyntaxRemoveOptions.KeepExteriorTrivia) + + Dim text = expr2.ToFullString() + Assert.Equal("m(a, ' comment +c)", text) + End Sub + Public Sub TestRemoveNodeInSeparatedList_KeepNoTrivia() Dim expr = SyntaxFactory.ParseExpression("m(a, b, c)") @@ -2441,6 +2456,20 @@ a + b Assert.Equal("m(a, c)", text) End Sub + + Public Sub TestRemoveNodeInSeparatedList_KeepNoTrivia_2() + Dim expr = SyntaxFactory.ParseExpression("m(a, b, ' comment +c)") + + Dim b = expr.DescendantTokens().Where(Function(t) t.ToString() = "b").Select(Function(t) t.Parent.FirstAncestorOrSelf(Of ArgumentSyntax)()).FirstOrDefault() + Assert.NotNull(b) + + Dim expr2 = expr.RemoveNode(b, SyntaxRemoveOptions.KeepNoTrivia) + + Dim text = expr2.ToFullString() + Assert.Equal("m(a, c)", text) + End Sub + Public Sub TestRemoveOnlyNodeInSeparatedList_KeepExteriorTrivia() Dim expr = SyntaxFactory.ParseExpression("m( a )") diff --git a/src/EditorFeatures/CSharp/EncapsulateField/EncapsulateFieldCommandHandler.cs b/src/EditorFeatures/CSharp/EncapsulateField/EncapsulateFieldCommandHandler.cs index 04d53f096cc97..4b6b0c8739723 100644 --- a/src/EditorFeatures/CSharp/EncapsulateField/EncapsulateFieldCommandHandler.cs +++ b/src/EditorFeatures/CSharp/EncapsulateField/EncapsulateFieldCommandHandler.cs @@ -20,8 +20,8 @@ internal class EncapsulateFieldCommandHandler : AbstractEncapsulateFieldCommandH [ImportingConstructor] public EncapsulateFieldCommandHandler( ITextBufferUndoManagerProvider undoManager, - [ImportMany] IEnumerable> asyncListeners) - : base(undoManager, asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) + : base(undoManager, listenerProvider) { } } diff --git a/src/EditorFeatures/CSharpTest/AddAccessibilityModifiers/AddAccessibilityModifiersTests.cs b/src/EditorFeatures/CSharpTest/AddAccessibilityModifiers/AddAccessibilityModifiersTests.cs index fff3f1c83423f..ab6701219d7d6 100644 --- a/src/EditorFeatures/CSharpTest/AddAccessibilityModifiers/AddAccessibilityModifiersTests.cs +++ b/src/EditorFeatures/CSharpTest/AddAccessibilityModifiers/AddAccessibilityModifiersTests.cs @@ -1,10 +1,13 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.AddAccessibilityModifiers; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; +using Microsoft.CodeAnalysis.Options; using Roslyn.Test.Utilities; using Xunit; @@ -15,6 +18,9 @@ public partial class AddAccessibilityModifiersTests : AbstractCSharpDiagnosticPr internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpAddAccessibilityModifiersDiagnosticAnalyzer(), new CSharpAddAccessibilityModifiersCodeFixProvider()); + private IDictionary OmitDefaultModifiers => + OptionsSet(SingleOption(CodeStyleOptions.RequireAccessibilityModifiers, AccessibilityModifiersRequired.OmitIfDefault, NotificationOption.Suggestion)); + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddAccessibilityModifiers)] public async Task TestAllConstructs() { @@ -165,5 +171,165 @@ namespace Test internal readonly struct S1 { } }"); } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddAccessibilityModifiers)] + public async Task TestAllConstructsWithOmit() + { + await TestInRegularAndScriptAsync( +@" +namespace Outer +{ + namespace Inner1.Inner2 + { + internal class {|FixAllInDocument:C|} + { + private class NestedClass { } + + private struct NestedStruct { } + + private int f1; + private int f2, f3; + public int f4; + + private event Action e1, e2; + public event Action e3; + + private event Action e4 { add { } remove { } } + public event Action e5 { add { } remove { } } + event Action I.e6 { add { } remote { } } + + static C() { } + + private C() { } + public C(int i) { } + + ~C() { } + + private void M1() { } + public void M2() { } + void I.M3() { } + partial void M4() { } + + private int P1 { get; } + public int P2 { get; } + int I.P3 { get; } + + private int this[int i] { get; } + public int this[string s] { get; } + int I.this[bool b] { get; } + } + + internal interface I + { + event Action e6; + void M3(); + int P3 { get; } + int this[bool b] { get; } + } + + internal delegate void D(); + + internal enum E + { + EMember + } + } +}", +@" +namespace Outer +{ + namespace Inner1.Inner2 + { + class {|FixAllInDocument:C|} + { + class NestedClass { } + + struct NestedStruct { } + + int f1; + int f2, f3; + public int f4; + + event Action e1, e2; + public event Action e3; + + event Action e4 { add { } remove { } } + public event Action e5 { add { } remove { } } + event Action I.e6 { add { } remote { } } + + static C() { } + + C() { } + public C(int i) { } + + ~C() { } + + void M1() { } + public void M2() { } + void I.M3() { } + partial void M4() { } + + int P1 { get; } + public int P2 { get; } + int I.P3 { get; } + + int this[int i] { get; } + public int this[string s] { get; } + int I.this[bool b] { get; } + } + + interface I + { + event Action e6; + void M3(); + int P3 { get; } + int this[bool b] { get; } + } + + delegate void D(); + + enum E + { + EMember + } + } +}", options: OmitDefaultModifiers); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddAccessibilityModifiers)] + public async Task TestRefStructsWithOmit() + { + await TestInRegularAndScriptAsync(@" +namespace Test +{ + internal ref struct [|S1|] { } +}", @" +namespace Test +{ + ref struct S1 { } +}", options: OmitDefaultModifiers); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddAccessibilityModifiers)] + public async Task TestReadOnlyStructsWithOmit() + { + await TestInRegularAndScriptAsync(@" +namespace Test +{ + internal readonly struct [|S1|] { } +}", @" +namespace Test +{ + readonly struct S1 { } +}", options: OmitDefaultModifiers); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddAccessibilityModifiers)] + public async Task TestClassOutsideNamespace() + { + await TestInRegularAndScriptAsync(@" +internal class [|C1|] { }", @" +class C1 { }", options: OmitDefaultModifiers); + } } } diff --git a/src/EditorFeatures/CSharpTest/Classification/SemanticClassifierTests.cs b/src/EditorFeatures/CSharpTest/Classification/SemanticClassifierTests.cs index 3f3fa61f98191..cac7f4ac01d59 100644 --- a/src/EditorFeatures/CSharpTest/Classification/SemanticClassifierTests.cs +++ b/src/EditorFeatures/CSharpTest/Classification/SemanticClassifierTests.cs @@ -2138,14 +2138,13 @@ public async Task TestCreateWithBufferNotInWorkspace() WpfTestCase.RequireWpfFact("Creates an IWpfTextView explicitly with an unrelated buffer"); using (var disposableView = workspace.ExportProvider.GetExportedValue().CreateDisposableTextView(extraBuffer)) { - var waiter = new Waiter(); + var listenerProvider = new AsynchronousOperationListenerProvider(); + var provider = new SemanticClassificationViewTaggerProvider( workspace.ExportProvider.GetExportedValue(), workspace.ExportProvider.GetExportedValue(), workspace.ExportProvider.GetExportedValue(), - SpecializedCollections.SingletonEnumerable( - new Lazy( - () => waiter, new FeatureMetadata(new Dictionary() { { "FeatureName", FeatureAttribute.Classification } })))); + listenerProvider); using (var tagger = (IDisposable)provider.CreateTagger(disposableView.TextView, extraBuffer)) { @@ -2155,6 +2154,7 @@ public async Task TestCreateWithBufferNotInWorkspace() edit.Apply(); } + var waiter = listenerProvider.GetWaiter(FeatureAttribute.Classification); await waiter.CreateWaitTask(); } } @@ -2169,18 +2169,18 @@ public async Task TestGetTagsOnBufferTagger() { var document = workspace.Documents.First(); - var waiter = new Waiter(); + var listenerProvider = new AsynchronousOperationListenerProvider(); + var provider = new SemanticClassificationBufferTaggerProvider( workspace.ExportProvider.GetExportedValue(), workspace.ExportProvider.GetExportedValue(), workspace.ExportProvider.GetExportedValue(), - SpecializedCollections.SingletonEnumerable( - new Lazy( - () => waiter, new FeatureMetadata(new Dictionary() { { "FeatureName", FeatureAttribute.Classification } })))); + listenerProvider); var tagger = provider.CreateTagger(document.TextBuffer); using (var disposable = (IDisposable)tagger) { + var waiter = listenerProvider.GetWaiter(FeatureAttribute.Classification); await waiter.CreateWaitTask(); var tags = tagger.GetTags(document.TextBuffer.CurrentSnapshot.GetSnapshotSpanCollection()); @@ -2194,8 +2194,6 @@ public async Task TestGetTagsOnBufferTagger() } } - private class Waiter : AsynchronousOperationListener { } - [Fact, Trait(Traits.Feature, Traits.Features.Classification)] public async Task Tuples() { diff --git a/src/EditorFeatures/CSharpTest/Classification/SyntacticTaggerTests.cs b/src/EditorFeatures/CSharpTest/Classification/SyntacticTaggerTests.cs index 4c063038d0b21..c764a6c5e6f89 100644 --- a/src/EditorFeatures/CSharpTest/Classification/SyntacticTaggerTests.cs +++ b/src/EditorFeatures/CSharpTest/Classification/SyntacticTaggerTests.cs @@ -32,7 +32,7 @@ public async Task TestTagsChangedForEntireFile() var tagComputer = new SyntacticClassificationTaggerProvider.TagComputer( subjectBuffer, workspace.GetService(), - AggregateAsynchronousOperationListener.CreateEmptyListener(), + AsynchronousOperationListenerProvider.NullListener, null, new SyntacticClassificationTaggerProvider(null, null, null)); diff --git a/src/EditorFeatures/CSharpTest/CodeActions/InlineTemporary/InlineTemporaryTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/InlineTemporary/InlineTemporaryTests.cs index c24ac6604687b..133909b201dba 100644 --- a/src/EditorFeatures/CSharpTest/CodeActions/InlineTemporary/InlineTemporaryTests.cs +++ b/src/EditorFeatures/CSharpTest/CodeActions/InlineTemporary/InlineTemporaryTests.cs @@ -1375,6 +1375,8 @@ await TestFixOneAsync(@" @" { int y, +#if true + #endif z; @@ -1399,7 +1401,9 @@ await TestFixOneAsync(@" { int y, #if true - z; + z +#endif + ; int a = 1; }"); diff --git a/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.cs b/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.cs index 352224a9ea2e9..904b7771a72bd 100644 --- a/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.cs +++ b/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.cs @@ -213,7 +213,7 @@ class C var textView = workspace.Documents.Single().GetTextView(); var handler = new EncapsulateFieldCommandHandler(workspace.GetService(), - workspace.ExportProvider.GetExportedValues>()); + workspace.ExportProvider.GetExportedValue()); var state = handler.GetCommandState(new EncapsulateFieldCommandArgs(textView, textView.TextBuffer)); Assert.True(state.IsUnspecified); diff --git a/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldTestState.cs b/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldTestState.cs index 5b03e0be64bed..1fc38d6ad6816 100644 --- a/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldTestState.cs +++ b/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldTestState.cs @@ -56,7 +56,7 @@ public void Encapsulate() { var args = new EncapsulateFieldCommandArgs(_testDocument.GetTextView(), _testDocument.GetTextBuffer()); var commandHandler = new EncapsulateFieldCommandHandler(Workspace.GetService(), - Workspace.ExportProvider.GetExportedValues>()); + Workspace.ExportProvider.GetExportedValue()); commandHandler.ExecuteCommand(args, TestCommandExecutionContext.Create()); } diff --git a/src/EditorFeatures/CSharpTest/Interactive/BraceMatching/InteractiveBraceHighlightingTests.cs b/src/EditorFeatures/CSharpTest/Interactive/BraceMatching/InteractiveBraceHighlightingTests.cs index 2f5a22a1ce3dd..cc5013c00a741 100644 --- a/src/EditorFeatures/CSharpTest/Interactive/BraceMatching/InteractiveBraceHighlightingTests.cs +++ b/src/EditorFeatures/CSharpTest/Interactive/BraceMatching/InteractiveBraceHighlightingTests.cs @@ -35,7 +35,7 @@ private async Task>> ProduceTagsAsync( var producer = new BraceHighlightingViewTaggerProvider( workspace.GetService(), workspace.GetService(), - AggregateAsynchronousOperationListener.EmptyListeners); + AsynchronousOperationListenerProvider.NullProvider); var context = new TaggerContext( buffer.CurrentSnapshot.GetRelatedDocumentsWithChanges().FirstOrDefault(), diff --git a/src/EditorFeatures/CSharpTest/NavigateTo/NavigateToTests.cs b/src/EditorFeatures/CSharpTest/NavigateTo/NavigateToTests.cs index db789f2911834..bb6052b2994b7 100644 --- a/src/EditorFeatures/CSharpTest/NavigateTo/NavigateToTests.cs +++ b/src/EditorFeatures/CSharpTest/NavigateTo/NavigateToTests.cs @@ -1019,9 +1019,7 @@ public void VisibleMethod_Generated() { } ", exportProvider: s_exportProvider)) { - var aggregateListener = AggregateAsynchronousOperationListener.CreateEmptyListener(); - - _provider = new NavigateToItemProvider(workspace, aggregateListener); + _provider = new NavigateToItemProvider(workspace, AsynchronousOperationListenerProvider.NullListener); _aggregator = new NavigateToTestAggregator(_provider); var items = await _aggregator.GetItemsAsync("VisibleMethod"); diff --git a/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests.cs b/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests.cs index 0a0c65c4e9faf..960a9b8640e58 100644 --- a/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests.cs +++ b/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp; @@ -17,54 +16,54 @@ public partial class CSharpAsAndNullCheckTests : AbstractCSharpDiagnosticProvide internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpAsAndNullCheckDiagnosticAnalyzer(), new CSharpAsAndNullCheckCodeFixProvider()); - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] - public async Task InlineTypeCheck1() - { - await TestInRegularAndScriptAsync( -@"class C -{ - void M() - { - [|var|] x = o as string; - if (x != null) + [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] + [InlineData("x != null", "o is string x")] + [InlineData("null != x", "o is string x")] + [InlineData("(object)x != null", "o is string x")] + [InlineData("null != (object)x", "o is string x")] + [InlineData("x == null", "!(o is string x)")] + [InlineData("null == x", "!(o is string x)")] + [InlineData("(object)x == null", "!(o is string x)")] + [InlineData("null == (object)x", "!(o is string x)")] + [InlineData("(x = o as string) != null", "o is string x")] + [InlineData("null != (x = o as string)", "o is string x")] + [InlineData("(x = o as string) == null", "!(o is string x)")] + [InlineData("null == (x = o as string)", "!(o is string x)")] + public async Task InlineTypeCheck1(string input, string output) { + await TestStatement($"if ({input}) {{ }}", $"if ({output}) {{ }}"); + await TestStatement($"var y = {input};", $"var y = {output};"); + await TestStatement($"return {input};", $"return {output};"); } - } -}", -@"class C -{ - void M() - { - if (o is string x) + + [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] + [InlineData("(x = o as string) != null", "o is string x")] + [InlineData("null != (x = o as string)", "o is string x")] + [InlineData("(x = o as string) == null", "!(o is string x)")] + [InlineData("null == (x = o as string)", "!(o is string x)")] + public async Task InlineTypeCheck2(string input, string output) { - } - } -}"); + await TestStatement($"while ({input}) {{ }}", $"while ({output}) {{ }}"); } - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] - public async Task InlineTypeCheckInvertedCheck1() + private async Task TestStatement(string input, string output) { await TestInRegularAndScriptAsync( -@"class C -{ - void M() - { +$@"class C +{{ + void M(object o) + {{ [|var|] x = o as string; - if (null != x) - { - } - } -}", -@"class C -{ - void M() - { - if (o is string x) - { - } - } -}"); + {input} + }} +}}", +$@"class C +{{ + void M(object o) + {{ + {output} + }} +}}"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] @@ -156,22 +155,6 @@ void M() }"); } - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] - public async Task TestMissingOnNullEquality() - { - await TestMissingInRegularAndScriptAsync( -@"class C -{ - void M() - { - [|var|] x = o is string; - if (x == null) - { - } - } -}"); - } - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] public async Task TestInlineTypeCheckWithElse() { @@ -428,6 +411,88 @@ void M() }"); } + [WorkItem(21097, "https://github.com/dotnet/roslyn/issues/21097")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] + public async Task TestDefiniteAssignment4() + { + await TestMissingInRegularAndScriptAsync( +@"class C +{ + void M(object o) + { + [|var|] s = o as string; + if (s != null) + { + + } + else + { + if (o is int?) + s = null; + s.ToString(); + } + } +}"); + } + + [WorkItem(24286, "https://github.com/dotnet/roslyn/issues/24286")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] + public async Task TestDefiniteAssignment5() + { + await TestMissingInRegularAndScriptAsync( +@"public class Test +{ + public void TestIt(object o1, object o2) + { + [|var|] test = o1 as Test; + if (test != null || o2 != null) + { + var o3 = test ?? o2; + } + } +}"); + } + + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] + public async Task TestDefiniteAssignment6() + { + await TestMissingInRegularAndScriptAsync( +@"class C +{ + string Use(string x) => x; + + void M() + { + [|var|] x = o as string; + if (x != null && x.Length > 0) + { + } + + Console.WriteLine(x = Use(x)); + } +}"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] + public async Task TestDefiniteAssignment7() + { + await TestMissingInRegularAndScriptAsync( +@"class C +{ + void M() + { + [|var|] x = o as string; + if (x != null && x.Length > 0) + { + } + + Console.WriteLine(x); + x = ""writeAfter""; + } +}"); + } + [WorkItem(15957, "https://github.com/dotnet/roslyn/issues/15957")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] public async Task TestTrivia1() @@ -561,111 +626,28 @@ static void M(ParameterSyntax parameter) } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] - public async Task TestInlineNullCheck1() - { - await TestInRegularAndScriptAsync( -@"class C -{ - void M() - { - [|string|] x; - if ((x = o as string) != null) - { - } - } -}", -@"class C -{ - void M() - { - if (o is string x) - { - } - } -}"); - } - - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] - public async Task TestInlineNullCheck2() - { - await TestInRegularAndScriptAsync( -@"class C -{ - void M() - { - [|string|] x; - if (null != (x = o as string)) - { - } - } -}", -@"class C -{ - void M() - { - if (o is string x) + public async Task TestMissingOnWhileNoInline() { - } - } -}"); - } - - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] - public async Task TestInlineNullCheck3() - { - await TestInRegularAndScriptAsync( -@"class C -{ - void M() - { - [|string|] x; - while ((x = o as string) != null) - { - } - } -}", + await TestMissingInRegularAndScriptAsync( @"class C { - void M() + void M(object o) { - while (o is string x) + [|string|] x = o as string; + while (x != null) { } } }"); } - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] - public async Task TestInlineNullCheck4() - { - await TestInRegularAndScriptAsync( -@"class C -{ - void M() - { - [|string|] x; - while (null != (x = o as string)) - { - } - } -}", -@"class C -{ - void M() - { - while (o is string x) - { - } - } -}"); - } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] public async Task TestWhileDefiniteAssignment1() { await TestMissingInRegularAndScriptAsync( @"class C { - void M() + void M(object o) { [|string|] x; while ((x = o as string) != null) @@ -683,7 +665,7 @@ public async Task TestWhileDefiniteAssignment2() await TestMissingInRegularAndScriptAsync( @"class C { - void M() + void M(object o) { [|string|] x; while ((x = o as string) != null) @@ -694,14 +676,14 @@ void M() } }"); } - + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] public async Task TestWhileDefiniteAssignment3() { await TestMissingInRegularAndScriptAsync( @"class C { - void M() + void M(object o) { [|string|] x; x = ""writeBeforeWhile""; @@ -718,7 +700,7 @@ public async Task TestWhileDefiniteAssignment4() await TestMissingInRegularAndScriptAsync( @"class C { - void M() + void M(object o) { [|string|] x = null; var readBeforeWhile = x; @@ -763,6 +745,64 @@ public static void Main() public static bool operator ==(C c1, C c2) => false; public static bool operator !=(C c1, C c2) => false; +}"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] + public async Task TestNegativeDefiniteAssignment1() + { + await TestInRegularAndScriptAsync( +@"class C +{ + string M(object o) + { + [|var|] x = o as string; + if (x == null) return null; + return x; + } +}", +@"class C +{ + string M(object o) + { + if (!(o is string x)) return null; + return x; + } +}"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] + public async Task TestNegativeDefiniteAssignment2() + { + await TestInRegularAndScriptAsync( +@"class C +{ + string M(object o, bool b) + { + [|var|] x = o as string; + if (((object)x == null) || b) + { + return null; + } + else + { + return x; + } + } +}", +@"class C +{ + string M(object o, bool b) + { + if ((!(o is string x)) || b) + { + return null; + } + else + { + return x; + } + } }"); } } diff --git a/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests_FixAllTests.cs b/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests_FixAllTests.cs index 961c8bdf8380f..4b9333c5e1fcf 100644 --- a/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests_FixAllTests.cs +++ b/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests_FixAllTests.cs @@ -27,7 +27,7 @@ int M() { } - if ((a = o as string) != null) + if ((a = o as string) == null) { } @@ -50,7 +50,7 @@ int M() { } - if (o is string a) + if (!(o is string a)) { } diff --git a/src/EditorFeatures/CSharpTest/Workspaces/WorkspaceTests.cs b/src/EditorFeatures/CSharpTest/Workspaces/WorkspaceTests.cs index ab35b6067f2d1..30c147384b4ff 100644 --- a/src/EditorFeatures/CSharpTest/Workspaces/WorkspaceTests.cs +++ b/src/EditorFeatures/CSharpTest/Workspaces/WorkspaceTests.cs @@ -22,24 +22,11 @@ namespace Microsoft.CodeAnalysis.UnitTests.Workspaces { public partial class WorkspaceTests { - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.Workspace)] - private class WorkspaceWaiter : AsynchronousOperationListener - { - internal WorkspaceWaiter() - { - } - } - private static Lazy s_exportProvider = new Lazy(CreateExportProvider); private static ExportProvider CreateExportProvider() { - var catalog = MinimalTestExportProvider.WithPart( - TestExportProvider.CreateAssemblyCatalogWithCSharpAndVisualBasic(), - typeof(WorkspaceWaiter)); + var catalog = TestExportProvider.CreateAssemblyCatalogWithCSharpAndVisualBasic(); return MinimalTestExportProvider.CreateExportProvider(catalog); } @@ -51,8 +38,9 @@ private TestWorkspace CreateWorkspace(bool disablePartialSolutions = true) private static async Task WaitForWorkspaceOperationsToComplete(TestWorkspace workspace) { var workspaceWaiter = workspace.ExportProvider - .GetExports() - .First(l => l.Metadata.FeatureName == FeatureAttribute.Workspace).Value as IAsynchronousOperationWaiter; + .GetExportedValue() + .GetWaiter(FeatureAttribute.Workspace); + await workspaceWaiter.CreateWaitTask(); } diff --git a/src/EditorFeatures/Core.Wpf/Adornments/AbstractAdornmentManagerProvider.cs b/src/EditorFeatures/Core.Wpf/Adornments/AbstractAdornmentManagerProvider.cs index 3731e2b7e8808..a89b70419cf25 100644 --- a/src/EditorFeatures/Core.Wpf/Adornments/AbstractAdornmentManagerProvider.cs +++ b/src/EditorFeatures/Core.Wpf/Adornments/AbstractAdornmentManagerProvider.cs @@ -21,12 +21,10 @@ internal abstract class AbstractAdornmentManagerProvider : protected AbstractAdornmentManagerProvider( IViewTagAggregatorFactoryService tagAggregatorFactoryService, - IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _tagAggregatorFactoryService = tagAggregatorFactoryService; - _asyncListener = new AggregateAsynchronousOperationListener( - asyncListeners, - this.FeatureAttributeName); + _asyncListener = listenerProvider.GetListener(this.FeatureAttributeName); } protected abstract string FeatureAttributeName { get; } diff --git a/src/EditorFeatures/Core.Wpf/InlineRename/InlineRenameService.cs b/src/EditorFeatures/Core.Wpf/InlineRename/InlineRenameService.cs index 214266478fe21..e9991fd0c64cf 100644 --- a/src/EditorFeatures/Core.Wpf/InlineRename/InlineRenameService.cs +++ b/src/EditorFeatures/Core.Wpf/InlineRename/InlineRenameService.cs @@ -20,7 +20,7 @@ internal class InlineRenameService : IInlineRenameService { private readonly IWaitIndicator _waitIndicator; private readonly ITextBufferAssociatedViewService _textBufferAssociatedViewService; - private readonly AggregateAsynchronousOperationListener _aggregateListener; + private readonly IAsynchronousOperationListener _asyncListener; private readonly IEnumerable _refactorNotifyServices; private readonly ITextBufferFactoryService _textBufferFactoryService; @@ -32,13 +32,13 @@ public InlineRenameService( ITextBufferAssociatedViewService textBufferAssociatedViewService, ITextBufferFactoryService textBufferFactoryService, [ImportMany] IEnumerable refactorNotifyServices, - [ImportMany] IEnumerable> listeners) + IAsynchronousOperationListenerProvider listenerProvider) { _waitIndicator = waitIndicator; _textBufferAssociatedViewService = textBufferAssociatedViewService; _textBufferFactoryService = textBufferFactoryService; _refactorNotifyServices = refactorNotifyServices; - _aggregateListener = new AggregateAsynchronousOperationListener(listeners, FeatureAttribute.Rename); + _asyncListener = listenerProvider.GetListener(FeatureAttribute.Rename); } public InlineRenameSessionInfo StartInlineSession( @@ -68,7 +68,7 @@ public InlineRenameSessionInfo StartInlineSession( _textBufferAssociatedViewService, _textBufferFactoryService, _refactorNotifyServices, - _aggregateListener); + _asyncListener); return new InlineRenameSessionInfo(ActiveSession); } diff --git a/src/EditorFeatures/Core.Wpf/LineSeparators/LineSeparatorAdornmentManagerProvider.cs b/src/EditorFeatures/Core.Wpf/LineSeparators/LineSeparatorAdornmentManagerProvider.cs index 1edf950e35907..ac1a0ac309d26 100644 --- a/src/EditorFeatures/Core.Wpf/LineSeparators/LineSeparatorAdornmentManagerProvider.cs +++ b/src/EditorFeatures/Core.Wpf/LineSeparators/LineSeparatorAdornmentManagerProvider.cs @@ -33,8 +33,8 @@ internal class LineSeparatorAdornmentManagerProvider : [ImportingConstructor] public LineSeparatorAdornmentManagerProvider( IViewTagAggregatorFactoryService tagAggregatorFactoryService, - [ImportMany] IEnumerable> asyncListeners) - : base(tagAggregatorFactoryService, asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) + : base(tagAggregatorFactoryService, listenerProvider) { } diff --git a/src/EditorFeatures/Core.Wpf/LineSeparators/LineSeparatorTaggerProvider.cs b/src/EditorFeatures/Core.Wpf/LineSeparators/LineSeparatorTaggerProvider.cs index 90b5b08522487..9d658bf5d1c15 100644 --- a/src/EditorFeatures/Core.Wpf/LineSeparators/LineSeparatorTaggerProvider.cs +++ b/src/EditorFeatures/Core.Wpf/LineSeparators/LineSeparatorTaggerProvider.cs @@ -42,8 +42,8 @@ internal partial class LineSeparatorTaggerProvider : AsynchronousTaggerProvider< public LineSeparatorTaggerProvider( IEditorFormatMapService editorFormatMapService, IForegroundNotificationService notificationService, - [ImportMany] IEnumerable> asyncListeners) - : base(new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.LineSeparators), notificationService) + IAsynchronousOperationListenerProvider listenerProvider) + : base(listenerProvider.GetListener(FeatureAttribute.LineSeparators), notificationService) { _editorFormatMap = editorFormatMapService.GetEditorFormatMap("text"); _editorFormatMap.FormatMappingChanged += OnFormatMappingChanged; diff --git a/src/EditorFeatures/Core.Wpf/NavigateTo/NavigateToItemProviderFactory.cs b/src/EditorFeatures/Core.Wpf/NavigateTo/NavigateToItemProviderFactory.cs index 7afc594c7ed98..1b42173d61982 100644 --- a/src/EditorFeatures/Core.Wpf/NavigateTo/NavigateToItemProviderFactory.cs +++ b/src/EditorFeatures/Core.Wpf/NavigateTo/NavigateToItemProviderFactory.cs @@ -15,15 +15,14 @@ internal class NavigateToItemProviderFactory : INavigateToItemProviderFactory private readonly IAsynchronousOperationListener _asyncListener; [ImportingConstructor] - public NavigateToItemProviderFactory( - [ImportMany] IEnumerable> asyncListeners) + public NavigateToItemProviderFactory(IAsynchronousOperationListenerProvider listenerProvider) { - if (asyncListeners == null) + if (listenerProvider == null) { - throw new ArgumentNullException(nameof(asyncListeners)); + throw new ArgumentNullException(nameof(listenerProvider)); } - _asyncListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.NavigateTo); + _asyncListener = listenerProvider.GetListener(FeatureAttribute.NavigateTo); } public bool TryCreateNavigateToItemProvider(IServiceProvider serviceProvider, out INavigateToItemProvider provider) diff --git a/src/EditorFeatures/Core.Wpf/Structure/AbstractStructureTaggerProvider.cs b/src/EditorFeatures/Core.Wpf/Structure/AbstractStructureTaggerProvider.cs index 501c507c7089d..b967b994199e8 100644 --- a/src/EditorFeatures/Core.Wpf/Structure/AbstractStructureTaggerProvider.cs +++ b/src/EditorFeatures/Core.Wpf/Structure/AbstractStructureTaggerProvider.cs @@ -30,7 +30,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Structure /// editor doesn't know about all the regions in the file, then it wouldn't be able to /// persist them to the SUO file to persist this data across sessions. /// - internal abstract partial class AbstractStructureTaggerProvider : + internal abstract partial class AbstractStructureTaggerProvider : AsynchronousTaggerProvider where TRegionTag : class, ITag { @@ -46,8 +46,8 @@ protected AbstractStructureTaggerProvider( ITextEditorFactoryService textEditorFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IProjectionBufferFactoryService projectionBufferFactoryService, - [ImportMany] IEnumerable> asyncListeners) - : base(new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.Outlining), notificationService) + IAsynchronousOperationListenerProvider listenerProvider) + : base(listenerProvider.GetListener(FeatureAttribute.Outlining), notificationService) { TextEditorFactoryService = textEditorFactoryService; EditorOptionsFactoryService = editorOptionsFactoryService; @@ -189,7 +189,7 @@ private void ProcessSpansWorker( { var spanToCollapse = new SnapshotSpan(snapshot, region.TextSpan.ToSpan()); - while (tagSpanStack.Count > 0 && + while (tagSpanStack.Count > 0 && tagSpanStack.Peek().Span.End <= spanToCollapse.Span.Start) { tagSpanStack.Pop(); @@ -214,7 +214,7 @@ private void ProcessSpansWorker( private static bool s_exceptionReported = false; private ImmutableArray GetMultiLineRegions( - BlockStructureService service, + BlockStructureService service, ImmutableArray regions, ITextSnapshot snapshot) { // Remove any spans that aren't multiline. diff --git a/src/EditorFeatures/Core.Wpf/Structure/VisualStudio14StructureTaggerProvider.cs b/src/EditorFeatures/Core.Wpf/Structure/VisualStudio14StructureTaggerProvider.cs index c0bafde253e36..4f8821136582f 100644 --- a/src/EditorFeatures/Core.Wpf/Structure/VisualStudio14StructureTaggerProvider.cs +++ b/src/EditorFeatures/Core.Wpf/Structure/VisualStudio14StructureTaggerProvider.cs @@ -35,8 +35,8 @@ public VisualStudio14StructureTaggerProvider( ITextEditorFactoryService textEditorFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IProjectionBufferFactoryService projectionBufferFactoryService, - [ImportMany] IEnumerable> asyncListeners) - : base(notificationService, textEditorFactoryService, editorOptionsFactoryService, projectionBufferFactoryService, asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) + : base(notificationService, textEditorFactoryService, editorOptionsFactoryService, projectionBufferFactoryService, listenerProvider) { } diff --git a/src/EditorFeatures/Core.Wpf/Structure/VisualStudio15StructureTaggerProvider.cs b/src/EditorFeatures/Core.Wpf/Structure/VisualStudio15StructureTaggerProvider.cs index 087af82bd4f0d..a4692cfb847e5 100644 --- a/src/EditorFeatures/Core.Wpf/Structure/VisualStudio15StructureTaggerProvider.cs +++ b/src/EditorFeatures/Core.Wpf/Structure/VisualStudio15StructureTaggerProvider.cs @@ -28,8 +28,8 @@ public VisualStudio15StructureTaggerProvider( ITextEditorFactoryService textEditorFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IProjectionBufferFactoryService projectionBufferFactoryService, - [ImportMany] IEnumerable> asyncListeners) - : base(notificationService, textEditorFactoryService, editorOptionsFactoryService, projectionBufferFactoryService, asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) + : base(notificationService, textEditorFactoryService, editorOptionsFactoryService, projectionBufferFactoryService, listenerProvider) { } diff --git a/src/EditorFeatures/Core.Wpf/Suggestions/FixAll/FixMultipleOccurrencesService.cs b/src/EditorFeatures/Core.Wpf/Suggestions/FixAll/FixMultipleOccurrencesService.cs index a474428d2a425..334e4912ea558 100644 --- a/src/EditorFeatures/Core.Wpf/Suggestions/FixAll/FixMultipleOccurrencesService.cs +++ b/src/EditorFeatures/Core.Wpf/Suggestions/FixAll/FixMultipleOccurrencesService.cs @@ -28,11 +28,11 @@ internal class FixMultipleOccurrencesService : IFixMultipleOccurrencesService public FixMultipleOccurrencesService( ICodeActionEditHandlerService editHandler, IWaitIndicator waitIndicator, - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _editHandler = editHandler; _waitIndicator = waitIndicator; - _listener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.LightBulb); + _listener = listenerProvider.GetListener(FeatureAttribute.LightBulb); } public Solution GetFix( @@ -49,7 +49,7 @@ public Solution GetFix( fixAllProvider, diagnosticsToFix, fixProvider, equivalenceKey); return GetFixedSolution( - fixMultipleState, workspace, waitDialogTitle, + fixMultipleState, workspace, waitDialogTitle, waitDialogMessage, cancellationToken); } @@ -67,7 +67,7 @@ public Solution GetFix( fixAllProvider, diagnosticsToFix, fixProvider, equivalenceKey); return GetFixedSolution( - fixMultipleState, workspace, waitDialogTitle, + fixMultipleState, workspace, waitDialogTitle, waitDialogMessage, cancellationToken); } diff --git a/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSourceProvider.cs b/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSourceProvider.cs index d02730d9ae24f..d749eded89b3c 100644 --- a/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSourceProvider.cs +++ b/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSourceProvider.cs @@ -52,7 +52,7 @@ public SuggestedActionsSourceProvider( ICodeActionEditHandlerService editHandler, IWaitIndicator waitIndicator, ISuggestedActionCategoryRegistryService suggestedActionCategoryRegistry, - [ImportMany] IEnumerable> asyncListeners, + IAsynchronousOperationListenerProvider listenerProvider, [ImportMany] IEnumerable> imageMonikerServices, [ImportMany] IEnumerable> actionCallbacks) { @@ -63,7 +63,7 @@ public SuggestedActionsSourceProvider( ActionCallbacks = actionCallbacks.ToImmutableArray(); EditHandler = editHandler; WaitIndicator = waitIndicator; - OperationListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.LightBulb); + OperationListener = listenerProvider.GetListener(FeatureAttribute.LightBulb); ImageMonikerServices = ExtensionOrderer.Order(imageMonikerServices).ToImmutableArray(); } diff --git a/src/EditorFeatures/Core/CommandHandlers/QuickInfoCommandHandlerAndSourceProvider.cs b/src/EditorFeatures/Core/CommandHandlers/QuickInfoCommandHandlerAndSourceProvider.cs index ae9bbe82da469..412ea944ac401 100644 --- a/src/EditorFeatures/Core/CommandHandlers/QuickInfoCommandHandlerAndSourceProvider.cs +++ b/src/EditorFeatures/Core/CommandHandlers/QuickInfoCommandHandlerAndSourceProvider.cs @@ -29,17 +29,17 @@ internal partial class QuickInfoCommandHandlerAndSourceProvider : ForegroundThreadAffinitizedObject, IQuickInfoSourceProvider { + private readonly IAsynchronousOperationListener _listener; private readonly IIntelliSensePresenter _presenter; - private readonly IEnumerable> _asyncListeners; private readonly IList> _providers; [ImportingConstructor] public QuickInfoCommandHandlerAndSourceProvider( + [ImportMany] IEnumerable, OrderableMetadata>> presenters, [ImportMany] IEnumerable> providers, - [ImportMany] IEnumerable> asyncListeners, - [ImportMany] IEnumerable, OrderableMetadata>> presenters) + IAsynchronousOperationListenerProvider listenerProvider) : this(ExtensionOrderer.Order(presenters).Select(lazy => lazy.Value).FirstOrDefault(), - providers, asyncListeners) + providers, listenerProvider) { } @@ -47,10 +47,10 @@ public QuickInfoCommandHandlerAndSourceProvider( public QuickInfoCommandHandlerAndSourceProvider( IIntelliSensePresenter presenter, [ImportMany] IEnumerable> providers, - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _providers = ExtensionOrderer.Order(providers); - _asyncListeners = asyncListeners; + _listener = listenerProvider.GetListener(FeatureAttribute.QuickInfo); _presenter = presenter; } @@ -75,10 +75,7 @@ private bool TryGetController(EditorCommandArgs args, out Controller controller) // TODO(cyrusn): If there are no presenters then we should not create a controller. // Otherwise we'll be affecting the user's typing and they'll have no idea why :) - controller = Controller.GetInstance( - args, _presenter, - new AggregateAsynchronousOperationListener(_asyncListeners, FeatureAttribute.QuickInfo), - _providers); + controller = Controller.GetInstance(args, _presenter, _listener, _providers); return true; } diff --git a/src/EditorFeatures/Core/CommandHandlers/SignatureHelpCommandHandler.cs b/src/EditorFeatures/Core/CommandHandlers/SignatureHelpCommandHandler.cs index 0362dfcf34768..fe7ffef5d1e6e 100644 --- a/src/EditorFeatures/Core/CommandHandlers/SignatureHelpCommandHandler.cs +++ b/src/EditorFeatures/Core/CommandHandlers/SignatureHelpCommandHandler.cs @@ -32,7 +32,7 @@ internal class SignatureHelpCommandHandler : IChainedCommandHandler { private readonly IIntelliSensePresenter _signatureHelpPresenter; - private readonly IEnumerable> _asyncListeners; + private readonly IAsynchronousOperationListener _listener; private readonly IList> _signatureHelpProviders; public string DisplayName => EditorFeaturesResources.Signature_Help_Command_Handler; @@ -40,10 +40,10 @@ internal class SignatureHelpCommandHandler : [ImportingConstructor] public SignatureHelpCommandHandler( [ImportMany] IEnumerable> signatureHelpProviders, - [ImportMany] IEnumerable> asyncListeners, - [ImportMany] IEnumerable, OrderableMetadata>> signatureHelpPresenters) + [ImportMany] IEnumerable, OrderableMetadata>> signatureHelpPresenters, + IAsynchronousOperationListenerProvider listenerProvider) : this(ExtensionOrderer.Order(signatureHelpPresenters).Select(lazy => lazy.Value).FirstOrDefault(), - signatureHelpProviders, asyncListeners) + signatureHelpProviders, listenerProvider) { } @@ -51,10 +51,10 @@ public SignatureHelpCommandHandler( public SignatureHelpCommandHandler( IIntelliSensePresenter signatureHelpPresenter, [ImportMany] IEnumerable> signatureHelpProviders, - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _signatureHelpProviders = ExtensionOrderer.Order(signatureHelpProviders); - _asyncListeners = asyncListeners; + _listener = listenerProvider.GetListener(FeatureAttribute.SignatureHelp); _signatureHelpPresenter = signatureHelpPresenter; } @@ -80,8 +80,7 @@ private bool TryGetController(EditorCommandArgs args, out Controller controller) controller = Controller.GetInstance( args, _signatureHelpPresenter, - new AggregateAsynchronousOperationListener(_asyncListeners, FeatureAttribute.SignatureHelp), - _signatureHelpProviders); + _listener, _signatureHelpProviders); return true; } diff --git a/src/EditorFeatures/Core/FindReferences/FindReferencesCommandHandler.cs b/src/EditorFeatures/Core/FindReferences/FindReferencesCommandHandler.cs index 04e1efc74cd76..26883b68e52bb 100644 --- a/src/EditorFeatures/Core/FindReferences/FindReferencesCommandHandler.cs +++ b/src/EditorFeatures/Core/FindReferences/FindReferencesCommandHandler.cs @@ -40,16 +40,15 @@ internal class FindReferencesCommandHandler : VSCommanding.ICommandHandler synchronousPresenters, [ImportMany] IEnumerable> streamingPresenters, - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { Contract.ThrowIfNull(synchronousPresenters); Contract.ThrowIfNull(streamingPresenters); - Contract.ThrowIfNull(asyncListeners); + Contract.ThrowIfNull(listenerProvider); _synchronousPresenters = synchronousPresenters; _streamingPresenters = streamingPresenters; - _asyncListener = new AggregateAsynchronousOperationListener( - asyncListeners, FeatureAttribute.FindReferences); + _asyncListener = listenerProvider.GetListener(FeatureAttribute.FindReferences); } public VSCommanding.CommandState GetCommandState(FindReferencesCommandArgs args) diff --git a/src/EditorFeatures/Core/Implementation/BraceMatching/BraceHighlightingViewTaggerProvider.cs b/src/EditorFeatures/Core/Implementation/BraceMatching/BraceHighlightingViewTaggerProvider.cs index b9ab9ba15e09c..bbcfe02434e19 100644 --- a/src/EditorFeatures/Core/Implementation/BraceMatching/BraceHighlightingViewTaggerProvider.cs +++ b/src/EditorFeatures/Core/Implementation/BraceMatching/BraceHighlightingViewTaggerProvider.cs @@ -34,8 +34,8 @@ internal class BraceHighlightingViewTaggerProvider : AsynchronousViewTaggerProvi public BraceHighlightingViewTaggerProvider( IBraceMatchingService braceMatcherService, IForegroundNotificationService notificationService, - [ImportMany] IEnumerable> asyncListeners) - : base(new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.BraceHighlighting), notificationService) + IAsynchronousOperationListenerProvider listenerProvider) + : base(listenerProvider.GetListener(FeatureAttribute.BraceHighlighting), notificationService) { _braceMatcherService = braceMatcherService; } diff --git a/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationBufferTaggerProvider.cs b/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationBufferTaggerProvider.cs index 677f12ab20952..d2138139ea3ac 100644 --- a/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationBufferTaggerProvider.cs +++ b/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationBufferTaggerProvider.cs @@ -36,12 +36,12 @@ public SemanticClassificationBufferTaggerProvider( IForegroundNotificationService notificationService, ISemanticChangeNotificationService semanticChangeNotificationService, ClassificationTypeMap typeMap, - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _notificationService = notificationService; _semanticChangeNotificationService = semanticChangeNotificationService; _typeMap = typeMap; - _asyncListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.Classification); + _asyncListener = listenerProvider.GetListener(FeatureAttribute.Classification); } public IAccurateTagger CreateTagger(ITextBuffer buffer) where T : ITag diff --git a/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationViewTaggerProvider.cs b/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationViewTaggerProvider.cs index c9c79699e3fba..7191c1a66cfd6 100644 --- a/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationViewTaggerProvider.cs +++ b/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationViewTaggerProvider.cs @@ -47,8 +47,8 @@ public SemanticClassificationViewTaggerProvider( IForegroundNotificationService notificationService, ISemanticChangeNotificationService semanticChangeNotificationService, ClassificationTypeMap typeMap, - [ImportMany] IEnumerable> asyncListeners) - : base(new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.Classification), notificationService) + IAsynchronousOperationListenerProvider listenerProvider) + : base(listenerProvider.GetListener(FeatureAttribute.Classification), notificationService) { _semanticChangeNotificationService = semanticChangeNotificationService; _typeMap = typeMap; @@ -99,7 +99,7 @@ protected override Task ProduceTagsAsync(TaggerContext conte } private Task ProduceTagsAsync( - TaggerContext context, + TaggerContext context, DocumentSnapshotSpan spanToTag, IClassificationDelegationService delegationService) where TClassificationService : class, ILanguageService diff --git a/src/EditorFeatures/Core/Implementation/Classification/SyntacticClassificationTaggerProvider.cs b/src/EditorFeatures/Core/Implementation/Classification/SyntacticClassificationTaggerProvider.cs index 859e5632d2533..4f4d652049981 100644 --- a/src/EditorFeatures/Core/Implementation/Classification/SyntacticClassificationTaggerProvider.cs +++ b/src/EditorFeatures/Core/Implementation/Classification/SyntacticClassificationTaggerProvider.cs @@ -22,7 +22,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Classification internal partial class SyntacticClassificationTaggerProvider : ITaggerProvider { private readonly IForegroundNotificationService _notificationService; - private readonly IEnumerable> _asyncListeners; + private readonly IAsynchronousOperationListener _listener; private readonly ClassificationTypeMap _typeMap; private readonly ConditionalWeakTable _tagComputers = new ConditionalWeakTable(); @@ -31,11 +31,11 @@ internal partial class SyntacticClassificationTaggerProvider : ITaggerProvider public SyntacticClassificationTaggerProvider( IForegroundNotificationService notificationService, ClassificationTypeMap typeMap, - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _notificationService = notificationService; _typeMap = typeMap; - _asyncListeners = asyncListeners; + _listener = listenerProvider.GetListener(FeatureAttribute.Classification); } public ITagger CreateTagger(ITextBuffer buffer) where T : ITag @@ -47,8 +47,7 @@ public ITagger CreateTagger(ITextBuffer buffer) where T : ITag if (!_tagComputers.TryGetValue(buffer, out var tagComputer)) { - var asyncListener = new AggregateAsynchronousOperationListener(_asyncListeners, FeatureAttribute.Classification); - tagComputer = new TagComputer(buffer, _notificationService, asyncListener, _typeMap, this); + tagComputer = new TagComputer(buffer, _notificationService, _listener, _typeMap, this); _tagComputers.Add(buffer, tagComputer); } diff --git a/src/EditorFeatures/Core/Implementation/Diagnostics/AbstractDiagnosticsAdornmentTaggerProvider.cs b/src/EditorFeatures/Core/Implementation/Diagnostics/AbstractDiagnosticsAdornmentTaggerProvider.cs index 13d7b814d52d6..fc2933b8228ae 100644 --- a/src/EditorFeatures/Core/Implementation/Diagnostics/AbstractDiagnosticsAdornmentTaggerProvider.cs +++ b/src/EditorFeatures/Core/Implementation/Diagnostics/AbstractDiagnosticsAdornmentTaggerProvider.cs @@ -16,8 +16,8 @@ internal abstract class AbstractDiagnosticsAdornmentTaggerProvider : public AbstractDiagnosticsAdornmentTaggerProvider( IDiagnosticService diagnosticService, IForegroundNotificationService notificationService, - IEnumerable> listeners) - : base(diagnosticService, notificationService, new AggregateAsynchronousOperationListener(listeners, FeatureAttribute.ErrorSquiggles)) + IAsynchronousOperationListenerProvider listenerProvider) + : base(diagnosticService, notificationService, listenerProvider.GetListener(FeatureAttribute.ErrorSquiggles)) { } diff --git a/src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsClassificationTaggerProvider.cs b/src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsClassificationTaggerProvider.cs index 079fc80d68909..5e24a3ba83078 100644 --- a/src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsClassificationTaggerProvider.cs +++ b/src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsClassificationTaggerProvider.cs @@ -37,8 +37,8 @@ public DiagnosticsClassificationTaggerProvider( ClassificationTypeMap typeMap, IForegroundNotificationService notificationService, IEditorOptionsFactoryService editorOptionsFactoryService, - [ImportMany] IEnumerable> listeners) - : base(diagnosticService, notificationService, new AggregateAsynchronousOperationListener(listeners, FeatureAttribute.Classification)) + IAsynchronousOperationListenerProvider listenerProvider) + : base(diagnosticService, notificationService, listenerProvider.GetListener(FeatureAttribute.Classification)) { _typeMap = typeMap; _classificationTag = new ClassificationTag(_typeMap.GetClassificationType(ClassificationTypeDefinitions.UnnecessaryCode)); diff --git a/src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsSquiggleTaggerProvider.cs b/src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsSquiggleTaggerProvider.cs index d51095c12bb72..1d01de4d8589e 100644 --- a/src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsSquiggleTaggerProvider.cs +++ b/src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsSquiggleTaggerProvider.cs @@ -35,8 +35,8 @@ internal partial class DiagnosticsSquiggleTaggerProvider : AbstractDiagnosticsAd public DiagnosticsSquiggleTaggerProvider( IDiagnosticService diagnosticService, IForegroundNotificationService notificationService, - [ImportMany] IEnumerable> listeners) - : base(diagnosticService, notificationService, listeners) + IAsynchronousOperationListenerProvider listenerProvider) + : base(diagnosticService, notificationService, listenerProvider) { } diff --git a/src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsSuggestionTaggerProvider.cs b/src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsSuggestionTaggerProvider.cs index ca4f1b5185420..2b1ea4bba7878 100644 --- a/src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsSuggestionTaggerProvider.cs +++ b/src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsSuggestionTaggerProvider.cs @@ -33,8 +33,8 @@ internal partial class DiagnosticsSuggestionTaggerProvider : public DiagnosticsSuggestionTaggerProvider( IDiagnosticService diagnosticService, IForegroundNotificationService notificationService, - [ImportMany] IEnumerable> listeners) - : base(diagnosticService, notificationService, listeners) + IAsynchronousOperationListenerProvider listenerProvider) + : base(diagnosticService, notificationService, listenerProvider) { } diff --git a/src/EditorFeatures/Core/Implementation/EncapsulateField/AbstractEncapsulateFieldCommandHandler.cs b/src/EditorFeatures/Core/Implementation/EncapsulateField/AbstractEncapsulateFieldCommandHandler.cs index 274447aeb5aa6..cb8329afa6ede 100644 --- a/src/EditorFeatures/Core/Implementation/EncapsulateField/AbstractEncapsulateFieldCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/EncapsulateField/AbstractEncapsulateFieldCommandHandler.cs @@ -23,16 +23,16 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.EncapsulateField internal abstract class AbstractEncapsulateFieldCommandHandler : VSCommanding.ICommandHandler { private readonly ITextBufferUndoManagerProvider _undoManager; - private readonly AggregateAsynchronousOperationListener _listener; + private readonly IAsynchronousOperationListener _listener; public string DisplayName => EditorFeaturesResources.Encapsulate_Field_Command_Handler; public AbstractEncapsulateFieldCommandHandler( ITextBufferUndoManagerProvider undoManager, - IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _undoManager = undoManager; - _listener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.EncapsulateField); + _listener = listenerProvider.GetListener(FeatureAttribute.EncapsulateField); } public bool ExecuteCommand(EncapsulateFieldCommandArgs args, CommandExecutionContext context) diff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/AsyncCompletionService.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/AsyncCompletionService.cs index 514e7e0aac0fa..2d65ab528a467 100644 --- a/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/AsyncCompletionService.cs +++ b/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/AsyncCompletionService.cs @@ -26,7 +26,7 @@ internal class AsyncCompletionService : ForegroundThreadAffinitizedObject, IAsyn private readonly ITextUndoHistoryRegistry _undoHistoryRegistry; private readonly IInlineRenameService _inlineRenameService; private readonly IIntelliSensePresenter _completionPresenter; - private readonly IEnumerable> _asyncListeners; + private readonly IAsynchronousOperationListener _listener; private readonly IEnumerable> _autoBraceCompletionChars; private readonly Dictionary> _autoBraceCompletionCharSet; @@ -35,12 +35,12 @@ public AsyncCompletionService( IEditorOperationsFactoryService editorOperationsFactoryService, ITextUndoHistoryRegistry undoHistoryRegistry, IInlineRenameService inlineRenameService, - [ImportMany] IEnumerable> asyncListeners, + IAsynchronousOperationListenerProvider listenerProvider, [ImportMany] IEnumerable, OrderableMetadata>> completionPresenters, [ImportMany] IEnumerable> autoBraceCompletionChars) - : this(editorOperationsFactoryService, undoHistoryRegistry, inlineRenameService, + : this(editorOperationsFactoryService, undoHistoryRegistry, inlineRenameService, listenerProvider, ExtensionOrderer.Order(completionPresenters).Select(lazy => lazy.Value).FirstOrDefault(), - asyncListeners, autoBraceCompletionChars) + autoBraceCompletionChars) { } @@ -48,15 +48,16 @@ public AsyncCompletionService( IEditorOperationsFactoryService editorOperationsFactoryService, ITextUndoHistoryRegistry undoHistoryRegistry, IInlineRenameService inlineRenameService, + IAsynchronousOperationListenerProvider listenerProvider, IIntelliSensePresenter completionPresenter, - IEnumerable> asyncListeners, IEnumerable> autoBraceCompletionChars) { _editorOperationsFactoryService = editorOperationsFactoryService; _undoHistoryRegistry = undoHistoryRegistry; _inlineRenameService = inlineRenameService; _completionPresenter = completionPresenter; - _asyncListeners = asyncListeners; + _listener = listenerProvider.GetListener(FeatureAttribute.CompletionSet); + _autoBraceCompletionChars = autoBraceCompletionChars; _autoBraceCompletionCharSet = new Dictionary>(); } @@ -85,8 +86,8 @@ public bool TryGetController(ITextView textView, ITextBuffer subjectBuffer, out var autobraceCompletionCharSet = GetAllAutoBraceCompletionChars(subjectBuffer.ContentType); controller = Controller.GetInstance( textView, subjectBuffer, - _editorOperationsFactoryService, _undoHistoryRegistry, _completionPresenter, - new AggregateAsynchronousOperationListener(_asyncListeners, FeatureAttribute.CompletionSet), + _editorOperationsFactoryService, _undoHistoryRegistry, _completionPresenter, + _listener, autobraceCompletionCharSet); return true; diff --git a/src/EditorFeatures/Core/Implementation/KeywordHighlighting/HighlighterViewTaggerProvider.cs b/src/EditorFeatures/Core/Implementation/KeywordHighlighting/HighlighterViewTaggerProvider.cs index ca8e0020e21d3..0ce85d1ba966c 100644 --- a/src/EditorFeatures/Core/Implementation/KeywordHighlighting/HighlighterViewTaggerProvider.cs +++ b/src/EditorFeatures/Core/Implementation/KeywordHighlighting/HighlighterViewTaggerProvider.cs @@ -38,8 +38,8 @@ internal class HighlighterViewTaggerProvider : AsynchronousViewTaggerProvider> asyncListeners) - : base(new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.KeywordHighlighting), notificationService) + IAsynchronousOperationListenerProvider listenerProvider) + : base(listenerProvider.GetListener(FeatureAttribute.KeywordHighlighting), notificationService) { _highlightingService = highlightingService; } diff --git a/src/EditorFeatures/Core/Implementation/NavigationBar/NavigationBarControllerFactoryService.cs b/src/EditorFeatures/Core/Implementation/NavigationBar/NavigationBarControllerFactoryService.cs index 737f234253cb9..61a503d32bb18 100644 --- a/src/EditorFeatures/Core/Implementation/NavigationBar/NavigationBarControllerFactoryService.cs +++ b/src/EditorFeatures/Core/Implementation/NavigationBar/NavigationBarControllerFactoryService.cs @@ -13,15 +13,15 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.NavigationBar internal class NavigationBarControllerFactoryService : INavigationBarControllerFactoryService { private readonly IWaitIndicator _waitIndicator; - private readonly AggregateAsynchronousOperationListener _asyncListener; + private readonly IAsynchronousOperationListener _asyncListener; [ImportingConstructor] public NavigationBarControllerFactoryService( IWaitIndicator waitIndicator, - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _waitIndicator = waitIndicator; - _asyncListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.NavigationBar); + _asyncListener = listenerProvider.GetListener(FeatureAttribute.NavigationBar); } public INavigationBarController CreateController(INavigationBarPresenter presenter, ITextBuffer textBuffer) diff --git a/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.cs b/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.cs index b623a97bfdaa1..e3b9563c5ab73 100644 --- a/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.cs +++ b/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.cs @@ -47,14 +47,14 @@ public RenameTrackingTaggerProvider( IInlineRenameService inlineRenameService, IDiagnosticAnalyzerService diagnosticAnalyzerService, [ImportMany] IEnumerable refactorNotifyServices, - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _undoHistoryRegistry = undoHistoryRegistry; _waitIndicator = waitIndicator; _inlineRenameService = inlineRenameService; _refactorNotifyServices = refactorNotifyServices; _diagnosticAnalyzerService = diagnosticAnalyzerService; - _asyncListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.RenameTracking); + _asyncListener = listenerProvider.GetListener(FeatureAttribute.RenameTracking); } public ITagger CreateTagger(ITextBuffer buffer) where T : ITag diff --git a/src/EditorFeatures/Core/Implementation/Workspaces/EditorTaskSchedulerFactory.cs b/src/EditorFeatures/Core/Implementation/Workspaces/EditorTaskSchedulerFactory.cs index ef4f75d7c9aa6..d4d7162dc5ac3 100644 --- a/src/EditorFeatures/Core/Implementation/Workspaces/EditorTaskSchedulerFactory.cs +++ b/src/EditorFeatures/Core/Implementation/Workspaces/EditorTaskSchedulerFactory.cs @@ -13,17 +13,17 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Workspaces [ExportWorkspaceService(typeof(IWorkspaceTaskSchedulerFactory), ServiceLayer.Editor), Shared] internal class EditorTaskSchedulerFactory : WorkspaceTaskSchedulerFactory { - private readonly IAsynchronousOperationListener _aggregateListener; + private readonly IAsynchronousOperationListener _listener; [ImportingConstructor] - public EditorTaskSchedulerFactory([ImportMany] IEnumerable> asyncListeners) + public EditorTaskSchedulerFactory(IAsynchronousOperationListenerProvider listenerProvider) { - _aggregateListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.Workspace); + _listener = listenerProvider.GetListener(FeatureAttribute.Workspace); } protected override object BeginAsyncOperation(string taskName) { - return _aggregateListener.BeginAsyncOperation(taskName); + return _listener.BeginAsyncOperation(taskName); } protected override void CompleteAsyncOperation(object asyncToken, Task task) diff --git a/src/EditorFeatures/Core/ReferenceHighlighting/ReferenceHighlightingViewTaggerProvider.cs b/src/EditorFeatures/Core/ReferenceHighlighting/ReferenceHighlightingViewTaggerProvider.cs index e6bdedad10855..c4047a857c081 100644 --- a/src/EditorFeatures/Core/ReferenceHighlighting/ReferenceHighlightingViewTaggerProvider.cs +++ b/src/EditorFeatures/Core/ReferenceHighlighting/ReferenceHighlightingViewTaggerProvider.cs @@ -46,8 +46,8 @@ internal partial class ReferenceHighlightingViewTaggerProvider : AsynchronousVie public ReferenceHighlightingViewTaggerProvider( IForegroundNotificationService notificationService, ISemanticChangeNotificationService semanticChangeNotificationService, - [ImportMany] IEnumerable> asyncListeners) - : base(new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.ReferenceHighlighting), notificationService) + IAsynchronousOperationListenerProvider listenerProvider) + : base(listenerProvider.GetListener(FeatureAttribute.ReferenceHighlighting), notificationService) { _semanticChangeNotificationService = semanticChangeNotificationService; } @@ -147,7 +147,7 @@ internal async Task ProduceTagsAsync( private Task TryOldServiceAsync(TaggerContext context, SnapshotPoint position, Document document) { return TryServiceAsync( - context, position, document, + context, position, document, (s, d, p, ds, c) => s.GetDocumentHighlightsAsync(d, p, ds, c)); } diff --git a/src/EditorFeatures/Test/Diagnostics/DiagnosticServiceTests.cs b/src/EditorFeatures/Test/Diagnostics/DiagnosticServiceTests.cs index 48f4a747095a6..2e309ac476e09 100644 --- a/src/EditorFeatures/Test/Diagnostics/DiagnosticServiceTests.cs +++ b/src/EditorFeatures/Test/Diagnostics/DiagnosticServiceTests.cs @@ -24,7 +24,7 @@ public void TestGetDiagnostics1() var document = workspace.CurrentSolution.AddProject("TestProject", "TestProject", LanguageNames.CSharp).AddDocument("TestDocument", string.Empty); var source = new TestDiagnosticUpdateSource(false, null); - var diagnosticService = new DiagnosticService(AggregateAsynchronousOperationListener.EmptyListeners); + var diagnosticService = new DiagnosticService(AsynchronousOperationListenerProvider.NullProvider); diagnosticService.Register(source); diagnosticService.DiagnosticsUpdated += (s, o) => { set.Set(); }; @@ -56,7 +56,7 @@ public void TestGetDiagnostics2() var document2 = document.Project.AddDocument("TestDocument2", string.Empty); var source = new TestDiagnosticUpdateSource(false, null); - var diagnosticService = new DiagnosticService(AggregateAsynchronousOperationListener.EmptyListeners); + var diagnosticService = new DiagnosticService(AsynchronousOperationListenerProvider.NullProvider); diagnosticService.Register(source); diagnosticService.DiagnosticsUpdated += (s, o) => { set.Set(); }; diff --git a/src/EditorFeatures/Test/Diagnostics/DiagnosticsSquiggleTaggerProviderTests.cs b/src/EditorFeatures/Test/Diagnostics/DiagnosticsSquiggleTaggerProviderTests.cs index a6608d7d360ca..25bf303598048 100644 --- a/src/EditorFeatures/Test/Diagnostics/DiagnosticsSquiggleTaggerProviderTests.cs +++ b/src/EditorFeatures/Test/Diagnostics/DiagnosticsSquiggleTaggerProviderTests.cs @@ -127,14 +127,11 @@ public async Task TestWithMockDiagnosticService_TaggerProviderCreatedBeforeIniti using (var workspace = TestWorkspace.CreateCSharp(new string[] { "class A { }" }, CSharpParseOptions.Default)) using (var wrapper = new DiagnosticTaggerWrapper(workspace)) { - var asyncListener = new AsynchronousOperationListener(); - var listeners = AsynchronousOperationListener.CreateListeners( - ValueTuple.Create(FeatureAttribute.DiagnosticService, asyncListener), - ValueTuple.Create(FeatureAttribute.ErrorSquiggles, asyncListener)); + var listenerProvider = new AsynchronousOperationListenerProvider(); var diagnosticService = new MockDiagnosticService(workspace); var provider = new DiagnosticsSquiggleTaggerProvider( - diagnosticService, workspace.GetService(), listeners); + diagnosticService, workspace.GetService(), listenerProvider); // Create the tagger before the first diagnostic event has been fired. var tagger = provider.CreateTagger(workspace.Documents.First().GetTextBuffer()); @@ -146,7 +143,8 @@ public async Task TestWithMockDiagnosticService_TaggerProviderCreatedBeforeIniti using (var disposable = tagger as IDisposable) { - await asyncListener.CreateWaitTask(); + await listenerProvider.GetWaiter(FeatureAttribute.DiagnosticService).CreateWaitTask(); + await listenerProvider.GetWaiter(FeatureAttribute.ErrorSquiggles).CreateWaitTask(); var snapshot = workspace.Documents.First().GetTextBuffer().CurrentSnapshot; var spans = tagger.GetTags(snapshot.GetSnapshotSpanCollection()).ToList(); @@ -168,14 +166,11 @@ public async Task TestWithMockDiagnosticService_TaggerProviderCreatedAfterInitia using (var workspace = TestWorkspace.CreateCSharp(new string[] { "class A { }" }, CSharpParseOptions.Default)) using (var wrapper = new DiagnosticTaggerWrapper(workspace)) { - var asyncListener = new AsynchronousOperationListener(); - var listeners = AsynchronousOperationListener.CreateListeners( - ValueTuple.Create(FeatureAttribute.DiagnosticService, asyncListener), - ValueTuple.Create(FeatureAttribute.ErrorSquiggles, asyncListener)); + var listenerProvider = new AsynchronousOperationListenerProvider(); var diagnosticService = new MockDiagnosticService(workspace); var provider = new DiagnosticsSquiggleTaggerProvider( - diagnosticService, workspace.GetService(), listeners); + diagnosticService, workspace.GetService(), listenerProvider); // Create and fire the diagnostic events before hte tagger is even made. var tree = await workspace.CurrentSolution.Projects.Single().Documents.Single().GetSyntaxTreeAsync(); @@ -185,7 +180,8 @@ public async Task TestWithMockDiagnosticService_TaggerProviderCreatedAfterInitia var tagger = provider.CreateTagger(workspace.Documents.First().GetTextBuffer()); using (var disposable = tagger as IDisposable) { - await asyncListener.CreateWaitTask(); + await listenerProvider.GetWaiter(FeatureAttribute.DiagnosticService).CreateWaitTask(); + await listenerProvider.GetWaiter(FeatureAttribute.ErrorSquiggles).CreateWaitTask(); var snapshot = workspace.Documents.First().GetTextBuffer().CurrentSnapshot; var spans = tagger.GetTags(snapshot.GetSnapshotSpanCollection()).ToList(); diff --git a/src/EditorFeatures/Test/EditAndContinue/EditAndContinueDiagnosticUpdateSourceTests.cs b/src/EditorFeatures/Test/EditAndContinue/EditAndContinueDiagnosticUpdateSourceTests.cs index 7d005f86ad2ba..b3642d7f18601 100644 --- a/src/EditorFeatures/Test/EditAndContinue/EditAndContinueDiagnosticUpdateSourceTests.cs +++ b/src/EditorFeatures/Test/EditAndContinue/EditAndContinueDiagnosticUpdateSourceTests.cs @@ -20,7 +20,7 @@ public class EditAndContinueDiagnosticUpdateSourceTests [Fact] public void ReportDiagnostics() { - var service = new DiagnosticService(SpecializedCollections.EmptyEnumerable>()); + var service = new DiagnosticService(AsynchronousOperationListenerProvider.NullProvider); var source = new EditAndContinueDiagnosticUpdateSource(service); var updates = new List(); diff --git a/src/EditorFeatures/Test/LineSeparators/AdornmentManagerTests.cs b/src/EditorFeatures/Test/LineSeparators/AdornmentManagerTests.cs index 2f1e027daa071..f101bc3d15978 100644 --- a/src/EditorFeatures/Test/LineSeparators/AdornmentManagerTests.cs +++ b/src/EditorFeatures/Test/LineSeparators/AdornmentManagerTests.cs @@ -83,12 +83,9 @@ public AdornmentManagerTester() var workspace = new TestWorkspace(); - var listener = new AggregateAsynchronousOperationListener( - Enumerable.Empty>(), - FeatureAttribute.LineSeparators); Manager = AdornmentManager.Create(_textView.Object, aggregatorService.Object, - listener, + AsynchronousOperationListenerProvider.NullListener, adornmentLayerName: layerName); } diff --git a/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs b/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs index 3b3624f045c60..57ccef976ae2e 100644 --- a/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs +++ b/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs @@ -236,17 +236,16 @@ public async Task TestPreviewDiagnosticTaggerInPreviewPane() { var foregroundService = workspace.GetService(); - var waiter = new ErrorSquiggleWaiter(); - var listeners = AsynchronousOperationListener.CreateListeners(FeatureAttribute.ErrorSquiggles, waiter); + var listenerProvider = new AsynchronousOperationListenerProvider(); // set up tagger for both buffers var leftBuffer = diffView.Viewer.LeftView.BufferGraph.GetTextBuffers(t => t.ContentType.IsOfType(ContentTypeNames.CSharpContentType)).First(); - var leftProvider = new DiagnosticsSquiggleTaggerProvider(diagnosticService, foregroundService, listeners); + var leftProvider = new DiagnosticsSquiggleTaggerProvider(diagnosticService, foregroundService, listenerProvider); var leftTagger = leftProvider.CreateTagger(leftBuffer); using (var leftDisposable = leftTagger as IDisposable) { var rightBuffer = diffView.Viewer.RightView.BufferGraph.GetTextBuffers(t => t.ContentType.IsOfType(ContentTypeNames.CSharpContentType)).First(); - var rightProvider = new DiagnosticsSquiggleTaggerProvider(diagnosticService, foregroundService, listeners); + var rightProvider = new DiagnosticsSquiggleTaggerProvider(diagnosticService, foregroundService, listenerProvider); var rightTagger = rightProvider.CreateTagger(rightBuffer); using (var rightDisposable = rightTagger as IDisposable) { @@ -259,7 +258,7 @@ public async Task TestPreviewDiagnosticTaggerInPreviewPane() } // wait taggers - await waiter.CreateWaitTask(); + await listenerProvider.GetWaiter(FeatureAttribute.ErrorSquiggles).CreateWaitTask(); // check left buffer var leftSnapshot = leftBuffer.CurrentSnapshot; @@ -281,7 +280,7 @@ public void TestPreviewWorkspaceDoesNotLeakSolution() { // Verify that analyzer execution doesn't leak solution instances from the preview workspace. - var previewWorkspace = new PreviewWorkspace(); + var previewWorkspace = new PreviewWorkspace(); Assert.NotNull(previewWorkspace.CurrentSolution); var project = previewWorkspace.CurrentSolution.AddProject("project", "project.dll", LanguageNames.CSharp); Assert.True(previewWorkspace.TryApplyChanges(project.Solution)); @@ -306,7 +305,5 @@ private void ExecuteAnalyzers(PreviewWorkspace previewWorkspace, ImmutableArray< var result = compilationWithAnalyzers.GetAnalysisResultAsync(CancellationToken.None).Result; Assert.Equal(1, result.CompilationDiagnostics.Count); } - - private class ErrorSquiggleWaiter : AsynchronousOperationListener { } } } diff --git a/src/EditorFeatures/Test/RenameTracking/RenameTrackingTestState.cs b/src/EditorFeatures/Test/RenameTracking/RenameTrackingTestState.cs index f7042399f79e2..cc9f73494e759 100644 --- a/src/EditorFeatures/Test/RenameTracking/RenameTrackingTestState.cs +++ b/src/EditorFeatures/Test/RenameTracking/RenameTrackingTestState.cs @@ -10,10 +10,10 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.CSharp.RenameTracking; using Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking; +using Microsoft.CodeAnalysis.Editor.UnitTests.Utilities; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Editor.VisualBasic.RenameTracking; using Microsoft.CodeAnalysis.Notification; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.CodeAnalysis.Text.Shared.Extensions; @@ -27,7 +27,6 @@ using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; -using Microsoft.CodeAnalysis.Editor.UnitTests.Utilities; namespace Microsoft.CodeAnalysis.Editor.UnitTests.RenameTracking { @@ -104,7 +103,7 @@ public RenameTrackingTestState( Workspace.ExportProvider.GetExport().Value, Workspace.ExportProvider.GetExport().Value, SpecializedCollections.SingletonEnumerable(_mockRefactorNotifyService), - Workspace.ExportProvider.GetExports()); + Workspace.ExportProvider.GetExportedValue()); _tagger = tracker.CreateTagger(_hostDocument.GetTextBuffer()); @@ -228,8 +227,12 @@ public void AssertNotificationMessage() private async Task WaitForAsyncOperationsAsync() { - var waiters = Workspace.ExportProvider.GetExportedValues(); - await waiters.WaitAllAsync(); + var provider = Workspace.ExportProvider.GetExportedValue(); + await provider.WaitAllDispatcherOperationAndTasksAsync( + FeatureAttribute.RenameTracking, + FeatureAttribute.SolutionCrawler, + FeatureAttribute.Workspace, + FeatureAttribute.EventHookup); } public void Dispose() diff --git a/src/EditorFeatures/Test/RenameTracking/RenameTrackingWaiter.cs b/src/EditorFeatures/Test/RenameTracking/RenameTrackingWaiter.cs deleted file mode 100644 index 76dbce8d9b4ce..0000000000000 --- a/src/EditorFeatures/Test/RenameTracking/RenameTrackingWaiter.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Microsoft.CodeAnalysis.Editor.UnitTests.RenameTracking -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.RenameTracking)] - internal sealed class RenameTrackingWaiter : AsynchronousOperationListener - { - } -} diff --git a/src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs b/src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs index aaf09cb5ffa7b..ef27a6b5cf867 100644 --- a/src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs +++ b/src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs @@ -30,7 +30,7 @@ public async Task RegisterService() { var registrationService = new SolutionCrawlerRegistrationService( SpecializedCollections.EmptyEnumerable>(), - AggregateAsynchronousOperationListener.EmptyListeners); + AsynchronousOperationListenerProvider.NullProvider); // register and unregister workspace to the service registrationService.Register(workspace); @@ -56,7 +56,7 @@ public async Task DynamicallyAddAnalyzer() // create solution crawler and add new analyzer provider dynamically var service = new SolutionCrawlerRegistrationService( SpecializedCollections.EmptyEnumerable>(), - GetListeners(workspace.ExportProvider)); + GetListenerProvider(workspace.ExportProvider)); service.Register(workspace); @@ -362,7 +362,7 @@ public async Task Document_Reanalyze() var worker = new Analyzer(); var lazyWorker = new Lazy(() => new AnalyzerProvider(worker), Metadata.Crawler); - var service = new SolutionCrawlerRegistrationService(new[] { lazyWorker }, GetListeners(workspace.ExportProvider)); + var service = new SolutionCrawlerRegistrationService(new[] { lazyWorker }, GetListenerProvider(workspace.ExportProvider)); service.Register(workspace); @@ -440,7 +440,7 @@ public async Task Document_Cancellation() var analyzer = new Analyzer(waitForCancellation: true); var lazyWorker = new Lazy(() => new AnalyzerProvider(analyzer), Metadata.Crawler); - var service = new SolutionCrawlerRegistrationService(new[] { lazyWorker }, GetListeners(workspace.ExportProvider)); + var service = new SolutionCrawlerRegistrationService(new[] { lazyWorker }, GetListenerProvider(workspace.ExportProvider)); service.Register(workspace); @@ -470,7 +470,7 @@ public async Task Document_Cancellation_MultipleTimes() var analyzer = new Analyzer(waitForCancellation: true); var lazyWorker = new Lazy(() => new AnalyzerProvider(analyzer), Metadata.Crawler); - var service = new SolutionCrawlerRegistrationService(new[] { lazyWorker }, GetListeners(workspace.ExportProvider)); + var service = new SolutionCrawlerRegistrationService(new[] { lazyWorker }, GetListenerProvider(workspace.ExportProvider)); service.Register(workspace); @@ -504,7 +504,7 @@ public async Task Document_InvocationReasons() var analyzer = new Analyzer(blockedRun: true); var lazyWorker = new Lazy(() => new AnalyzerProvider(analyzer), Metadata.Crawler); - var service = new SolutionCrawlerRegistrationService(new[] { lazyWorker }, GetListeners(workspace.ExportProvider)); + var service = new SolutionCrawlerRegistrationService(new[] { lazyWorker }, GetListenerProvider(workspace.ExportProvider)); service.Register(workspace); @@ -846,7 +846,7 @@ private async Task InsertText(string code, string text, bool expectDocumentAnaly var analyzer = new Analyzer(); var lazyWorker = new Lazy(() => new AnalyzerProvider(analyzer), Metadata.Crawler); - var service = new SolutionCrawlerRegistrationService(new[] { lazyWorker }, GetListeners(workspace.ExportProvider)); + var service = new SolutionCrawlerRegistrationService(new[] { lazyWorker }, GetListenerProvider(workspace.ExportProvider)); service.Register(workspace); @@ -874,7 +874,7 @@ private async Task ExecuteOperation(TestWorkspace workspace, Action(() => new AnalyzerProvider(worker), Metadata.Crawler); - var service = new SolutionCrawlerRegistrationService(new[] { lazyWorker }, GetListeners(workspace.ExportProvider)); + var service = new SolutionCrawlerRegistrationService(new[] { lazyWorker }, GetListenerProvider(workspace.ExportProvider)); service.Register(workspace); @@ -912,10 +912,10 @@ private async Task WaitAsync(SolutionCrawlerRegistrationService service, TestWor private async Task WaitWaiterAsync(ExportProvider provider) { - var workspaceWaiter = GetListeners(provider).First(l => l.Metadata.FeatureName == FeatureAttribute.Workspace).Value as IAsynchronousOperationWaiter; + var workspaceWaiter = GetListenerProvider(provider).GetWaiter(FeatureAttribute.Workspace); await workspaceWaiter.CreateWaitTask(); - var solutionCrawlerWaiter = GetListeners(provider).First(l => l.Metadata.FeatureName == FeatureAttribute.SolutionCrawler).Value as IAsynchronousOperationWaiter; + var solutionCrawlerWaiter = GetListenerProvider(provider).GetWaiter(FeatureAttribute.SolutionCrawler); await solutionCrawlerWaiter.CreateWaitTask(); } @@ -977,31 +977,9 @@ private static SolutionInfo GetInitialSolutionInfo_2Projects_10Documents(TestWor }); } - private static IEnumerable> GetListeners(ExportProvider provider) + private static AsynchronousOperationListenerProvider GetListenerProvider(ExportProvider provider) { - return provider.GetExports(); - } - - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.SolutionCrawler)] - private class SolutionCrawlerWaiter : AsynchronousOperationListener - { - internal SolutionCrawlerWaiter() - { - } - } - - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.Workspace)] - private class WorkspaceWaiter : AsynchronousOperationListener - { - internal WorkspaceWaiter() - { - } + return provider.GetExportedValue(); } private static void SetOptions(Workspace workspace) @@ -1023,8 +1001,8 @@ private class WorkCoordinatorWorkspace : TestWorkspace public WorkCoordinatorWorkspace(string workspaceKind = null, bool disablePartialSolutions = true) : base(EditorServicesUtil.CreateExportProvider(), workspaceKind, disablePartialSolutions) { - _workspaceWaiter = GetListeners(ExportProvider).First(l => l.Metadata.FeatureName == FeatureAttribute.Workspace).Value as IAsynchronousOperationWaiter; - _solutionCrawlerWaiter = GetListeners(ExportProvider).First(l => l.Metadata.FeatureName == FeatureAttribute.SolutionCrawler).Value as IAsynchronousOperationWaiter; + _workspaceWaiter = GetListenerProvider(ExportProvider).GetWaiter(FeatureAttribute.Workspace); + _solutionCrawlerWaiter = GetListenerProvider(ExportProvider).GetWaiter(FeatureAttribute.SolutionCrawler); Assert.False(_workspaceWaiter.HasPendingWork); Assert.False(_solutionCrawlerWaiter.HasPendingWork); diff --git a/src/EditorFeatures/Test/Structure/StructureTaggerTests.cs b/src/EditorFeatures/Test/Structure/StructureTaggerTests.cs index 577d1738fe72f..98ab3acaf56a0 100644 --- a/src/EditorFeatures/Test/Structure/StructureTaggerTests.cs +++ b/src/EditorFeatures/Test/Structure/StructureTaggerTests.cs @@ -171,7 +171,7 @@ private static async Task> GetTagsFromWorkspaceAsync(T var provider = new VisualStudio14StructureTaggerProvider( workspace.ExportProvider.GetExportedValue(), textService, editorService, projectionService, - AggregateAsynchronousOperationListener.EmptyListeners); + AsynchronousOperationListenerProvider.NullProvider); var document = workspace.CurrentSolution.GetDocument(hostdoc.Id); var context = new TaggerContext(document, view.TextSnapshot); diff --git a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs index a76fbbc3c23f5..134665a0f4804 100644 --- a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs +++ b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs @@ -53,7 +53,8 @@ List> tagProducer(SnapshotSpan span, CancellationToken cancell { return new List>() { new TagSpan(span, new TestTag()) }; } - var asyncListener = new TaggerOperationListener(); + + var asyncListener = new AsynchronousOperationListener(); WpfTestCase.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(LargeNumberOfSpans)} creates asynchronous taggers"); @@ -100,7 +101,7 @@ public void TestSynchronousOutlining() workspace.GetService(), workspace.GetService(), workspace.GetService(), - workspace.ExportProvider.GetExports()); + workspace.ExportProvider.GetExportedValue()); var document = workspace.Documents.First(); var textBuffer = document.TextBuffer; @@ -120,10 +121,6 @@ private static TestTaggerEventSource CreateEventSource() return new TestTaggerEventSource(); } - private sealed class TaggerOperationListener : AsynchronousOperationListener - { - } - private sealed class TestTag : TextMarkerTag { public TestTag() : diff --git a/src/EditorFeatures/Test/Threading/AsynchronousWorkerTests.cs b/src/EditorFeatures/Test/Threading/AsynchronousWorkerTests.cs index fe958312a641d..391c4b9ff72bd 100644 --- a/src/EditorFeatures/Test/Threading/AsynchronousWorkerTests.cs +++ b/src/EditorFeatures/Test/Threading/AsynchronousWorkerTests.cs @@ -28,8 +28,7 @@ public AsynchronousWorkerTests() [WpfFact] public void TestBackgroundAction() { - var listener = new AggregateAsynchronousOperationListener(Enumerable.Empty>(), "Test"); - var worker = new AsynchronousSerialWorkQueue(listener); + var worker = new AsynchronousSerialWorkQueue(AsynchronousOperationListenerProvider.NullListener); var doneEvent = new AutoResetEvent(initialState: false); var actionRan = false; @@ -49,8 +48,7 @@ public void TestBackgroundAction() public void TestMultipleBackgroundAction() { // Test that background actions don't run at the same time. - var listener = new AggregateAsynchronousOperationListener(Enumerable.Empty>(), "Test"); - var worker = new AsynchronousSerialWorkQueue(listener); + var worker = new AsynchronousSerialWorkQueue(AsynchronousOperationListenerProvider.NullListener); var doneEvent = new AutoResetEvent(false); var action1Ran = false; @@ -83,8 +81,7 @@ public void TestMultipleBackgroundAction() public void TestBackgroundCancel1() { // Ensure that we can cancel a background action. - var listener = new AggregateAsynchronousOperationListener(Enumerable.Empty>(), "Test"); - var worker = new AsynchronousSerialWorkQueue(listener); + var worker = new AsynchronousSerialWorkQueue(AsynchronousOperationListenerProvider.NullListener); var taskRunningEvent = new AutoResetEvent(false); var cancelEvent = new AutoResetEvent(false); @@ -124,8 +121,7 @@ public void TestBackgroundCancelOneAction() { // Ensure that when a background action is cancelled the next // one starts (if it has a different cancellation token). - var listener = new AggregateAsynchronousOperationListener(Enumerable.Empty>(), "Test"); - var worker = new AsynchronousSerialWorkQueue(listener); + var worker = new AsynchronousSerialWorkQueue(AsynchronousOperationListenerProvider.NullListener); var taskRunningEvent = new AutoResetEvent(false); var cancelEvent = new AutoResetEvent(false); @@ -188,8 +184,7 @@ public void TestBackgroundCancelMultipleActions() { // Ensure that multiple background actions are cancelled if they // use the same cancellation token. - var listener = new AggregateAsynchronousOperationListener(Enumerable.Empty>(), "Test"); - var worker = new AsynchronousSerialWorkQueue(listener); + var worker = new AsynchronousSerialWorkQueue(AsynchronousOperationListenerProvider.NullListener); var taskRunningEvent = new AutoResetEvent(false); var cancelEvent = new AutoResetEvent(false); diff --git a/src/EditorFeatures/Test/Utilities/AsynchronousOperationListenerTests.cs b/src/EditorFeatures/Test/Utilities/AsynchronousOperationListenerTests.cs index 2b19dde97722f..4da0137b887be 100644 --- a/src/EditorFeatures/Test/Utilities/AsynchronousOperationListenerTests.cs +++ b/src/EditorFeatures/Test/Utilities/AsynchronousOperationListenerTests.cs @@ -16,10 +16,6 @@ public class AsynchronousOperationListenerTests { private static readonly int s_testTimeout = (int)TimeSpan.FromSeconds(30).TotalMilliseconds; - private class Listener : AsynchronousOperationListener - { - } - private class SleepHelper : IDisposable { private readonly CancellationTokenSource _tokenSource; @@ -79,7 +75,7 @@ public void Operation() using (var sleepHelper = new SleepHelper()) { var signal = new ManualResetEventSlim(); - var listener = new Listener(); + var listener = new AsynchronousOperationListener(); var done = false; var asyncToken = listener.BeginAsyncOperation("Test"); @@ -103,7 +99,7 @@ public void QueuedOperation() using (var sleepHelper = new SleepHelper()) { var signal = new ManualResetEventSlim(); - var listener = new Listener(); + var listener = new AsynchronousOperationListener(); var done = false; var asyncToken1 = listener.BeginAsyncOperation("Test"); @@ -137,7 +133,7 @@ public void Cancel() using (var sleepHelper = new SleepHelper()) { var signal = new ManualResetEventSlim(); - var listener = new Listener(); + var listener = new AsynchronousOperationListener(); var done = false; var continued = false; @@ -172,7 +168,7 @@ public void Nested() using (var sleepHelper = new SleepHelper()) { var signal = new ManualResetEventSlim(); - var listener = new Listener(); + var listener = new AsynchronousOperationListener(); var outerDone = false; var innerDone = false; @@ -207,7 +203,7 @@ public void MultipleEnqueues() using (var sleepHelper = new SleepHelper()) { var signal = new ManualResetEventSlim(); - var listener = new Listener(); + var listener = new AsynchronousOperationListener(); var outerDone = false; var firstQueuedDone = false; @@ -254,7 +250,7 @@ public void IgnoredCancel() using (var sleepHelper = new SleepHelper()) { var signal = new ManualResetEventSlim(); - var listener = new Listener(); + var listener = new AsynchronousOperationListener(); var done = false; var queuedFinished = false; @@ -305,7 +301,7 @@ public void SecondCompletion() { var signal1 = new ManualResetEventSlim(); var signal2 = new ManualResetEventSlim(); - var listener = new Listener(); + var listener = new AsynchronousOperationListener(); var firstDone = false; var secondDone = false; @@ -337,7 +333,7 @@ public void SecondCompletion() } } - private static void Wait(Listener listener, ManualResetEventSlim signal) + private static void Wait(AsynchronousOperationListener listener, ManualResetEventSlim signal) { // Note: WaitTask will return immediately if there is no outstanding work. Due to // threadpool scheduling, we may get here before that other thread has started to run. @@ -348,7 +344,7 @@ private static void Wait(Listener listener, ManualResetEventSlim signal) Assert.True(waitTask.Wait(s_testTimeout), "Wait shouldn't have needed to timeout"); } - private static void Wait(Listener listener, ManualResetEventSlim signal1, ManualResetEventSlim signal2) + private static void Wait(AsynchronousOperationListener listener, ManualResetEventSlim signal1, ManualResetEventSlim signal2) { // Note: WaitTask will return immediately if there is no outstanding work. Due to // threadpool scheduling, we may get here before that other thread has started to run. diff --git a/src/EditorFeatures/Test2/Classification/ClassificationTests.vb b/src/EditorFeatures/Test2/Classification/ClassificationTests.vb index ccdff121aa0a2..be05aa2cbaa2c 100644 --- a/src/EditorFeatures/Test2/Classification/ClassificationTests.vb +++ b/src/EditorFeatures/Test2/Classification/ClassificationTests.vb @@ -33,14 +33,13 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Classification GetType(NoCompilationEditorClassificationService))) Using workspace = TestWorkspace.Create(workspaceDefinition, exportProvider:=exportProvider) - Dim waiter = New AsynchronousOperationListener() + Dim listenerProvider = New AsynchronousOperationListenerProvider() + Dim provider = New SemanticClassificationViewTaggerProvider( workspace.GetService(Of IForegroundNotificationService), workspace.GetService(Of ISemanticChangeNotificationService), workspace.GetService(Of ClassificationTypeMap), - SpecializedCollections.SingletonEnumerable( - New Lazy(Of IAsynchronousOperationListener, FeatureMetadata)( - Function() waiter, New FeatureMetadata(New Dictionary(Of String, Object)() From {{"FeatureName", FeatureAttribute.Classification}})))) + listenerProvider) Dim buffer = workspace.Documents.First().GetTextBuffer() Dim tagger = provider.CreateTagger(Of IClassificationTag)( @@ -53,7 +52,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Classification End Using Using DirectCast(tagger, IDisposable) - Await waiter.CreateWaitTask() + Await listenerProvider.GetWaiter(FeatureAttribute.Classification).CreateWaitTask() ' Note: we don't actually care what results we get back. We're just ' verifying that we don't crash because the SemanticViewTagger ends up diff --git a/src/EditorFeatures/Test2/FindReferences/FindReferencesCommandHandlerTests.vb b/src/EditorFeatures/Test2/FindReferences/FindReferencesCommandHandlerTests.vb index 56746f6ec44ce..6b17b11fff22f 100644 --- a/src/EditorFeatures/Test2/FindReferences/FindReferencesCommandHandlerTests.vb +++ b/src/EditorFeatures/Test2/FindReferences/FindReferencesCommandHandlerTests.vb @@ -34,19 +34,19 @@ class C view.Selection.Select( testDocument.AnnotatedSpans("Selection").Single().ToSnapshotSpan(snapshot), isReversed:=False) - Dim waiter = New Waiter() + Dim listenerProvider = New AsynchronousOperationListenerProvider() Dim context = New FindReferencesTests.TestContext() Dim commandHandler = New FindReferencesCommandHandler( {}, {New Lazy(Of IStreamingFindUsagesPresenter)(Function() New MockStreamingFindReferencesPresenter(context))}, - {New Lazy(Of IAsynchronousOperationListener, FeatureMetadata)(Function() waiter, New FeatureMetadata(FeatureAttribute.FindReferences))}) + listenerProvider) Dim document = workspace.CurrentSolution.GetDocument(testDocument.Id) commandHandler.ExecuteCommand( New FindReferencesCommandArgs(view, textBuffer), Utilities.TestCommandExecutionContext.Create()) ' Wait for the find refs to be done. - Await waiter.CreateWaitTask() + Await listenerProvider.GetWaiter(FeatureAttribute.FindReferences).CreateWaitTask() Assert.Equal(1, context.Definitions.Count) Assert.Equal(testDocument.AnnotatedSpans("Definition").Single(), @@ -75,10 +75,5 @@ class C Return _context End Function End Class - - Private Class Waiter - Inherits AsynchronousOperationListener - - End Class End Class End Namespace diff --git a/src/EditorFeatures/Test2/IntelliSense/QuickInfoControllerTests.vb b/src/EditorFeatures/Test2/IntelliSense/QuickInfoControllerTests.vb index d4c27b3fb067f..e99aed1995dbc 100644 --- a/src/EditorFeatures/Test2/IntelliSense/QuickInfoControllerTests.vb +++ b/src/EditorFeatures/Test2/IntelliSense/QuickInfoControllerTests.vb @@ -230,7 +230,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense Public ReadOnly DocumentProvider As Mock(Of IDocumentProvider) Public ReadOnly Provider As Mock(Of IQuickInfoProvider) - Public Sub New(view As Mock(Of ITextView), buffer As ITextBuffer, presenter As Mock(Of IIntelliSensePresenter(Of IQuickInfoPresenterSession, IQuickInfoSession)), asyncListener As Mock(Of IAsynchronousOperationListener), documentProvider As Mock(Of IDocumentProvider), provider As Mock(Of IQuickInfoProvider)) + Public Sub New(view As Mock(Of ITextView), + buffer As ITextBuffer, + presenter As Mock(Of IIntelliSensePresenter(Of IQuickInfoPresenterSession, IQuickInfoSession)), + asyncListener As Mock(Of IAsynchronousOperationListener), + documentProvider As Mock(Of IDocumentProvider), provider As Mock(Of IQuickInfoProvider)) Me.View = view Me.Buffer = buffer Me.Presenter = presenter diff --git a/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb b/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb index e3800d8e7931e..641389d91a74b 100644 --- a/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb +++ b/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb @@ -355,7 +355,13 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense Public ReadOnly DocumentProvider As Mock(Of IDocumentProvider) Public ReadOnly Provider As MockSignatureHelpProvider - Public Sub New(view As Mock(Of ITextView), buffer As ITextBuffer, presenter As Mock(Of IIntelliSensePresenter(Of ISignatureHelpPresenterSession, ISignatureHelpSession)), presenterSession As Mock(Of ISignatureHelpPresenterSession), asyncListener As Mock(Of IAsynchronousOperationListener), documentProvider As Mock(Of IDocumentProvider), provider As MockSignatureHelpProvider) + Public Sub New(view As Mock(Of ITextView), + buffer As ITextBuffer, + presenter As Mock(Of IIntelliSensePresenter(Of ISignatureHelpPresenterSession, ISignatureHelpSession)), + presenterSession As Mock(Of ISignatureHelpPresenterSession), + asyncListener As Mock(Of IAsynchronousOperationListener), + documentProvider As Mock(Of IDocumentProvider), + provider As MockSignatureHelpProvider) Me.View = view Me.Buffer = buffer Me.Presenter = presenter diff --git a/src/EditorFeatures/Test2/KeywordHighlighting/AbstractKeywordHighlightingTests.vb b/src/EditorFeatures/Test2/KeywordHighlighting/AbstractKeywordHighlightingTests.vb index 8e292c2785798..fd38a2a737414 100644 --- a/src/EditorFeatures/Test2/KeywordHighlighting/AbstractKeywordHighlightingTests.vb +++ b/src/EditorFeatures/Test2/KeywordHighlighting/AbstractKeywordHighlightingTests.vb @@ -30,7 +30,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.KeywordHighlighting Dim tagProducer = New HighlighterViewTaggerProvider( highlightingService, workspace.GetService(Of IForegroundNotificationService), - AggregateAsynchronousOperationListener.EmptyListeners) + AsynchronousOperationListenerProvider.NullProvider) Dim context = New TaggerContext(Of KeywordHighlightTag)(document, snapshot, New SnapshotPoint(snapshot, caretPosition)) Await tagProducer.ProduceTagsAsync_ForTestingPurposesOnly(context) diff --git a/src/EditorFeatures/Test2/NavigationBar/NavigationBarPresenterTests.vb b/src/EditorFeatures/Test2/NavigationBar/NavigationBarPresenterTests.vb index df507b4f46b6b..2494d24c34d1f 100644 --- a/src/EditorFeatures/Test2/NavigationBar/NavigationBarPresenterTests.vb +++ b/src/EditorFeatures/Test2/NavigationBar/NavigationBarPresenterTests.vb @@ -1,6 +1,5 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -Imports System.Composition Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis.Shared.TestHooks Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces @@ -9,25 +8,7 @@ Imports Microsoft.VisualStudio.Composition Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar Public Class NavigationBarControllerTests - Friend ReadOnly ExportProvider As ExportProvider = MinimalTestExportProvider.CreateExportProvider(TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithPart(GetType(NavigationBarWaiter)).WithPart(GetType(WorkspaceWaiter))) - - <[Shared]> - - - - - Private Class NavigationBarWaiter - Inherits AsynchronousOperationListener - End Class - - <[Shared]> - - - - - Private Class WorkspaceWaiter - Inherits AsynchronousOperationListener - End Class + Friend ReadOnly ExportProvider As ExportProvider = MinimalTestExportProvider.CreateExportProvider(TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic) Public Sub TestDoNotRecomputeAfterFullRecompute() @@ -85,8 +66,8 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar Dim controllerFactory = workspace.GetService(Of INavigationBarControllerFactoryService)() Dim controller = controllerFactory.CreateController(mockPresenter, subjectDocument.TextBuffer) - Dim waiters = workspace.ExportProvider.GetExportedValues(Of IAsynchronousOperationWaiter) - Await waiters.WaitAllAsync() + Dim provider = ExportProvider.GetExportedValue(Of AsynchronousOperationListenerProvider) + Await provider.WaitAllDispatcherOperationAndTasksAsync(FeatureAttribute.Workspace, FeatureAttribute.NavigationBar) Assert.True(presentItemsCalled) End Using @@ -326,9 +307,15 @@ End Class workspace.OnProjectNameChanged(workspace.Projects.Single().Id, "VBProj2", "VBProj2.vbproj") - Await workspace.ExportProvider.GetExports(Of IAsynchronousOperationWaiter, FeatureMetadata)().Where(Function(l) l.Metadata.FeatureName = FeatureAttribute.Workspace).Single().Value.CreateWaitTask() - Await workspace.ExportProvider.GetExports(Of IAsynchronousOperationWaiter, FeatureMetadata)().Where(Function(l) l.Metadata.FeatureName = FeatureAttribute.NavigationBar).Single().Value.CreateWaitTask() - Await workspace.ExportProvider.GetExportedValues(Of IAsynchronousOperationWaiter).WaitAllAsync() + Dim listenerProvider = workspace.ExportProvider.GetExportedValue(Of AsynchronousOperationListenerProvider)() + Dim workspaceWaiter = listenerProvider.GetWaiter(FeatureAttribute.Workspace) + Dim navigationBarWaiter = listenerProvider.GetWaiter(FeatureAttribute.NavigationBar) + + Await workspaceWaiter.CreateWaitTask() + Await navigationBarWaiter.CreateWaitTask() + + Await listenerProvider.WaitAllDispatcherOperationAndTasksAsync(FeatureAttribute.Workspace, FeatureAttribute.NavigationBar) + Assert.Equal("VBProj2", projectName) End Using End Function diff --git a/src/EditorFeatures/Test2/ReferenceHighlighting/AbstractReferenceHighlightingTests.vb b/src/EditorFeatures/Test2/ReferenceHighlighting/AbstractReferenceHighlightingTests.vb index e684b05363029..35c3d66528894 100644 --- a/src/EditorFeatures/Test2/ReferenceHighlighting/AbstractReferenceHighlightingTests.vb +++ b/src/EditorFeatures/Test2/ReferenceHighlighting/AbstractReferenceHighlightingTests.vb @@ -33,7 +33,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.ReferenceHighlighting Dim tagProducer = New ReferenceHighlightingViewTaggerProvider( workspace.GetService(Of IForegroundNotificationService), workspace.GetService(Of ISemanticChangeNotificationService), - AggregateAsynchronousOperationListener.EmptyListeners) + AsynchronousOperationListenerProvider.NullProvider) Dim hostDocument = workspace.Documents.Single(Function(d) d.CursorPosition.HasValue) Dim caretPosition = hostDocument.CursorPosition.Value diff --git a/src/EditorFeatures/Test2/Rename/DashboardTests.vb b/src/EditorFeatures/Test2/Rename/DashboardTests.vb index 5a594e62f9cb5..d75ce045eaf5c 100644 --- a/src/EditorFeatures/Test2/Rename/DashboardTests.vb +++ b/src/EditorFeatures/Test2/Rename/DashboardTests.vb @@ -589,9 +589,6 @@ class D : B edit.Apply() End Using - Dim listeners = DirectCast(workspace.ExportProvider.GetExports(Of IAsynchronousOperationListener, FeatureMetadata)(), IEnumerable(Of Lazy(Of IAsynchronousOperationListener, FeatureMetadata))) - Dim renameListener = New AggregateAsynchronousOperationListener(listeners, FeatureAttribute.Rename) - Using dashboard = New Dashboard( New DashboardViewModel(DirectCast(sessionInfo.Session, InlineRenameSession)), editorFormatMapService:=Nothing, diff --git a/src/EditorFeatures/Test2/Rename/RenameTestHelpers.vb b/src/EditorFeatures/Test2/Rename/RenameTestHelpers.vb index 18ef23f263e40..f938145ad1eb4 100644 --- a/src/EditorFeatures/Test2/Rename/RenameTestHelpers.vb +++ b/src/EditorFeatures/Test2/Rename/RenameTestHelpers.vb @@ -23,13 +23,13 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename Friend _exportProvider As ExportProvider = MinimalTestExportProvider.CreateExportProvider( - TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(GetType(MockDocumentNavigationServiceFactory), GetType(RenameWaiter))) + TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(GetType(MockDocumentNavigationServiceFactory))) Friend ReadOnly Property ExportProvider As ExportProvider Get If _exportProvider Is Nothing Then _exportProvider = MinimalTestExportProvider.CreateExportProvider( - TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(GetType(MockDocumentNavigationServiceFactory), GetType(RenameWaiter))) + TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(GetType(MockDocumentNavigationServiceFactory))) End If Return _exportProvider @@ -111,8 +111,8 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename End Function Public Async Function WaitForRename(workspace As TestWorkspace) As Task - Dim waiters = workspace.ExportProvider.GetExportedValues(Of IAsynchronousOperationWaiter) - Await waiters.WaitAllAsync() + Dim provider = workspace.ExportProvider.GetExportedValue(Of AsynchronousOperationListenerProvider) + Await provider.WaitAllDispatcherOperationAndTasksAsync(FeatureAttribute.EventHookup, FeatureAttribute.Rename) End Function Public Function CreateRenameTrackingTagger(workspace As TestWorkspace, document As TestHostDocument) As ITagger(Of RenameTrackingTag) @@ -122,7 +122,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename workspace.ExportProvider.GetExport(Of IInlineRenameService)().Value, workspace.ExportProvider.GetExport(Of IDiagnosticAnalyzerService)().Value, {New MockRefactorNotifyService()}, - DirectCast(workspace.ExportProvider.GetExports(Of IAsynchronousOperationListener, FeatureMetadata), IEnumerable(Of Lazy(Of IAsynchronousOperationListener, FeatureMetadata)))) + workspace.ExportProvider.GetExportedValue(Of IAsynchronousOperationListenerProvider)) Return tracker.CreateTagger(Of RenameTrackingTag)(document.GetTextBuffer()) End Function diff --git a/src/EditorFeatures/Test2/Rename/RenameWaiter.vb b/src/EditorFeatures/Test2/Rename/RenameWaiter.vb deleted file mode 100644 index 1756d071d35cc..0000000000000 --- a/src/EditorFeatures/Test2/Rename/RenameWaiter.vb +++ /dev/null @@ -1,14 +0,0 @@ -' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -Imports System.Composition -Imports Microsoft.CodeAnalysis.Shared.TestHooks - -Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename - <[Shared]> - - - - Friend Class RenameWaiter - Inherits AsynchronousOperationListener - End Class -End Namespace diff --git a/src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs b/src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs index 7fbf02e01658b..0c8d3b922089a 100644 --- a/src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs +++ b/src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs @@ -295,14 +295,14 @@ public CaretPosition GetCaretPoint() /// public void AssertNoAsynchronousOperationsRunning() { - var waiters = Workspace.ExportProvider.GetExportedValues(); - Assert.False(waiters.Any(x => x.HasPendingWork), "IAsyncTokens unexpectedly alive. Call WaitForAsynchronousOperationsAsync before this method"); + var provider = Workspace.ExportProvider.GetExportedValue(); + Assert.False(provider.HasPendingWaiter(FeatureAttribute.EventHookup, FeatureAttribute.CompletionSet, FeatureAttribute.SignatureHelp), "IAsyncTokens unexpectedly alive. Call WaitForAsynchronousOperationsAsync before this method"); } public async Task WaitForAsynchronousOperationsAsync() { - var waiters = Workspace.ExportProvider.GetExportedValues(); - await waiters.WaitAllAsync(); + var provider = Workspace.ExportProvider.GetExportedValue(); + await provider.WaitAllDispatcherOperationAndTasksAsync(FeatureAttribute.EventHookup, FeatureAttribute.CompletionSet, FeatureAttribute.SignatureHelp); } public void AssertMatchesTextStartingAtLine(int line, string text) diff --git a/src/EditorFeatures/TestUtilities/AsynchronousOperationListenerExtensions.cs b/src/EditorFeatures/TestUtilities/AsynchronousOperationListenerExtensions.cs new file mode 100644 index 0000000000000..967f76e727e31 --- /dev/null +++ b/src/EditorFeatures/TestUtilities/AsynchronousOperationListenerExtensions.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Threading.Tasks; +using System.Windows.Threading; +using Microsoft.CodeAnalysis.Shared.TestHooks; + +namespace Roslyn.Test.Utilities +{ + public static class AsynchronousOperationListenerExtensions + { + internal static Task WaitAllDispatcherOperationAndTasksAsync(this IAsynchronousOperationListenerProvider provider, params string[] featureNames) + { + return ((AsynchronousOperationListenerProvider)provider).WaitAllAsync(featureNames, eventProcessingAction: () => Dispatcher.CurrentDispatcher.DoEvents()); + } + } +} diff --git a/src/EditorFeatures/TestUtilities/BraceHighlighting/AbstractBraceHighlightingTests.cs b/src/EditorFeatures/TestUtilities/BraceHighlighting/AbstractBraceHighlightingTests.cs index 5b6f505240225..e34ac1997d21a 100644 --- a/src/EditorFeatures/TestUtilities/BraceHighlighting/AbstractBraceHighlightingTests.cs +++ b/src/EditorFeatures/TestUtilities/BraceHighlighting/AbstractBraceHighlightingTests.cs @@ -25,7 +25,7 @@ protected async Task TestBraceHighlightingAsync(string markup, ParseOptions opti var provider = new BraceHighlightingViewTaggerProvider( GetBraceMatchingService(workspace), workspace.GetService(), - AggregateAsynchronousOperationListener.EmptyListeners); + AsynchronousOperationListenerProvider.NullProvider); var testDocument = workspace.Documents.First(); var buffer = testDocument.TextBuffer; diff --git a/src/EditorFeatures/TestUtilities/Diagnostics/DiagnosticTaggerWrapper.cs b/src/EditorFeatures/TestUtilities/Diagnostics/DiagnosticTaggerWrapper.cs index f5464b3d6ca2a..f6a4eac28dbe9 100644 --- a/src/EditorFeatures/TestUtilities/Diagnostics/DiagnosticTaggerWrapper.cs +++ b/src/EditorFeatures/TestUtilities/Diagnostics/DiagnosticTaggerWrapper.cs @@ -23,9 +23,8 @@ internal class DiagnosticTaggerWrapper : IDisposable private readonly ISolutionCrawlerRegistrationService _registrationService; private readonly ImmutableArray _incrementalAnalyzers; private readonly SolutionCrawlerRegistrationService _solutionCrawlerService; - private readonly AsynchronousOperationListener _asyncListener; public readonly DiagnosticService DiagnosticService; - private readonly IEnumerable> _listeners; + private readonly AsynchronousOperationListenerProvider _listenerProvider; private ITaggerProvider _taggerProvider; @@ -59,14 +58,11 @@ private DiagnosticTaggerWrapper( IDiagnosticUpdateSource updateSource, bool createTaggerProvider) { - _asyncListener = new AsynchronousOperationListener(); - _listeners = AsynchronousOperationListener.CreateListeners( - ValueTuple.Create(FeatureAttribute.DiagnosticService, _asyncListener), - ValueTuple.Create(FeatureAttribute.ErrorSquiggles, _asyncListener)); + _listenerProvider = new AsynchronousOperationListenerProvider(); if (analyzerMap != null || updateSource == null) { - AnalyzerService = CreateDiagnosticAnalyzerService(analyzerMap, _asyncListener); + AnalyzerService = CreateDiagnosticAnalyzerService(analyzerMap, _listenerProvider.GetListener(FeatureAttribute.DiagnosticService)); } if (updateSource == null) @@ -79,7 +75,7 @@ private DiagnosticTaggerWrapper( _registrationService = workspace.Services.GetService(); _registrationService.Register(workspace); - DiagnosticService = new DiagnosticService(_listeners); + DiagnosticService = new DiagnosticService(_listenerProvider); DiagnosticService.Register(updateSource); if (createTaggerProvider) @@ -105,13 +101,13 @@ public ITaggerProvider TaggerProvider if (typeof(TProvider) == typeof(DiagnosticsSquiggleTaggerProvider)) { _taggerProvider = new DiagnosticsSquiggleTaggerProvider( - DiagnosticService, _workspace.GetService(), _listeners); + DiagnosticService, _workspace.GetService(), _listenerProvider); } else if (typeof(TProvider) == typeof(DiagnosticsSuggestionTaggerProvider)) { _taggerProvider = new DiagnosticsSuggestionTaggerProvider( DiagnosticService, - _workspace.GetService(), _listeners); + _workspace.GetService(), _listenerProvider); } else { @@ -135,7 +131,8 @@ public async Task WaitForTags() _solutionCrawlerService.WaitUntilCompletion_ForTestingPurposesOnly(_workspace, _incrementalAnalyzers); } - await _asyncListener.CreateWaitTask(); + await _listenerProvider.GetWaiter(FeatureAttribute.DiagnosticService).CreateWaitTask(); + await _listenerProvider.GetWaiter(FeatureAttribute.ErrorSquiggles).CreateWaitTask(); } private class MyDiagnosticAnalyzerService : DiagnosticAnalyzerService diff --git a/src/EditorFeatures/TestUtilities/EventHookup/EventHookupWaiter.cs b/src/EditorFeatures/TestUtilities/EventHookup/EventHookupWaiter.cs deleted file mode 100644 index 3d41183a9732c..0000000000000 --- a/src/EditorFeatures/TestUtilities/EventHookup/EventHookupWaiter.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.EventHookup -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.EventHookup)] - internal sealed class EventHookupWaiter : AsynchronousOperationListener - { - } -} diff --git a/src/EditorFeatures/TestUtilities/MinimalTestExportProvider.cs b/src/EditorFeatures/TestUtilities/MinimalTestExportProvider.cs index 88584f3ef0837..9dbc80f8bb102 100644 --- a/src/EditorFeatures/TestUtilities/MinimalTestExportProvider.cs +++ b/src/EditorFeatures/TestUtilities/MinimalTestExportProvider.cs @@ -6,6 +6,7 @@ using System.Reflection; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.UnitTests.Utilities; +using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.SymbolMapping; using Microsoft.VisualStudio.Composition; using Roslyn.Utilities; @@ -125,6 +126,9 @@ public static PartDiscovery CreatePartDiscovery(Resolver resolver) public static ExportProvider CreateExportProvider(ComposableCatalog catalog) { + // make sure we enable this for all unit tests + AsynchronousOperationListenerProvider.Enable(true); + var configuration = CompositionConfiguration.Create(catalog.WithCompositionService()); var runtimeComposition = RuntimeComposition.CreateRuntimeComposition(configuration); return runtimeComposition.CreateExportProviderFactory().CreateExportProvider(); diff --git a/src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs b/src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs index 80bb714144547..03ea7a9a58945 100644 --- a/src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs +++ b/src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs @@ -92,9 +92,7 @@ protected TestWorkspace SetupWorkspace(string content) internal void InitializeWorkspace(TestWorkspace workspace) { - var aggregateListener = AggregateAsynchronousOperationListener.CreateEmptyListener(); - - _provider = new NavigateToItemProvider(workspace, aggregateListener); + _provider = new NavigateToItemProvider(workspace, AsynchronousOperationListenerProvider.NullListener); _aggregator = new NavigateToTestAggregator(_provider); } diff --git a/src/EditorFeatures/TestUtilities/TestExportProvider.cs b/src/EditorFeatures/TestUtilities/TestExportProvider.cs index ab56ce04ff7bf..5bcc3e468047b 100644 --- a/src/EditorFeatures/TestUtilities/TestExportProvider.cs +++ b/src/EditorFeatures/TestUtilities/TestExportProvider.cs @@ -79,6 +79,7 @@ private static Type[] GetNeutralAndCSharpAndVisualBasicTypes() typeof(CodeAnalysis.CSharp.Execution.CSharpOptionsSerializationService), typeof(CodeAnalysis.VisualBasic.Execution.VisualBasicOptionsSerializationService), typeof(CodeAnalysis.Execution.DesktopReferenceSerializationServiceFactory), + typeof(CodeAnalysis.Shared.TestHooks.AsynchronousOperationListenerProvider), typeof(TestExportProvider) }; diff --git a/src/EditorFeatures/TestUtilities2/Intellisense/CompletionWaiter.vb b/src/EditorFeatures/TestUtilities2/Intellisense/CompletionWaiter.vb deleted file mode 100644 index b0728ff264cf2..0000000000000 --- a/src/EditorFeatures/TestUtilities2/Intellisense/CompletionWaiter.vb +++ /dev/null @@ -1,15 +0,0 @@ -' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -Imports System.Composition -Imports Microsoft.CodeAnalysis.Shared.TestHooks - -Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense - <[Shared]> - - - - Friend Class CompletionWaiter - Inherits AsynchronousOperationListener - - End Class -End Namespace diff --git a/src/EditorFeatures/TestUtilities2/Intellisense/SignatureHelpWaiter.vb b/src/EditorFeatures/TestUtilities2/Intellisense/SignatureHelpWaiter.vb deleted file mode 100644 index a9f864f676aed..0000000000000 --- a/src/EditorFeatures/TestUtilities2/Intellisense/SignatureHelpWaiter.vb +++ /dev/null @@ -1,15 +0,0 @@ -' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -Imports System.Composition -Imports Microsoft.CodeAnalysis.Shared.TestHooks - -Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense - <[Shared]> - - - - Friend Class SignatureHelpWaiter - Inherits AsynchronousOperationListener - - End Class -End Namespace diff --git a/src/EditorFeatures/TestUtilities2/Intellisense/TestState.vb b/src/EditorFeatures/TestUtilities2/Intellisense/TestState.vb index 5ded540ea98fd..f86151c4472fb 100644 --- a/src/EditorFeatures/TestUtilities2/Intellisense/TestState.vb +++ b/src/EditorFeatures/TestUtilities2/Intellisense/TestState.vb @@ -52,7 +52,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense Optional extraExportedTypes As List(Of Type) = Nothing, Optional includeFormatCommandHandler As Boolean = False, Optional workspaceKind As String = Nothing) - MyBase.New(workspaceElement, CreatePartCatalog(extraExportedTypes), workspaceKind:=workspaceKind) + MyBase.New(workspaceElement, MinimalTestExportProvider.CreateTypeCatalog(If(extraExportedTypes, New List(Of Type))), workspaceKind:=workspaceKind) Dim languageServices = Me.Workspace.CurrentSolution.Projects.First().LanguageServices Dim language = languageServices.Language @@ -66,7 +66,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense GetService(Of IEditorOperationsFactoryService)(), UndoHistoryRegistry, GetService(Of IInlineRenameService)(), - GetExports(Of IAsynchronousOperationListener, FeatureMetadata)(), + GetExportedValue(Of IAsynchronousOperationListenerProvider), {New Lazy(Of IIntelliSensePresenter(Of ICompletionPresenterSession, ICompletionSession), OrderableMetadata)(Function() New TestCompletionPresenter(Me), New OrderableMetadata("Presenter"))}, GetExports(Of IBraceCompletionSessionProvider, BraceCompletionMetadata)()) @@ -75,7 +75,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense Me.SignatureHelpCommandHandler = New SignatureHelpCommandHandler( New TestSignatureHelpPresenter(Me), GetExports(Of ISignatureHelpProvider, OrderableLanguageMetadata)().Concat(extraSignatureHelpProviders), - GetExports(Of IAsynchronousOperationListener, FeatureMetadata)()) + GetExportedValue(Of IAsynchronousOperationListenerProvider)()) Me.IntelliSenseCommandHandler = New IntelliSenseCommandHandler(CompletionCommandHandler, SignatureHelpCommandHandler, Nothing) @@ -86,15 +86,6 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense Nothing) End Sub - Private Shared Function CreatePartCatalog(types As List(Of Type)) As ComposableCatalog - types = If(types, New List(Of Type)) - - types.Add(GetType(CompletionWaiter)) - types.Add(GetType(SignatureHelpWaiter)) - - Return MinimalTestExportProvider.CreateTypeCatalog(types) - End Function - Public Shared Function CreateVisualBasicTestState( documentElement As XElement, Optional extraCompletionProviders As CompletionProvider() = Nothing, diff --git a/src/EditorFeatures/VisualBasic/EncapsulateField/EncapsulateFieldCommandHandler.vb b/src/EditorFeatures/VisualBasic/EncapsulateField/EncapsulateFieldCommandHandler.vb index 38dba312b20e3..9ab592e65d24a 100644 --- a/src/EditorFeatures/VisualBasic/EncapsulateField/EncapsulateFieldCommandHandler.vb +++ b/src/EditorFeatures/VisualBasic/EncapsulateField/EncapsulateFieldCommandHandler.vb @@ -17,8 +17,8 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.EncapsulateField Public Sub New(undoManager As ITextBufferUndoManagerProvider, - asyncListeners As IEnumerable(Of Lazy(Of IAsynchronousOperationListener, FeatureMetadata))) - MyBase.New(undoManager, asyncListeners) + listenerProvider As IAsynchronousOperationListenerProvider) + MyBase.New(undoManager, listenerProvider) End Sub End Class End Namespace diff --git a/src/EditorFeatures/VisualBasicTest/AddAccessibilityModifiers/AddAccessibilityModifiersTests.vb b/src/EditorFeatures/VisualBasicTest/AddAccessibilityModifiers/AddAccessibilityModifiersTests.vb index 0c6767a60cea9..fdeb344819a3b 100644 --- a/src/EditorFeatures/VisualBasicTest/AddAccessibilityModifiers/AddAccessibilityModifiersTests.vb +++ b/src/EditorFeatures/VisualBasicTest/AddAccessibilityModifiers/AddAccessibilityModifiersTests.vb @@ -4,6 +4,8 @@ Imports Microsoft.CodeAnalysis.CodeFixes Imports Microsoft.CodeAnalysis.Diagnostics Imports Microsoft.CodeAnalysis.VisualBasic.AddAccessibilityModifiers Imports Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics +Imports Microsoft.CodeAnalysis.Options +Imports Microsoft.CodeAnalysis.CodeStyle Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.AddAccessibilityModifiers Public Class AddAccessibilityModifiersTests @@ -14,6 +16,14 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.AddAccessibilityMo New VisualBasicAddAccessibilityModifiersCodeFixProvider()) End Function + Private ReadOnly Property OmitDefaultModifiers As IDictionary(Of OptionKey, Object) + Get + Return OptionsSet( + SingleOption(CodeStyleOptions.RequireAccessibilityModifiers, AccessibilityModifiersRequired.OmitIfDefault, NotificationOption.Suggestion)) + End Get + End Property + + Public Async Function TestAllConstructs() As Task Await TestInRegularAndScriptAsync( @@ -95,7 +105,7 @@ namespace N dim f as integer sub M() - end sub() + end sub shared operator &(c1 as S, c2 as S) as integer end operator @@ -105,7 +115,7 @@ namespace N dim f as integer sub M() - end sub() + end sub end module end namespace end namespace", @@ -187,7 +197,7 @@ namespace N Public f as integer Public sub M() - end sub() + end sub Public shared operator &(c1 as S, c2 as S) as integer end operator @@ -197,10 +207,224 @@ namespace N Private f as integer Public sub M() - end sub() + end sub end module end namespace end namespace") End Function + + + Public Async Function TestAllConstructsWithOmit() As Task + Await TestInRegularAndScriptAsync( +" +namespace N + namespace Outer.Inner + Friend class {|FixAllInDocument:C|} + Public class NestedClass + end class + + Public structure NestedStruct + end structure + + Private f1 as integer + Private f2, f3 as integer + Private f4, f5 as integer, f6, f7 as boolean + public f4 as integer + + Private Const foo As long = 3 + private const bar = 4, barbar = 5 + + public Const pfoo As long = 3 + public Const pbar = 4, pbarbar As ULong = 5 + + Private Shared sfoo = 4 + private shared sbar as Long = 5, sbarbar = 0 + + public Shared spfoo = 4 + public Shared spbar = 4, spbarbar as Long = 4 + + Public event e1 as Action + public event e2 as Action + + Public custom event e4 as Action + end event + + shared sub new() + end sub + + Public sub new() + end sub + + public sub new(i as integer) + end sub + + Public sub M1() + end sub + + public sub M2() + end sub + + Public function M3() as integer + end function + + Public function M4() as integer + + public function M5() as integer + end function + + Private partial sub M6() + end sub + + Public property P1 as integer + + Public property P2 as integer + get + end get + end property + + public property P3 as integer + + Public shared operator &(c1 as C, c2 as C) as integer + end operator + end class + + Friend interface I + event e6 as Action + sub M3() + function M4() as integer + property P3 as integer + end interface + + Friend delegate sub D1() + Friend delegate function D2() as integer + + Friend enum E + EMember + end enum + + Friend structure S + Public f as integer + + Public sub M() + end sub + + Public shared operator &(c1 as S, c2 as S) as integer + end operator + end structure + + Friend module M + Private f as integer + + Public sub M() + end sub + end module + end namespace +end namespace", +" +namespace N + namespace Outer.Inner + class C + class NestedClass + end class + + structure NestedStruct + end structure + + Dim f1 as integer + Dim f2, f3 as integer + Dim f4, f5 as integer, f6, f7 as boolean + public f4 as integer + + Const foo As long = 3 + const bar = 4, barbar = 5 + + public Const pfoo As long = 3 + public Const pbar = 4, pbarbar As ULong = 5 + + Shared sfoo = 4 + shared sbar as Long = 5, sbarbar = 0 + + public Shared spfoo = 4 + public Shared spbar = 4, spbarbar as Long = 4 + + event e1 as Action + event e2 as Action + + custom event e4 as Action + end event + + shared sub new() + end sub + + sub new() + end sub + + sub new(i as integer) + end sub + + sub M1() + end sub + + sub M2() + end sub + + function M3() as integer + end function + + function M4() as integer + + function M5() as integer + end function + + Private partial sub M6() + end sub + + property P1 as integer + + property P2 as integer + get + end get + end property + + property P3 as integer + + shared operator &(c1 as C, c2 as C) as integer + end operator + end class + + interface I + event e6 as Action + sub M3() + function M4() as integer + property P3 as integer + end interface + + delegate sub D1() + delegate function D2() as integer + + enum E + EMember + end enum + + structure S + Dim f as integer + + sub M() + end sub + + shared operator &(c1 as S, c2 as S) as integer + end operator + end structure + + module M + Dim f as integer + + sub M() + end sub + end module + end namespace +end namespace", options:=OmitDefaultModifiers) + End Function + End Class End Namespace diff --git a/src/EditorFeatures/VisualBasicTest/BraceMatching/BraceHighlightingTests.vb b/src/EditorFeatures/VisualBasicTest/BraceMatching/BraceHighlightingTests.vb index bc6fffaa72670..8ddc16855c7cc 100644 --- a/src/EditorFeatures/VisualBasicTest/BraceMatching/BraceHighlightingTests.vb +++ b/src/EditorFeatures/VisualBasicTest/BraceMatching/BraceHighlightingTests.vb @@ -24,7 +24,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.BraceMatching Dim producer = New BraceHighlightingViewTaggerProvider( workspace.GetService(Of IBraceMatchingService), workspace.GetService(Of IForegroundNotificationService), - AggregateAsynchronousOperationListener.EmptyListeners) + AsynchronousOperationListenerProvider.NullProvider) Dim doc = buffer.CurrentSnapshot.GetRelatedDocumentsWithChanges().FirstOrDefault() Dim context = New TaggerContext(Of BraceHighlightTag)( diff --git a/src/EditorFeatures/VisualBasicTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.vb b/src/EditorFeatures/VisualBasicTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.vb index 89b1e2f6304e1..398bd61399bf1 100644 --- a/src/EditorFeatures/VisualBasicTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.vb +++ b/src/EditorFeatures/VisualBasicTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.vb @@ -153,7 +153,7 @@ End Class Dim textView = workspace.Documents.Single().GetTextView() Dim handler = New EncapsulateFieldCommandHandler(workspace.GetService(Of ITextBufferUndoManagerProvider), - workspace.ExportProvider.GetExportedValues(Of Lazy(Of IAsynchronousOperationListener, FeatureMetadata))) + workspace.ExportProvider.GetExportedValue(Of IAsynchronousOperationListenerProvider)()) Dim state = handler.GetCommandState(New EncapsulateFieldCommandArgs(textView, textView.TextBuffer)) Assert.True(state.IsUnspecified) End Using diff --git a/src/EditorFeatures/VisualBasicTest/EncapsulateField/EncapsulateFieldTestState.vb b/src/EditorFeatures/VisualBasicTest/EncapsulateField/EncapsulateFieldTestState.vb index 8cb4a21276c66..b35fa20308879 100644 --- a/src/EditorFeatures/VisualBasicTest/EncapsulateField/EncapsulateFieldTestState.vb +++ b/src/EditorFeatures/VisualBasicTest/EncapsulateField/EncapsulateFieldTestState.vb @@ -38,7 +38,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.EncapsulateField Public Sub Encapsulate() Dim args = New EncapsulateFieldCommandArgs(_testDocument.GetTextView(), _testDocument.GetTextBuffer()) Dim commandHandler = New EncapsulateFieldCommandHandler(Workspace.GetService(Of ITextBufferUndoManagerProvider)(), - Workspace.ExportProvider.GetExportedValues(Of Lazy(Of IAsynchronousOperationListener, FeatureMetadata))) + Workspace.ExportProvider.GetExportedValue(Of IAsynchronousOperationListenerProvider)) commandHandler.ExecuteCommand(args, TestCommandExecutionContext.Create()) End Sub diff --git a/src/EditorFeatures/VisualBasicTest/QuickInfo/SemanticQuickInfoSourceTests.vb b/src/EditorFeatures/VisualBasicTest/QuickInfo/SemanticQuickInfoSourceTests.vb index 822c7378e686d..72f9457cac18a 100644 --- a/src/EditorFeatures/VisualBasicTest/QuickInfo/SemanticQuickInfoSourceTests.vb +++ b/src/EditorFeatures/VisualBasicTest/QuickInfo/SemanticQuickInfoSourceTests.vb @@ -1,15 +1,10 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. Imports System.Threading -Imports Microsoft.CodeAnalysis.Editor.Shared.Utilities Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions Imports Microsoft.CodeAnalysis.Editor.UnitTests.QuickInfo Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.Editor.VisualBasic.QuickInfo -Imports Microsoft.CodeAnalysis.Shared.TestHooks -Imports Microsoft.VisualStudio.Language.Intellisense -Imports Microsoft.VisualStudio.Text.Editor -Imports Microsoft.VisualStudio.Text.Projection Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.QuickInfo Public Class SemanticQuickInfoSourceTests @@ -20,8 +15,6 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.QuickInfo End Function Protected Async Function TestSharedAsync(workspace As TestWorkspace, position As Integer, ParamArray expectedResults() As Action(Of Object)) As Task - Dim noListeners = SpecializedCollections.EmptyEnumerable(Of Lazy(Of IAsynchronousOperationListener, FeatureMetadata))() - Dim provider = New SemanticQuickInfoProvider() Await TestSharedAsync(workspace, provider, position, expectedResults) diff --git a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs index b0840a2f69b2a..7cb1439917539 100644 --- a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs +++ b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs @@ -1849,7 +1849,7 @@ .maxstack 1 expr: "F(() => y)", error: out error, testData: testData); - Assert.Equal(error, "error CS1628: Cannot use ref or out parameter 'y' inside an anonymous method, lambda expression, or query expression"); + Assert.Equal(error, "error CS1628: Cannot use ref, out, or in parameter 'y' inside an anonymous method, lambda expression, or query expression"); }); } diff --git a/src/Features/CSharp/Portable/AddAccessibilityModifiers/CSharpAddAccessibilityModifiersDiagnosticAnalyzer.cs b/src/Features/CSharp/Portable/AddAccessibilityModifiers/CSharpAddAccessibilityModifiersDiagnosticAnalyzer.cs index 246252f6da600..4563f4b4cbf42 100644 --- a/src/Features/CSharp/Portable/AddAccessibilityModifiers/CSharpAddAccessibilityModifiersDiagnosticAnalyzer.cs +++ b/src/Features/CSharp/Portable/AddAccessibilityModifiers/CSharpAddAccessibilityModifiersDiagnosticAnalyzer.cs @@ -76,14 +76,60 @@ private void ProcessMemberDeclaration( return; } - // If they already have accessibility, no need to report anything. + // This analyzer bases all of its decisions on the accessibility var accessibility = generator.GetAccessibility(member); - if (accessibility != Accessibility.NotApplicable) + + // Omit will flag any accesibility values that exist and are default + // The other options will remove or ignore accessibility + var isOmit = option.Value == AccessibilityModifiersRequired.OmitIfDefault; + + if (isOmit) { - return; + if (accessibility == Accessibility.NotApplicable) + { + return; + } + + var parentKind = member.Parent.Kind(); + switch (parentKind) + { + // Check for default modifiers in namespace and outside of namespace + case SyntaxKind.CompilationUnit: + case SyntaxKind.NamespaceDeclaration: + { + // Default is internal + if (accessibility != Accessibility.Internal) + { + return; + } + } + break; + + case SyntaxKind.ClassDeclaration: + case SyntaxKind.StructDeclaration: + { + // Inside a type, default is private + if (accessibility != Accessibility.Private) + { + return; + } + } + break; + + default: + return; // Unknown parent kind, don't do anything + } + } + else + { + // Mode is always, so we have to flag missing modifiers + if (accessibility != Accessibility.NotApplicable) + { + return; + } } - // Missing accessibility. Report issue to user. + // Have an issue to flag, either add or remove. Report issue to user. var additionalLocations = ImmutableArray.Create(member.GetLocation()); context.ReportDiagnostic(Diagnostic.Create( CreateDescriptorWithSeverity(option.Notification.Value), diff --git a/src/Features/CSharp/Portable/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.cs b/src/Features/CSharp/Portable/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.cs index 8681b958f92c7..3c9108550f8a0 100644 --- a/src/Features/CSharp/Portable/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.cs +++ b/src/Features/CSharp/Portable/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.cs @@ -336,10 +336,13 @@ private SyntaxNode RemoveDeclaratorFromVariableList(VariableDeclaratorSyntax var var localDeclaration = (LocalDeclarationStatementSyntax)variableDeclaration.Parent; var scope = GetScope(variableDeclarator); - var newLocalDeclaration = localDeclaration.RemoveNode(variableDeclarator, SyntaxRemoveOptions.KeepNoTrivia) - .WithAdditionalAnnotations(Formatter.Annotation); + var newLocalDeclaration = variableDeclarator.GetLeadingTrivia().Any(t => t.IsDirective) + ? localDeclaration.RemoveNode(variableDeclarator, SyntaxRemoveOptions.KeepExteriorTrivia) + : localDeclaration.RemoveNode(variableDeclarator, SyntaxRemoveOptions.KeepNoTrivia); - return scope.ReplaceNode(localDeclaration, newLocalDeclaration); + return scope.ReplaceNode( + localDeclaration, + newLocalDeclaration.WithAdditionalAnnotations(Formatter.Annotation)); } private SyntaxNode RemoveDeclaratorFromScope(VariableDeclaratorSyntax variableDeclarator, SyntaxNode scope) diff --git a/src/Features/CSharp/Portable/UsePatternMatching/CSharpAsAndNullCheckCodeFixProvider.cs b/src/Features/CSharp/Portable/UsePatternMatching/CSharpAsAndNullCheckCodeFixProvider.cs index e10d7b7fd5804..3146c64872ccc 100644 --- a/src/Features/CSharp/Portable/UsePatternMatching/CSharpAsAndNullCheckCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/UsePatternMatching/CSharpAsAndNullCheckCodeFixProvider.cs @@ -77,12 +77,20 @@ private static void AddEdits( var conditionPart = (BinaryExpressionSyntax)conditionLocation.FindNode(cancellationToken); var asExpression = (BinaryExpressionSyntax)asExpressionLocation.FindNode(cancellationToken); - var updatedConditionPart = SyntaxFactory.IsPatternExpression( + ExpressionSyntax updatedConditionPart = SyntaxFactory.IsPatternExpression( asExpression.Left, SyntaxFactory.DeclarationPattern( ((TypeSyntax)asExpression.Right).WithoutTrivia(), SyntaxFactory.SingleVariableDesignation( localDeclaration.Declaration.Variables[0].Identifier.WithoutTrivia()))); + // We should negate the is-expression if we have something like "x == null" + if (conditionPart.IsKind(SyntaxKind.EqualsExpression)) + { + updatedConditionPart = SyntaxFactory.PrefixUnaryExpression( + SyntaxKind.LogicalNotExpression, + updatedConditionPart.Parenthesize()); + } + var currentCondition = GetCondition(targetStatement); var updatedCondition = currentCondition.ReplaceNode(conditionPart, updatedConditionPart); diff --git a/src/Features/CSharp/Portable/UsePatternMatching/CSharpAsAndNullCheckDiagnosticAnalyzer.cs b/src/Features/CSharp/Portable/UsePatternMatching/CSharpAsAndNullCheckDiagnosticAnalyzer.cs index d23eaf31700f9..7568d3a60a5fe 100644 --- a/src/Features/CSharp/Portable/UsePatternMatching/CSharpAsAndNullCheckDiagnosticAnalyzer.cs +++ b/src/Features/CSharp/Portable/UsePatternMatching/CSharpAsAndNullCheckDiagnosticAnalyzer.cs @@ -6,6 +6,7 @@ using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle; using Microsoft.CodeAnalysis.CSharp.Extensions; +using Microsoft.CodeAnalysis.CSharp.ExtractMethod; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Shared.Extensions; @@ -73,17 +74,57 @@ private void SyntaxNodeAction(SyntaxNodeAnalysisContext syntaxContext) var targetStatement = (StatementSyntax)node; var leftmostCondition = GetLeftmostCondition(targetStatement); - if (!leftmostCondition.IsKind(SyntaxKind.NotEqualsExpression, out BinaryExpressionSyntax notEquals)) + if (leftmostCondition == null) { return; } - var operand = GetNullCheckOperand(notEquals.Left, notEquals.Right)?.WalkDownParentheses(); + bool isNegativeNullCheck; + switch (leftmostCondition.Kind()) + { + case SyntaxKind.NotEqualsExpression: + isNegativeNullCheck = false; + break; + case SyntaxKind.EqualsExpression: + isNegativeNullCheck = true; + break; + default: + return; + } + + // The pattern variable is only definitely assigned if the pattern succeeded, + // so in the following cases it would not be safe to use pattern-matching. + // For example: + // + // if ((x = o as string) == null && SomeExpression) + // if ((x = o as string) != null || SomeExpression) + // + // x would never be definitely assigned if pattern matching were used + switch ((leftmostCondition.Parent as ExpressionSyntax)?.WalkUpParentheses().Kind()) + { + case SyntaxKind.LogicalAndExpression when isNegativeNullCheck: + case SyntaxKind.LogicalOrExpression when !isNegativeNullCheck: + return; + } + + var comparison = (BinaryExpressionSyntax)leftmostCondition; + var operand = GetNullCheckOperand(comparison.Left, comparison.Right)?.WalkDownParentheses(); if (operand == null) { return; } + var semanticModel = syntaxContext.SemanticModel; + if (operand.IsKind(SyntaxKind.CastExpression, out CastExpressionSyntax castExpression)) + { + // Unwrap object cast + var castType = semanticModel.GetTypeInfo(castExpression.Type).Type; + if (castType.IsObjectType()) + { + operand = castExpression.Expression; + } + } + // if/while has to be in a block so we can at least look for a preceding local variable declaration. if (!targetStatement.Parent.IsKind(SyntaxKind.Block, out BlockSyntax parentBlock)) { @@ -96,8 +137,7 @@ private void SyntaxNodeAction(SyntaxNodeAnalysisContext syntaxContext) return; } - var semanticModel = syntaxContext.SemanticModel; - if (semanticModel.GetSymbolInfo(notEquals).GetAnySymbol().IsUserDefinedOperator()) + if (semanticModel.GetSymbolInfo(comparison).GetAnySymbol().IsUserDefinedOperator()) { return; } @@ -140,8 +180,8 @@ private void SyntaxNodeAction(SyntaxNodeAnalysisContext syntaxContext) // If we convert this to 'if (o is Type x)' then 'x' will not be definitely assigned // in the Else branch of the IfStatement, or after the IfStatement. Make sure // that doesn't cause definite assignment issues. - if (IsAccessedBeforeAssignment(semanticModel, localSymbol, - declarationStatement, targetStatement, parentBlock, cancellationToken)) + if (!CheckDefiniteAssignment(semanticModel, localSymbol, + declarationStatement, targetStatement, parentBlock, isNegativeNullCheck)) { return; } @@ -160,106 +200,106 @@ private void SyntaxNodeAction(SyntaxNodeAnalysisContext syntaxContext) additionalLocations)); } - private static bool IsAccessedBeforeAssignment( + // Ensure that all usages of the pattern variable are + // in scope and definitely assigned after replacement. + private static bool CheckDefiniteAssignment( SemanticModel semanticModel, ISymbol localVariable, StatementSyntax declarationStatement, StatementSyntax targetStatement, BlockSyntax parentBlock, - CancellationToken cancellationToken) + bool isNegativeNullCheck) { - var isAssigned = false; - var isAccessedBeforeAssignment = false; - var statements = parentBlock.Statements; var targetIndex = statements.IndexOf(targetStatement); var declarationIndex = statements.IndexOf(declarationStatement); // Since we're going to remove this declaration-statement, // we need to first ensure that it's not used up to the target statement. - for (var index = declarationIndex + 1; index < targetIndex; index++) + if (declarationIndex + 1 < targetIndex) { - CheckDefiniteAssignment( - semanticModel, localVariable, statements[index], - out isAssigned, out isAccessedBeforeAssignment, - cancellationToken); + var dataFlow = semanticModel.AnalyzeDataFlow( + statements[declarationIndex + 1], + statements[targetIndex - 1]); - if (isAssigned || isAccessedBeforeAssignment) + if (dataFlow.ReadInside.Contains(localVariable) || + dataFlow.WrittenInside.Contains(localVariable)) { - return true; + return false; } } // In case of an if-statement, we need to check if the variable - // is being accessed before assignment in the else clause. + // is being accessed before assignment in the opposite branch. if (targetStatement.IsKind(SyntaxKind.IfStatement, out IfStatementSyntax ifStatement)) { - CheckDefiniteAssignment( - semanticModel, localVariable, ifStatement.Else, - out isAssigned, out isAccessedBeforeAssignment, - cancellationToken); - - if (isAccessedBeforeAssignment) + var statement = isNegativeNullCheck ? ifStatement.Statement : ifStatement.Else?.Statement; + if (statement != null) { - return true; - } - - if (isAssigned) - { - return false; + var dataFlow = semanticModel.AnalyzeDataFlow(statement); + if (dataFlow.DataFlowsIn.Contains(localVariable)) + { + // Access before assignment is not safe in the opposite branch + // as the variable is not definitely assgined at this point. + // For example: + // + // if (o is string x) { } + // else { Use(x); } + // + return false; + } + + if (dataFlow.AlwaysAssigned.Contains(localVariable)) + { + // If the variable is always assigned here, we don't need to check + // subsequent statements as it's definitely assigned afterwards. + // For example: + // + // if (o is string x) { } + // else { x = null; } + // + return true; + } } } // Make sure that no access is made to the variable before assignment in the subsequent statements - for (int index = targetIndex + 1, n = statements.Count; index < n; index++) + if (targetIndex + 1 < statements.Count) { - CheckDefiniteAssignment( - semanticModel, localVariable, statements[index], - out isAssigned, out isAccessedBeforeAssignment, - cancellationToken); - - if (isAccessedBeforeAssignment) - { - return true; - } + var dataFlow = semanticModel.AnalyzeDataFlow( + statements[targetIndex + 1], + statements[statements.Count - 1]); - if (isAssigned) + if (targetStatement.Kind() == SyntaxKind.WhileStatement) { // The scope of pattern variables in a while-statement does not leak out to // the enclosing block so we bail also if there is any assignments afterwards. - return targetStatement.Kind() == SyntaxKind.WhileStatement; - } - } - - return false; - } - - private static void CheckDefiniteAssignment( - SemanticModel semanticModel, ISymbol localVariable, SyntaxNode node, - out bool isAssigned, out bool isAccessedBeforeAssignment, - CancellationToken cancellationToken) - { - if (node != null) - { - foreach (var descendantNode in node.DescendantNodes()) - { - if(!descendantNode.IsKind(SyntaxKind.IdentifierName, out IdentifierNameSyntax id)) + if (dataFlow.ReadInside.Contains(localVariable) || + dataFlow.WrittenInside.Contains(localVariable)) { - continue; - } - - var symbol = semanticModel.GetSymbolInfo(id, cancellationToken).GetAnySymbol(); - if (localVariable.Equals(symbol)) - { - isAssigned = id.IsOnlyWrittenTo(); - isAccessedBeforeAssignment = !isAssigned; - return; + return false; } } + else if (dataFlow.DataFlowsIn.Contains(localVariable)) + { + // Access before assignment here is only valid if we have a negative + // pattern-matching in an if-statement with an unreachable endpoint. + // For example: + // + // if (!(o is string x)) { + // return; + // } + // + // // The 'return' statement above ensures x is definitely assigned here + // Console.WriteLine(x); + // + return isNegativeNullCheck && + ifStatement != null && + !semanticModel.AnalyzeControlFlow(ifStatement.Statement).EndPointIsReachable; + } } - isAssigned = false; - isAccessedBeforeAssignment = false; + return true; } private static bool TryGetTypeCheckParts( @@ -373,7 +413,7 @@ private static SyntaxNode GetLeftmostCondition(SyntaxNode node) { while (true) { - switch (node?.Kind()) + switch (node.Kind()) { case SyntaxKind.WhileStatement: node = ((WhileStatementSyntax)node).Condition; @@ -388,7 +428,13 @@ private static SyntaxNode GetLeftmostCondition(SyntaxNode node) var declarators = ((LocalDeclarationStatementSyntax)node).Declaration.Variables; // We require this to be the only declarator in the declaration statement // to simplify definitive assignment check and the code fix for now - node = declarators.Count == 1 ? declarators[0].Initializer?.Value : null; + var value = declarators.Count == 1 ? declarators[0].Initializer?.Value : null; + if (value == null) + { + return null; + } + + node = value; continue; case SyntaxKind.ParenthesizedExpression: node = ((ParenthesizedExpressionSyntax)node).Expression; diff --git a/src/Features/Core/Portable/AddAccessibilityModifiers/AbstractAddAccessibilityModifiersCodeFixProvider.cs b/src/Features/Core/Portable/AddAccessibilityModifiers/AbstractAddAccessibilityModifiersCodeFixProvider.cs index 658788122853f..624d9fa5d9b75 100644 --- a/src/Features/Core/Portable/AddAccessibilityModifiers/AbstractAddAccessibilityModifiersCodeFixProvider.cs +++ b/src/Features/Core/Portable/AddAccessibilityModifiers/AbstractAddAccessibilityModifiersCodeFixProvider.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Immutable; -using System.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -47,11 +46,15 @@ protected sealed override async Task FixAllAsync( var symbol = semanticModel.GetDeclaredSymbol(declarator, cancellationToken); + // Check to see if we need to add or remove + // If there's a modifier, then we need to remove it, otherwise no modifier, add it. editor.ReplaceNode( declaration, (currentDeclaration, generator) => { - return generator.WithAccessibility(currentDeclaration, symbol.DeclaredAccessibility); + return generator.GetAccessibility(currentDeclaration) == Accessibility.NotApplicable + ? generator.WithAccessibility(currentDeclaration, symbol.DeclaredAccessibility) // No accessibilty was declared, we need to add it + : generator.WithAccessibility(currentDeclaration, Accessibility.NotApplicable); // There was an accessibility, so remove it }); } } diff --git a/src/Features/Core/Portable/Diagnostics/DiagnosticAnalyzerService.cs b/src/Features/Core/Portable/Diagnostics/DiagnosticAnalyzerService.cs index 772e4919f0ce5..3bf10a557eba6 100644 --- a/src/Features/Core/Portable/Diagnostics/DiagnosticAnalyzerService.cs +++ b/src/Features/Core/Portable/Diagnostics/DiagnosticAnalyzerService.cs @@ -25,13 +25,13 @@ internal partial class DiagnosticAnalyzerService : IDiagnosticAnalyzerService [ImportingConstructor] public DiagnosticAnalyzerService( IDiagnosticUpdateSourceRegistrationService registrationService, - [ImportMany] IEnumerable> asyncListeners, + IAsynchronousOperationListenerProvider listenerProvider, [Import(AllowDefault = true)]IWorkspaceDiagnosticAnalyzerProviderService diagnosticAnalyzerProviderService = null, [Import(AllowDefault = true)]AbstractHostDiagnosticUpdateSource hostDiagnosticUpdateSource = null) : this(diagnosticAnalyzerProviderService != null ? diagnosticAnalyzerProviderService.GetHostDiagnosticAnalyzerPackages() : SpecializedCollections.EmptyEnumerable(), diagnosticAnalyzerProviderService?.GetAnalyzerAssemblyLoader(), hostDiagnosticUpdateSource, - registrationService, new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.DiagnosticService)) + registrationService, listenerProvider.GetListener(FeatureAttribute.DiagnosticService)) { // diagnosticAnalyzerProviderService and hostDiagnosticUpdateSource can only be null in test hardness otherwise, it should // never be null @@ -59,7 +59,7 @@ protected DiagnosticAnalyzerService( { _hostAnalyzerManager = hostAnalyzerManager; _hostDiagnosticUpdateSource = hostDiagnosticUpdateSource; - _listener = listener ?? AggregateAsynchronousOperationListener.CreateEmptyListener(); + _listener = listener ?? AsynchronousOperationListenerProvider.NullListener; } public ImmutableDictionary> GetDiagnosticDescriptors(Project projectOpt) diff --git a/src/Features/Core/Portable/Diagnostics/DiagnosticService.cs b/src/Features/Core/Portable/Diagnostics/DiagnosticService.cs index 99b3d356eb7f1..a4e362507250d 100644 --- a/src/Features/Core/Portable/Diagnostics/DiagnosticService.cs +++ b/src/Features/Core/Portable/Diagnostics/DiagnosticService.cs @@ -27,7 +27,7 @@ internal partial class DiagnosticService : IDiagnosticService private readonly Dictionary>> _map; [ImportingConstructor] - public DiagnosticService([ImportMany] IEnumerable> asyncListeners) : this() + public DiagnosticService(IAsynchronousOperationListenerProvider listenerProvider) : this() { // queue to serialize events. _eventMap = new EventMap(); @@ -36,7 +36,7 @@ public DiagnosticService([ImportMany] IEnumerable>>(); diff --git a/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs b/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs index 41816954866dd..1a994e61f80b9 100644 --- a/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs +++ b/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs @@ -112,6 +112,8 @@ public async Task GetProjectAnalysisDataAsync( // perf optimization. check whether we want to analyze this project or not. if (!FullAnalysisEnabled(project, forceAnalyzerRun)) { + Logger.Log(FunctionId.Diagnostics_ProjectDiagnostic, p => $"FSA off ({p.FilePath ?? p.Name})", project); + return new ProjectAnalysisData(project.Id, VersionStamp.Default, existingData.Result, ImmutableDictionary.Empty); } @@ -154,6 +156,8 @@ private async Task $"Failed to Load Successfully ({p.FilePath ?? p.Name})", project); + // get rid of any result except syntax from compiler analyzer result var newCompilerAnalysisResult = new DiagnosticAnalysisResult( analysisResult.ProjectId, @@ -451,7 +455,7 @@ private async Task> ComputeDiagnosticAnalyzerDiagnostics return ImmutableArray.Empty; } - if (!await SemanticAnalysisEnabled(document, analyzer, kind, cancellationToken).ConfigureAwait(false)) + if (!await AnalysisEnabled(document, analyzer, kind, cancellationToken).ConfigureAwait(false)) { return ImmutableArray.Empty; } @@ -478,14 +482,19 @@ private async Task> ComputeDiagnosticAnalyzerDiagnostics } } - private async Task SemanticAnalysisEnabled(Document document, DiagnosticAnalyzer analyzer, AnalysisKind kind, CancellationToken cancellationToken) + private async Task AnalysisEnabled(Document document, DiagnosticAnalyzer analyzer, AnalysisKind kind, CancellationToken cancellationToken) { // if project is not loaded successfully then, we disable semantic errors for compiler analyzers - var disabled = kind != AnalysisKind.Syntax && - _owner.HostAnalyzerManager.IsCompilerDiagnosticAnalyzer(document.Project.Language, analyzer) && - !await document.Project.HasSuccessfullyLoadedAsync(cancellationToken).ConfigureAwait(false); + if (kind == AnalysisKind.Syntax || !_owner.HostAnalyzerManager.IsCompilerDiagnosticAnalyzer(document.Project.Language, analyzer)) + { + return true; + } + + var enabled = await document.Project.HasSuccessfullyLoadedAsync(cancellationToken).ConfigureAwait(false); + + Logger.Log(FunctionId.Diagnostics_SemanticDiagnostic, (a, d, e) => $"{a.ToString()}, ({d.FilePath ?? d.Name}), Enabled:{e}", analyzer, document, enabled); - return !disabled; + return enabled; } private void UpdateAnalyzerTelemetryData( @@ -620,42 +629,42 @@ private static async Task VerifyDiagnosticLocationAsync(string id, Location loca // ignore these kinds break; case LocationKind.SourceFile: + { + if (project.GetDocument(location.SourceTree) == null) { - if (project.GetDocument(location.SourceTree) == null) - { - // Disallow diagnostics with source locations outside this project. - throw new ArgumentException(string.Format(FeaturesResources.Reported_diagnostic_0_has_a_source_location_in_file_1_which_is_not_part_of_the_compilation_being_analyzed, id, location.SourceTree.FilePath), "diagnostic"); - } + // Disallow diagnostics with source locations outside this project. + throw new ArgumentException(string.Format(FeaturesResources.Reported_diagnostic_0_has_a_source_location_in_file_1_which_is_not_part_of_the_compilation_being_analyzed, id, location.SourceTree.FilePath), "diagnostic"); + } - if (location.SourceSpan.End > location.SourceTree.Length) - { - // Disallow diagnostics with source locations outside this project. - throw new ArgumentException(string.Format(FeaturesResources.Reported_diagnostic_0_has_a_source_location_1_in_file_2_which_is_outside_of_the_given_file, id, location.SourceSpan, location.SourceTree.FilePath), "diagnostic"); - } + if (location.SourceSpan.End > location.SourceTree.Length) + { + // Disallow diagnostics with source locations outside this project. + throw new ArgumentException(string.Format(FeaturesResources.Reported_diagnostic_0_has_a_source_location_1_in_file_2_which_is_outside_of_the_given_file, id, location.SourceSpan, location.SourceTree.FilePath), "diagnostic"); } - break; + } + break; case LocationKind.ExternalFile: + { + var filePath = location.GetLineSpan().Path; + var document = TryGetDocumentWithFilePath(project, filePath); + if (document == null) { - var filePath = location.GetLineSpan().Path; - var document = TryGetDocumentWithFilePath(project, filePath); - if (document == null) - { - // this is not a roslyn file. we don't care about this file. - return; - } + // this is not a roslyn file. we don't care about this file. + return; + } - // this can be potentially expensive since it will load text if it is not already loaded. - // but, this text is most likely already loaded since producer of this diagnostic (Document/ProjectDiagnosticAnalyzers) - // should have loaded it to produce the diagnostic at the first place. once loaded, it should stay in memory until - // project cache goes away. when text is already there, await should return right away. - var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); - if (location.SourceSpan.End > text.Length) - { - // Disallow diagnostics with locations outside this project. - throw new ArgumentException(string.Format(FeaturesResources.Reported_diagnostic_0_has_a_source_location_1_in_file_2_which_is_outside_of_the_given_file, id, location.SourceSpan, filePath), "diagnostic"); - } + // this can be potentially expensive since it will load text if it is not already loaded. + // but, this text is most likely already loaded since producer of this diagnostic (Document/ProjectDiagnosticAnalyzers) + // should have loaded it to produce the diagnostic at the first place. once loaded, it should stay in memory until + // project cache goes away. when text is already there, await should return right away. + var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); + if (location.SourceSpan.End > text.Length) + { + // Disallow diagnostics with locations outside this project. + throw new ArgumentException(string.Format(FeaturesResources.Reported_diagnostic_0_has_a_source_location_1_in_file_2_which_is_outside_of_the_given_file, id, location.SourceSpan, filePath), "diagnostic"); } - break; + } + break; default: throw ExceptionUtilities.Unreachable; } diff --git a/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.cs b/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.cs index bd9768dd2dc04..e985b08aa125f 100644 --- a/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.cs @@ -284,32 +284,32 @@ internal Action GetOnAnalyzerExceptio private static string GetDocumentLogMessage(string title, Document document, DiagnosticAnalyzer analyzer) { - return string.Format($"{title}: {document.FilePath ?? document.Name}, {analyzer.ToString()}"); + return $"{title}: ({document.FilePath ?? document.Name}), ({analyzer.ToString()})"; } private static string GetProjectLogMessage(Project project, IEnumerable stateSets) { - return string.Format($"project: {project.FilePath ?? project.Name}, {string.Join(",", stateSets.Select(s => s.Analyzer.ToString()))}"); + return $"project: ({project.FilePath ?? project.Name}), ({string.Join(Environment.NewLine, stateSets.Select(s => s.Analyzer.ToString()))})"; } private static string GetResetLogMessage(Document document) { - return string.Format($"document close/reset: {document.FilePath ?? document.Name}"); + return $"document close/reset: ({document.FilePath ?? document.Name})"; } private static string GetOpenLogMessage(Document document) { - return string.Format($"document open: {document.FilePath ?? document.Name}"); + return $"document open: ({document.FilePath ?? document.Name})"; } private static string GetRemoveLogMessage(DocumentId id) { - return string.Format($"document remove: {id.ToString()}"); + return $"document remove: {id.ToString()}"; } private static string GetRemoveLogMessage(ProjectId id) { - return string.Format($"project remove: {id.ToString()}"); + return $"project remove: {id.ToString()}"; } } } diff --git a/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_BuildSynchronization.cs b/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_BuildSynchronization.cs index 30d10234e191a..6c84719894b89 100644 --- a/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_BuildSynchronization.cs +++ b/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_BuildSynchronization.cs @@ -1,13 +1,14 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Globalization; using System.Linq; +using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Workspaces.Diagnostics; using Roslyn.Utilities; @@ -17,41 +18,44 @@ internal partial class DiagnosticIncrementalAnalyzer { public async Task SynchronizeWithBuildAsync(Workspace workspace, ImmutableDictionary> map) { - DebugVerifyDiagnosticLocations(map); - - if (!PreferBuildErrors(workspace)) + using (Logger.LogBlock(FunctionId.DiagnosticIncrementalAnalyzer_SynchronizeWithBuildAsync, (w, m) => LogSynchronizeWithBuild(w, m), workspace, map, CancellationToken.None)) { - // prefer live errors over build errors - return; - } + DebugVerifyDiagnosticLocations(map); - var solution = workspace.CurrentSolution; - foreach (var projectEntry in map) - { - var project = solution.GetProject(projectEntry.Key); - if (project == null) + if (!PreferBuildErrors(workspace)) { - continue; + // prefer live errors over build errors + return; } - // REVIEW: is build diagnostic contains suppressed diagnostics? - var stateSets = _stateManager.CreateBuildOnlyProjectStateSet(project); - var result = await CreateProjectAnalysisDataAsync(project, stateSets, projectEntry.Value).ConfigureAwait(false); - - foreach (var stateSet in stateSets) + var solution = workspace.CurrentSolution; + foreach (var projectEntry in map) { - var state = stateSet.GetProjectState(project.Id); - await state.SaveAsync(project, result.GetResult(stateSet.Analyzer)).ConfigureAwait(false); + var project = solution.GetProject(projectEntry.Key); + if (project == null) + { + continue; + } + + // REVIEW: is build diagnostic contains suppressed diagnostics? + var stateSets = _stateManager.CreateBuildOnlyProjectStateSet(project); + var result = await CreateProjectAnalysisDataAsync(project, stateSets, projectEntry.Value).ConfigureAwait(false); + + foreach (var stateSet in stateSets) + { + var state = stateSet.GetProjectState(project.Id); + await state.SaveAsync(project, result.GetResult(stateSet.Analyzer)).ConfigureAwait(false); + } + + // REVIEW: this won't handle active files. might need to tweak it later. + RaiseProjectDiagnosticsIfNeeded(project, stateSets, result.OldResult, result.Result); } - // REVIEW: this won't handle active files. might need to tweak it later. - RaiseProjectDiagnosticsIfNeeded(project, stateSets, result.OldResult, result.Result); - } - - if (PreferLiveErrorsOnOpenedFiles(workspace)) - { - // enqueue re-analysis of open documents. - this.Owner.Reanalyze(workspace, documentIds: workspace.GetOpenDocumentIds(), highPriority: true); + if (PreferLiveErrorsOnOpenedFiles(workspace)) + { + // enqueue re-analysis of open documents. + this.Owner.Reanalyze(workspace, documentIds: workspace.GetOpenDocumentIds(), highPriority: true); + } } } @@ -125,12 +129,12 @@ private ImmutableArray GetDiagnostics(DiagnosticAnalysisResult r result.Others).ToImmutableArray(); } - private bool PreferBuildErrors(Workspace workspace) + private static bool PreferBuildErrors(Workspace workspace) { return workspace.Options.GetOption(InternalDiagnosticsOptions.PreferBuildErrorsOverLiveErrors); } - private bool PreferLiveErrorsOnOpenedFiles(Workspace workspace) + private static bool PreferLiveErrorsOnOpenedFiles(Workspace workspace) { return workspace.Options.GetOption(InternalDiagnosticsOptions.PreferLiveErrorsOnOpenedFiles); } @@ -208,5 +212,29 @@ private static DiagnosticData CreateLiveDiagnostic(DiagnosticDescriptor descript descriptor.HelpLinkUri, isSuppressed: diagnostic.IsSuppressed); } + + private static string LogSynchronizeWithBuild(Workspace workspace, ImmutableDictionary> map) + { + using (var pooledObject = SharedPools.Default().GetPooledObject()) + { + var sb = pooledObject.Object; + sb.Append($"PreferBuildError:{PreferBuildErrors(workspace)}, PreferLiveOnOpenFiles:{PreferLiveErrorsOnOpenedFiles(workspace)}"); + + if (map.Count > 0) + { + foreach (var kv in map) + { + sb.AppendLine($"{kv.Key}, Count: {kv.Value.Length}"); + + foreach (var diagnostic in kv.Value) + { + sb.AppendLine($" {diagnostic.ToString()}"); + } + } + } + + return sb.ToString(); + } + } } } diff --git a/src/Features/Core/Portable/Shared/TestHooks/AsynchronousOperationListener.AsyncToken.cs b/src/Features/Core/Portable/Shared/TestHooks/AsynchronousOperationListener.AsyncToken.cs index a15e644f44fc7..a66e36baa7435 100644 --- a/src/Features/Core/Portable/Shared/TestHooks/AsynchronousOperationListener.AsyncToken.cs +++ b/src/Features/Core/Portable/Shared/TestHooks/AsynchronousOperationListener.AsyncToken.cs @@ -6,7 +6,7 @@ namespace Microsoft.CodeAnalysis.Shared.TestHooks { internal partial class AsynchronousOperationListener { - protected internal class AsyncToken : IAsyncToken + internal class AsyncToken : IAsyncToken { private readonly AsynchronousOperationListener _listener; diff --git a/src/Features/Core/Portable/Shared/TestHooks/AsynchronousOperationListener.DiagnosticAsyncToken.cs b/src/Features/Core/Portable/Shared/TestHooks/AsynchronousOperationListener.DiagnosticAsyncToken.cs index e47fb101d4588..e9adb07218bdd 100644 --- a/src/Features/Core/Portable/Shared/TestHooks/AsynchronousOperationListener.DiagnosticAsyncToken.cs +++ b/src/Features/Core/Portable/Shared/TestHooks/AsynchronousOperationListener.DiagnosticAsyncToken.cs @@ -6,13 +6,13 @@ namespace Microsoft.CodeAnalysis.Shared.TestHooks { - internal partial class AsynchronousOperationListener + internal sealed partial class AsynchronousOperationListener { /// /// Stores the source information for an value. Helpful when /// tracking down tokens which aren't properly disposed. /// - protected internal sealed class DiagnosticAsyncToken : AsyncToken + internal sealed class DiagnosticAsyncToken : AsyncToken { public string Name { get; } public string FilePath { get; } diff --git a/src/Features/Core/Portable/Shared/TestHooks/AsynchronousOperationListener.cs b/src/Features/Core/Portable/Shared/TestHooks/AsynchronousOperationListener.cs index bbfe817e541df..166f15d2cc4df 100644 --- a/src/Features/Core/Portable/Shared/TestHooks/AsynchronousOperationListener.cs +++ b/src/Features/Core/Portable/Shared/TestHooks/AsynchronousOperationListener.cs @@ -1,27 +1,32 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; -using System.Linq; using System.Threading.Tasks; -using Roslyn.Utilities; using System.Runtime.CompilerServices; namespace Microsoft.CodeAnalysis.Shared.TestHooks { - internal partial class AsynchronousOperationListener : IAsynchronousOperationListener, IAsynchronousOperationWaiter + internal sealed partial class AsynchronousOperationListener : IAsynchronousOperationListener, IAsynchronousOperationWaiter { private readonly object _gate = new object(); + private readonly string _featureName; private readonly HashSet> _pendingTasks = new HashSet>(); + private List _diagnosticTokenList = new List(); private int _counter; private bool _trackActiveTokens; - public AsynchronousOperationListener() + public AsynchronousOperationListener() : + this(featureName: "noname", enableDiagnosticTokens: false) + { + } + + public AsynchronousOperationListener(string featureName, bool enableDiagnosticTokens) { - TrackActiveTokens = Debugger.IsAttached; + _featureName = featureName; + TrackActiveTokens = Debugger.IsAttached || enableDiagnosticTokens; } public IAsyncToken BeginAsyncOperation(string name, object tag = null, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0) @@ -88,22 +93,22 @@ private void Decrement(AsyncToken token) } } - public virtual Task CreateWaitTask() + public Task CreateWaitTask() { lock (_gate) { - var source = new TaskCompletionSource(); if (_counter == 0) { // There is nothing to wait for, so we are immediately done - source.SetResult(true); + return Task.CompletedTask; } else { + var source = new TaskCompletionSource(); _pendingTasks.Add(source); - } - return source.Task; + return source.Task; + } } } @@ -148,24 +153,5 @@ public ImmutableArray ActiveDiagnosticTokens } } } - - internal static IEnumerable> CreateListeners( - string featureName, IAsynchronousOperationListener listener) - { - return CreateListeners(ValueTuple.Create(featureName, listener)); - } - - internal static IEnumerable> CreateListeners( - params ValueTuple[] pairs) where T : IAsynchronousOperationListener - { - return pairs.Select(CreateLazy).ToList(); - } - - private static Lazy CreateLazy( - ValueTuple tuple) where T : IAsynchronousOperationListener - { - return new Lazy( - () => tuple.Item2, new FeatureMetadata(new Dictionary() { { "FeatureName", tuple.Item1 } })); - } } } diff --git a/src/Features/Core/Portable/Shared/TestHooks/IAsynchronousOperationListenerProvider.cs b/src/Features/Core/Portable/Shared/TestHooks/IAsynchronousOperationListenerProvider.cs new file mode 100644 index 0000000000000..79ba8f2945872 --- /dev/null +++ b/src/Features/Core/Portable/Shared/TestHooks/IAsynchronousOperationListenerProvider.cs @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Composition; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.Shared.TestHooks +{ + /// + /// Return for the given featureName + /// + /// We have this abstraction so that we can have isolated listener/waiter in unit tests + /// + internal interface IAsynchronousOperationListenerProvider + { + /// + /// Get for given feature. + /// same provider will return a singleton listener for same feature + /// + IAsynchronousOperationListener GetListener(string featureName); + } + + /// + /// use in product code to get + /// and use + /// in test to get waiter. + /// + [Shared] + [Export(typeof(IAsynchronousOperationListenerProvider))] + [Export(typeof(AsynchronousOperationListenerProvider))] + internal class AsynchronousOperationListenerProvider : IAsynchronousOperationListenerProvider + { + public static readonly IAsynchronousOperationListenerProvider NullProvider = new NullListenerProvider(); + public static readonly IAsynchronousOperationListener NullListener = new NullOperationListener(); + + /// + /// indicate whether asynchronous listener is enabled or not. + /// it is tri-state since we want to retrieve this value, if never explicitly set, from environment variable + /// and then cache it. + /// we read value from environment variable (RoslynWaiterEnabled) because we want team, that doesn't have + /// access to Roslyn code (InternalVisibleTo), can use this listener/waiter framework as well. + /// those team can enable this without using API + /// + public static bool? s_enabled = null; + + private readonly ConcurrentDictionary _singletonListeners; + private readonly Func _createCallback; + + /// + /// indicate whether is enabled or not + /// it is tri-state since we want to retrieve this value, if never explicitly set, from environment variable + /// and then cache it. + /// we read value from environment variable (RoslynWaiterDiagnosticTokenEnabled) because we want team, that doesn't have + /// access to Roslyn code (InternalVisibleTo), can use this listener/waiter framework as well. + /// those team can enable this without using API + /// + private bool? _enableDiagnosticTokens; + + public static void Enable(bool enable) + { + // right now, made it static so that one can enable it through reflection easy + // but we can think of some other way + s_enabled = enable; + } + + public AsynchronousOperationListenerProvider() + { + _singletonListeners = new ConcurrentDictionary(concurrencyLevel: 2, capacity: 20); + _createCallback = name => new AsynchronousOperationListener(name, DiagnosticTokensEnabled); + } + + public IAsynchronousOperationListener GetListener(string featureName) + { + if (!IsEnabled) + { + // if listener is not enabled. it always return null listener + return NullListener; + } + + return _singletonListeners.GetOrAdd(featureName, _createCallback); + } + + /// + /// Enable or disable TrackActiveTokens for test + /// + public void EnableDiagnosticTokens(bool enable) + { + _enableDiagnosticTokens = enable; + _singletonListeners.Values.Do(l => l.TrackActiveTokens = enable); + } + + /// + /// Get Waiters for listeners for test + /// + public IAsynchronousOperationWaiter GetWaiter(string featureName) + { + return (IAsynchronousOperationWaiter)GetListener(featureName); + } + + /// + /// Wait for all of the instances to finish their + /// work. + /// + /// + /// This is a very handy method for debugging hangs in the unit test. Set a break point in the + /// loop, dig into the waiters and see all of the active values + /// representing the remaining work. + /// + public async Task WaitAllAsync(string[] featureNames = null, Action eventProcessingAction = null) + { + var smallTimeout = TimeSpan.FromMilliseconds(10); + + Task[] tasks = null; + while (true) + { + var waiters = GetCandidateWaiters(featureNames); + tasks = waiters.Select(x => x.CreateWaitTask()).Where(t => !t.IsCompleted).ToArray(); + + if (tasks.Length == 0) + { + // no new pending tasks + break; + } + + do + { + // wait for all current tasks to be done for the time given + if (Task.WaitAll(tasks, smallTimeout)) + { + // current set of tasks are done. + // see whether there are new tasks added while we were waiting + break; + } + + // certain test requires some event queues to be processed + // for waiter tasks to finish such as Dispatcher queue + eventProcessingAction?.Invoke(); + + // in unit test where it uses fake foreground task scheduler such as StaTaskScheduler + // we need to yield for the scheduler to run inlined tasks + await Task.Yield(); + } while (true); + } + + foreach (var task in tasks) + { + if (task.Exception != null) + { + throw task.Exception; + } + } + } + + public bool HasPendingWaiter(params string[] featureNames) + { + var waiters = GetCandidateWaiters(featureNames); + return waiters.Any(w => w.HasPendingWork); + } + + /// + /// Get all saved DiagnosticAsyncToken to investigate tests failure easier + /// + public List GetTokens() + { + return _singletonListeners.Values.Where(l => l.TrackActiveTokens).SelectMany(l => l.ActiveDiagnosticTokens).ToList(); + } + + private static bool IsEnabled + { + get + { + if (!s_enabled.HasValue) + { + // if s_enabled has never been set, check environment variable to see whether it should be enabled. + var enabled = Environment.GetEnvironmentVariable("RoslynWaiterEnabled"); + s_enabled = string.Equals(enabled, "1", StringComparison.OrdinalIgnoreCase) || string.Equals(enabled, "True", StringComparison.OrdinalIgnoreCase); + } + + return s_enabled.Value; + } + } + + private bool DiagnosticTokensEnabled + { + get + { + if (!_enableDiagnosticTokens.HasValue) + { + // if _trackingBehavior has never been set, check environment variable to see whether it should be enabled. + var enabled = Environment.GetEnvironmentVariable("RoslynWaiterDiagnosticTokenEnabled"); + _enableDiagnosticTokens = string.Equals(enabled, "1", StringComparison.OrdinalIgnoreCase) || string.Equals(enabled, "True", StringComparison.OrdinalIgnoreCase); + } + + return _enableDiagnosticTokens.Value; + } + } + + private IEnumerable GetCandidateWaiters(string[] featureNames) + { + if (featureNames == null || featureNames.Length == 0) + { + return _singletonListeners.Values.Cast(); + } + + return _singletonListeners.Where(kv => featureNames.Contains(kv.Key)).Select(kv => (IAsynchronousOperationWaiter)kv.Value); + } + + private class NullOperationListener : IAsynchronousOperationListener + { + public IAsyncToken BeginAsyncOperation( + string name, + object tag = null, + [CallerFilePath] string filePath = "", + [CallerLineNumber] int lineNumber = 0) => EmptyAsyncToken.Instance; + } + + private class NullListenerProvider : IAsynchronousOperationListenerProvider + { + public IAsynchronousOperationListener GetListener(string featureName) => NullListener; + } + } +} diff --git a/src/Features/Core/Portable/Shared/TestHooks/IAsynchronousOperationWaiter.cs b/src/Features/Core/Portable/Shared/TestHooks/IAsynchronousOperationWaiter.cs index bf14fa3abe819..73dc8beccaff5 100644 --- a/src/Features/Core/Portable/Shared/TestHooks/IAsynchronousOperationWaiter.cs +++ b/src/Features/Core/Portable/Shared/TestHooks/IAsynchronousOperationWaiter.cs @@ -1,9 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using System.Threading.Tasks; namespace Microsoft.CodeAnalysis.Shared.TestHooks @@ -16,57 +13,4 @@ internal interface IAsynchronousOperationWaiter Task CreateWaitTask(); bool HasPendingWork { get; } } - - internal static class AsynchronousOperationWaiter - { - /// - /// Wait for all of the instances to finish their - /// work. - /// - /// - /// This is a very handy method for debugging hangs in the unit test. Set a break point in the - /// loop, dig into the waiters and see all of the active values - /// representing the remaining work. - /// - internal static async Task WaitAllAsync(this IEnumerable waiters) - { - var smallTimeout = TimeSpan.FromMilliseconds(10); - var tasks = waiters.Select(x => x.CreateWaitTask()).ToList(); - var done = false; - while (!done) - { - done = await tasks.WhenAll(smallTimeout).ConfigureAwait(true); - } - - foreach (var task in tasks) - { - if (task.Exception != null) - { - throw task.Exception; - } - } - } - - private static async Task WhenAll(this IEnumerable tasks, TimeSpan timeout) - { - var delay = Task.Delay(timeout); - var list = tasks.Where(x => !x.IsCompleted).ToList(); - - list.Add(delay); - do - { - await Task.WhenAny(list).ConfigureAwait(true); - list.RemoveAll(x => x.IsCompleted); - if (list.Count == 0) - { - return true; - } - - if (delay.IsCompleted) - { - return false; - } - } while (true); - } - } } diff --git a/src/Features/Core/Portable/Shared/TestHooks/AggregateAsynchronousOperationListener.cs b/src/Features/Core/Portable/Shared/TestHooks/Legacy/AggregateAsynchronousOperationListener.cs similarity index 100% rename from src/Features/Core/Portable/Shared/TestHooks/AggregateAsynchronousOperationListener.cs rename to src/Features/Core/Portable/Shared/TestHooks/Legacy/AggregateAsynchronousOperationListener.cs diff --git a/src/Features/Core/Portable/Shared/TestHooks/Legacy/AsynchronousOperationListener.cs b/src/Features/Core/Portable/Shared/TestHooks/Legacy/AsynchronousOperationListener.cs new file mode 100644 index 0000000000000..11ff72dd0b210 --- /dev/null +++ b/src/Features/Core/Portable/Shared/TestHooks/Legacy/AsynchronousOperationListener.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.CodeAnalysis.Shared.TestHooks +{ + internal partial class AsynchronousOperationListener : IAsynchronousOperationListener, IAsynchronousOperationWaiter + { + internal static IEnumerable> CreateListeners( + string featureName, IAsynchronousOperationListener listener) + { + return CreateListeners(ValueTuple.Create(featureName, listener)); + } + + internal static IEnumerable> CreateListeners( + params ValueTuple[] pairs) where T : IAsynchronousOperationListener + { + return pairs.Select(CreateLazy).ToList(); + } + + private static Lazy CreateLazy( + ValueTuple tuple) where T : IAsynchronousOperationListener + { + return new Lazy( + () => tuple.Item2, new FeatureMetadata(new Dictionary() { { "FeatureName", tuple.Item1 } })); + } + } +} diff --git a/src/Features/Core/Portable/Shared/TestHooks/FeatureAttribute.cs b/src/Features/Core/Portable/Shared/TestHooks/Legacy/FeatureAttribute.cs similarity index 100% rename from src/Features/Core/Portable/Shared/TestHooks/FeatureAttribute.cs rename to src/Features/Core/Portable/Shared/TestHooks/Legacy/FeatureAttribute.cs diff --git a/src/Features/Core/Portable/Shared/TestHooks/FeatureMetadata.cs b/src/Features/Core/Portable/Shared/TestHooks/Legacy/FeatureMetadata.cs similarity index 100% rename from src/Features/Core/Portable/Shared/TestHooks/FeatureMetadata.cs rename to src/Features/Core/Portable/Shared/TestHooks/Legacy/FeatureMetadata.cs diff --git a/src/Features/Core/Portable/SolutionCrawler/SolutionCrawlerRegistrationService.cs b/src/Features/Core/Portable/SolutionCrawler/SolutionCrawlerRegistrationService.cs index bb98a32f8d16f..87292765ce369 100644 --- a/src/Features/Core/Portable/SolutionCrawler/SolutionCrawlerRegistrationService.cs +++ b/src/Features/Core/Portable/SolutionCrawler/SolutionCrawlerRegistrationService.cs @@ -30,7 +30,7 @@ internal partial class SolutionCrawlerRegistrationService : ISolutionCrawlerRegi [ImportingConstructor] public SolutionCrawlerRegistrationService( [ImportMany] IEnumerable> analyzerProviders, - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _gate = new object(); @@ -38,7 +38,7 @@ public SolutionCrawlerRegistrationService( AssertAnalyzerProviders(_analyzerProviders); _documentWorkCoordinatorMap = new Dictionary(ReferenceEqualityComparer.Instance); - _listener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.SolutionCrawler); + _listener = listenerProvider.GetListener(FeatureAttribute.SolutionCrawler); _progressReporter = new SolutionCrawlerProgressReporter(_listener); } diff --git a/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.HighPriorityProcessor.cs b/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.HighPriorityProcessor.cs index 10f08c8b97d7b..951833f7f13f8 100644 --- a/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.HighPriorityProcessor.cs +++ b/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.HighPriorityProcessor.cs @@ -156,7 +156,7 @@ private async Task ProcessDocumentAsync(Solution solution, ImmutableArray w.ToString(), workItem, source.Token)) { var cancellationToken = source.Token; var document = solution.GetDocument(documentId); diff --git a/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs b/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs index 128d748e6da73..793a64fbba1db 100644 --- a/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs +++ b/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs @@ -24,7 +24,7 @@ private partial class WorkCoordinator { private partial class IncrementalAnalyzerProcessor { - private static readonly Func s_enqueueLogger = (t, i, s) => string.Format("[{0}] {1} : {2}", t, i.ToString(), s); + private static readonly Func s_enqueueLogger = (t, i, s) => string.Format("Tick:{0}, Id:{1}, Replaced:{2}", t, i.ToString(), s); private readonly Registration _registration; private readonly IAsynchronousOperationListener _listener; diff --git a/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.LowPriorityProcessor.cs b/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.LowPriorityProcessor.cs index 808e2828545b0..165b3fd623e5e 100644 --- a/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.LowPriorityProcessor.cs +++ b/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.LowPriorityProcessor.cs @@ -128,7 +128,7 @@ private async Task ProcessProjectAsync(ImmutableArray anal try { - using (Logger.LogBlock(FunctionId.WorkCoordinator_ProcessProjectAsync, source.Token)) + using (Logger.LogBlock(FunctionId.WorkCoordinator_ProcessProjectAsync, w => w.ToString(), workItem, source.Token)) { var cancellationToken = source.Token; diff --git a/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs b/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs index 09137738bbd88..ed4022acad5d3 100644 --- a/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs +++ b/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs @@ -312,7 +312,7 @@ private async Task ProcessDocumentAsync(ImmutableArray ana try { - using (Logger.LogBlock(FunctionId.WorkCoordinator_ProcessDocumentAsync, source.Token)) + using (Logger.LogBlock(FunctionId.WorkCoordinator_ProcessDocumentAsync, w => w.ToString(), workItem, source.Token)) { var cancellationToken = source.Token; var document = _processingSolution.GetDocument(documentId); diff --git a/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.WorkItem.cs b/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.WorkItem.cs index 1ff7d4a0e4b57..84b20cf385dcf 100644 --- a/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.WorkItem.cs +++ b/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.WorkItem.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Immutable; +using System.Linq; using Microsoft.CodeAnalysis.Shared.TestHooks; using Roslyn.Utilities; @@ -157,6 +158,11 @@ public WorkItem With(DocumentId documentId, ProjectId projectId, IAsyncToken asy this.IsRetry, asyncToken); } + + public override string ToString() + { + return $"{DocumentId?.ToString() ?? ProjectId.ToString()}, ({InvocationReasons.ToString()}), LowPriority:{IsLowPriority}, ActiveMember:{ActiveMember != null}, Retry:{IsRetry}, ({string.Join("|", Analyzers.Select(a => a.GetType().Name))})"; + } } } } diff --git a/src/Features/Core/Portable/Workspace/ProjectCacheService.SimpleMRUCache.cs b/src/Features/Core/Portable/Workspace/ProjectCacheService.SimpleMRUCache.cs index d835115a3eb77..9410f325a6c95 100644 --- a/src/Features/Core/Portable/Workspace/ProjectCacheService.SimpleMRUCache.cs +++ b/src/Features/Core/Portable/Workspace/ProjectCacheService.SimpleMRUCache.cs @@ -92,7 +92,7 @@ private class ImplicitCacheMonitor : IdleProcessor private readonly SemaphoreSlim _gate; public ImplicitCacheMonitor(ProjectCacheService owner, int backOffTimeSpanInMS) : - base(AggregateAsynchronousOperationListener.CreateEmptyListener(), + base(AsynchronousOperationListenerProvider.NullListener, backOffTimeSpanInMS, CancellationToken.None) { diff --git a/src/Features/VisualBasic/Portable/AddAccessibilityModifiers/VisualBasicAddAccessibilityModifiersDiagnosticAnalyzer.vb b/src/Features/VisualBasic/Portable/AddAccessibilityModifiers/VisualBasicAddAccessibilityModifiersDiagnosticAnalyzer.vb index c27afe58dcca5..b79930dccedda 100644 --- a/src/Features/VisualBasic/Portable/AddAccessibilityModifiers/VisualBasicAddAccessibilityModifiersDiagnosticAnalyzer.vb +++ b/src/Features/VisualBasic/Portable/AddAccessibilityModifiers/VisualBasicAddAccessibilityModifiersDiagnosticAnalyzer.vb @@ -55,18 +55,57 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.AddAccessibilityModifiers Return End If - ' If they already have accessibility, no need to report anything. + ' This analyzer bases all of its decisions on the accessibility Dim Accessibility = generator.GetAccessibility(member) - If Accessibility <> Accessibility.NotApplicable Then - Return + + ' Omit will flag any accesibility values that exist and are default + ' The other options will remove or ignore accessibility + Dim isOmit = [option].Value = AccessibilityModifiersRequired.OmitIfDefault + + If isOmit Then + If Accessibility = Accessibility.NotApplicable Then + ' Accessibility modifier already missing. nothing we need to do. + Return + End If + + If Not MatchesDefaultAccessibility(Accessibility, member) Then + ' Explicit accessibility was different than the default accessibility. + ' We have to keep this here. + Return + End If + + Else ' Require all, flag missing modidifers + If Accessibility <> Accessibility.NotApplicable Then + Return + End If End If - ' Missing accessibility. Report issue to user. + ' Have an issue to flag, either add or remove. Report issue to user. Dim additionalLocations = ImmutableArray.Create(member.GetLocation()) context.ReportDiagnostic(Diagnostic.Create( CreateDescriptorWithSeverity([option].Notification.Value), name.GetLocation(), additionalLocations:=additionalLocations)) End Sub + + Private Function MatchesDefaultAccessibility(accessibility As Accessibility, member As StatementSyntax) As Boolean + ' Top level items in a namespace or file + If member.IsParentKind(SyntaxKind.CompilationUnit) OrElse + member.IsParentKind(SyntaxKind.NamespaceBlock) Then + ' default is Friend + Return accessibility = Accessibility.Friend + End If + + ' default for const and field in a class is private + If member.IsParentKind(SyntaxKind.ClassBlock) OrElse + member.IsParentKind(SyntaxKind.ModuleBlock) Then + If member.IsKind(SyntaxKind.FieldDeclaration) Then + Return accessibility = Accessibility.Private + End If + End If + + ' Everything else has a default of public + Return accessibility = Accessibility.Public + End Function End Class End Namespace diff --git a/src/Scripting/CSharpTest/CommandLineRunnerTests.cs b/src/Scripting/CSharpTest/CommandLineRunnerTests.cs index b9da98a124bd4..8b9c5f4a6551e 100644 --- a/src/Scripting/CSharpTest/CommandLineRunnerTests.cs +++ b/src/Scripting/CSharpTest/CommandLineRunnerTests.cs @@ -84,9 +84,10 @@ private static CommandLineRunner CreateRunner( string workingDirectory = null) { var io = new TestConsoleIO(input); + var clientDir = Path.GetDirectoryName(RuntimeUtilities.GetAssemblyLocation(typeof(CommandLineRunnerTests))); var buildPaths = new BuildPaths( - clientDir: AppContext.BaseDirectory, - workingDir: workingDirectory ?? AppContext.BaseDirectory, + clientDir: clientDir, + workingDir: workingDirectory ?? clientDir, sdkDir: null, tempDir: Path.GetTempPath()); diff --git a/src/Test/Diagnostics/TestingOnly_WaitingService.cs b/src/Test/Diagnostics/TestingOnly_WaitingService.cs index d2a92748f8935..1060bd0f6d759 100644 --- a/src/Test/Diagnostics/TestingOnly_WaitingService.cs +++ b/src/Test/Diagnostics/TestingOnly_WaitingService.cs @@ -1,29 +1,25 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Composition; -using System.Linq; -using System.Threading.Tasks; +using System.Windows.Threading; using Microsoft.CodeAnalysis.Shared.TestHooks; -using Roslyn.Test.Utilities; +using Roslyn.Utilities; namespace Roslyn.Hosting.Diagnostics.Waiters { [Export, Shared] public class TestingOnly_WaitingService { - private readonly IEnumerable> _waiters; + private readonly AsynchronousOperationListenerProvider _provider; [ImportingConstructor] - private TestingOnly_WaitingService([ImportMany] IEnumerable> waiters) + private TestingOnly_WaitingService(IAsynchronousOperationListenerProvider provider) { - _waiters = waiters; + _provider = (AsynchronousOperationListenerProvider)provider; } - private void WaitForAsyncOperations( - Func predicate, - bool waitForWorkspaceFirst = true) + public void WaitForAsyncOperations(string featureName, bool waitForWorkspaceFirst = true) { // FeatureMetadata is MEF's way to extract export metadata from the exported instance's // [Feature] attribute e.g. if the export defines an attribute like this: @@ -34,88 +30,59 @@ private void WaitForAsyncOperations( // the FeatureMetadata ("FeatureName" as well). Types and names of properties must // match. Read more at http://mef.codeplex.com/wikipage?title=Exports%20and%20Metadata - var workspaceListener = - (from export in _waiters - where export.Metadata.FeatureName == FeatureAttribute.Workspace - select export.Value).FirstOrDefault(); - - var listeners = - (from export in _waiters - where predicate(export.Metadata) - select export.Value).ToArray(); - - if (!listeners.Any()) - { - throw new InvalidOperationException("There is no waiter that matches your condition!"); - } + var workspaceWaiter = _provider.GetWaiter(FeatureAttribute.Workspace); + var featureWaiter = _provider.GetWaiter(featureName); + Contract.ThrowIfNull(featureWaiter); // wait for each of the features specified in the featuresToWaitFor string if (waitForWorkspaceFirst) { // at least wait for the workspace to finish processing everything. - if (workspaceListener != null) - { - var task = workspaceListener.CreateWaitTask(); - task.Wait(); - } + var task = workspaceWaiter.CreateWaitTask(); + task.Wait(); } - var waitTasks = listeners.Select(l => - { - var task = l.CreateWaitTask(); - return task; - }).ToArray(); - - while (!Task.WaitAll(waitTasks, 100)) - { - // set breakpoint here when debugging - var tokens = listeners.Where(l => l.TrackActiveTokens).SelectMany(l => l.ActiveDiagnosticTokens).ToArray(); + var waitTask = featureWaiter.CreateWaitTask(); - GC.KeepAlive(tokens); - } + WaitForTask(waitTask); // Debugging trick: don't let the listeners collection get optimized away during execution. // This means if the process is killed during integration tests and the test was waiting, you can // easily look at the listeners and see what is going on. This is not actually needed to // affect the GC, nor is it needed for correctness. - GC.KeepAlive(listeners); + GC.KeepAlive(featureWaiter); } - public void WaitForAsyncOperations( - string featuresToWaitFor, - bool waitForWorkspaceFirst = true) + public void WaitForAllAsyncOperations(params string[] featureNames) { - WaitForAsyncOperations(featureMetadata => featuresToWaitFor.Contains(featureMetadata.FeatureName), waitForWorkspaceFirst); - } + var task = _provider.WaitAllAsync( + featureNames, + eventProcessingAction: () => Dispatcher.CurrentDispatcher.Invoke(() => { }, DispatcherPriority.ApplicationIdle)); - public void WaitForAllAsyncOperations() - { - WaitForAsyncOperations(_ => true, true); + WaitForTask(task); } - public void SetTrackActiveTokens(bool trackTokens) + public void EnableActiveTokenTracking(bool enable) { - foreach (var waiter in _waiters) - { - waiter.Value.TrackActiveTokens = trackTokens; - } + _provider.EnableDiagnosticTokens(enable); } - public IEnumerable GetTotalFeatures() + public void Enable(bool enable) { - return _waiters.Select(w => w.Metadata.FeatureName); + AsynchronousOperationListenerProvider.Enable(enable); } - public IEnumerable GetActiveFeatures() + private void WaitForTask(System.Threading.Tasks.Task task) { - return from w in _waiters where w.Value.HasPendingWork select w.Metadata.FeatureName; - } - - public void EnableActiveTokenTracking(bool enable) - { - foreach (var waiter in _waiters) + while (!task.Wait(100)) { - waiter.Value.TrackActiveTokens = enable; + // set breakpoint here when debugging + var tokens = _provider.GetTokens(); + + GC.KeepAlive(tokens); + + // make sure pending task that require UI threads to finish as well. + Dispatcher.CurrentDispatcher.Invoke(() => { }, DispatcherPriority.ApplicationIdle); } } } diff --git a/src/Test/Diagnostics/Waiters/AutomaticCompletionWaiter.cs b/src/Test/Diagnostics/Waiters/AutomaticCompletionWaiter.cs deleted file mode 100644 index 25886275f42d9..0000000000000 --- a/src/Test/Diagnostics/Waiters/AutomaticCompletionWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.AutomaticPairCompletion)] - internal class AutomaticCompletionWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/AutomaticEndConstructCorrectionWaiter.cs b/src/Test/Diagnostics/Waiters/AutomaticEndConstructCorrectionWaiter.cs deleted file mode 100644 index 13304fbba95a9..0000000000000 --- a/src/Test/Diagnostics/Waiters/AutomaticEndConstructCorrectionWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.AutomaticEndConstructCorrection)] - internal class AutomaticEndConstructCorrectionWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/BraceHighlightingWaiter.cs b/src/Test/Diagnostics/Waiters/BraceHighlightingWaiter.cs deleted file mode 100644 index f9135b8f5e6c5..0000000000000 --- a/src/Test/Diagnostics/Waiters/BraceHighlightingWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.BraceHighlighting)] - internal class BraceHighlightingWaiter : EditorAdornmentWaiter { } -} diff --git a/src/Test/Diagnostics/Waiters/ClassificationWaiter.cs b/src/Test/Diagnostics/Waiters/ClassificationWaiter.cs deleted file mode 100644 index f9fa66c79a4e7..0000000000000 --- a/src/Test/Diagnostics/Waiters/ClassificationWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.Classification)] - internal class ClassificationWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/CompletionSetWaiter.cs b/src/Test/Diagnostics/Waiters/CompletionSetWaiter.cs deleted file mode 100644 index a7e5d16307b34..0000000000000 --- a/src/Test/Diagnostics/Waiters/CompletionSetWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.CompletionSet)] - internal class CompletionSetWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/DesignerAttributeWaiter.cs b/src/Test/Diagnostics/Waiters/DesignerAttributeWaiter.cs deleted file mode 100644 index 366825cbe45f3..0000000000000 --- a/src/Test/Diagnostics/Waiters/DesignerAttributeWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.DesignerAttribute)] - internal class DesignerAttributeWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/DiagnosticServiceWaiter.cs b/src/Test/Diagnostics/Waiters/DiagnosticServiceWaiter.cs deleted file mode 100644 index 6db4825ab535f..0000000000000 --- a/src/Test/Diagnostics/Waiters/DiagnosticServiceWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.DiagnosticService)] - internal class DiagnosticServiceWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/EditorAdornmentWaiter.cs b/src/Test/Diagnostics/Waiters/EditorAdornmentWaiter.cs deleted file mode 100644 index 64197aefaaa29..0000000000000 --- a/src/Test/Diagnostics/Waiters/EditorAdornmentWaiter.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Threading; -using Microsoft.CodeAnalysis.Shared.TestHooks; -using Roslyn.Utilities; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - internal abstract class EditorAdornmentWaiter : AsynchronousOperationListener - { - public override Task CreateWaitTask() - { - var task = base.CreateWaitTask(); - return task.SafeContinueWith(_ => - { - void a() { } - Dispatcher.CurrentDispatcher.Invoke(a, DispatcherPriority.ApplicationIdle); - }, - CancellationToken.None, - TaskScheduler.Default); - } - } -} diff --git a/src/Test/Diagnostics/Waiters/EncapsulateFieldWaiter.cs b/src/Test/Diagnostics/Waiters/EncapsulateFieldWaiter.cs deleted file mode 100644 index c6f505fa3c55b..0000000000000 --- a/src/Test/Diagnostics/Waiters/EncapsulateFieldWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.EncapsulateField)] - internal class EncapsulateFieldWaiter : EditorAdornmentWaiter { } -} \ No newline at end of file diff --git a/src/Test/Diagnostics/Waiters/ErrorListWaiter.cs b/src/Test/Diagnostics/Waiters/ErrorListWaiter.cs deleted file mode 100644 index 1d77e5c63329d..0000000000000 --- a/src/Test/Diagnostics/Waiters/ErrorListWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.ErrorList)] - internal class ErrorListWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/ErrorSquiggleWaiter.cs b/src/Test/Diagnostics/Waiters/ErrorSquiggleWaiter.cs deleted file mode 100644 index 8251fa3d759c2..0000000000000 --- a/src/Test/Diagnostics/Waiters/ErrorSquiggleWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.ErrorSquiggles)] - internal class ErrorSquiggleWaiter : EditorAdornmentWaiter { } -} diff --git a/src/Test/Diagnostics/Waiters/EventHookupWaiter.cs b/src/Test/Diagnostics/Waiters/EventHookupWaiter.cs deleted file mode 100644 index bfe6877342e5f..0000000000000 --- a/src/Test/Diagnostics/Waiters/EventHookupWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.EventHookup)] - internal class EventHookupWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/FindReferencesWaiter.cs b/src/Test/Diagnostics/Waiters/FindReferencesWaiter.cs deleted file mode 100644 index ea5a4b9b45fa4..0000000000000 --- a/src/Test/Diagnostics/Waiters/FindReferencesWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.FindReferences)] - internal class FindReferencesWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/GlobalOperationWatier.cs b/src/Test/Diagnostics/Waiters/GlobalOperationWatier.cs deleted file mode 100644 index 9748a8085cab9..0000000000000 --- a/src/Test/Diagnostics/Waiters/GlobalOperationWatier.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.GlobalOperation)] - internal class GlobalOperationWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/GraphProviderWaiter.cs b/src/Test/Diagnostics/Waiters/GraphProviderWaiter.cs deleted file mode 100644 index e0aacfaa54edd..0000000000000 --- a/src/Test/Diagnostics/Waiters/GraphProviderWaiter.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.GraphProvider)] - internal class GraphProviderWaiter : AsynchronousOperationListener - { - } -} diff --git a/src/Test/Diagnostics/Waiters/KeywordHighlightingWaiter.cs b/src/Test/Diagnostics/Waiters/KeywordHighlightingWaiter.cs deleted file mode 100644 index 1c8932fdb3902..0000000000000 --- a/src/Test/Diagnostics/Waiters/KeywordHighlightingWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.KeywordHighlighting)] - internal class KeywordHighlightingWaiter : EditorAdornmentWaiter { } -} diff --git a/src/Test/Diagnostics/Waiters/LightBulbWaiter.cs b/src/Test/Diagnostics/Waiters/LightBulbWaiter.cs deleted file mode 100644 index c1717d6740621..0000000000000 --- a/src/Test/Diagnostics/Waiters/LightBulbWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.LightBulb)] - internal class LightBulbWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/LineSeparatorWaiter.cs b/src/Test/Diagnostics/Waiters/LineSeparatorWaiter.cs deleted file mode 100644 index 6b4b80c0972f6..0000000000000 --- a/src/Test/Diagnostics/Waiters/LineSeparatorWaiter.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - // This doesn't need to be an EditorAdornmentWaiter, since we control our own - // adornment layer - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.LineSeparators)] - internal class LineSeparatorWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/NavigateToWaiter.cs b/src/Test/Diagnostics/Waiters/NavigateToWaiter.cs deleted file mode 100644 index 12301b6940b91..0000000000000 --- a/src/Test/Diagnostics/Waiters/NavigateToWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.NavigateTo)] - internal class NavigateToWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/NavigationBarWaiter.cs b/src/Test/Diagnostics/Waiters/NavigationBarWaiter.cs deleted file mode 100644 index 745ebc96a5247..0000000000000 --- a/src/Test/Diagnostics/Waiters/NavigationBarWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.NavigationBar)] - internal class NavigationBarWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/OutliningWaiter.cs b/src/Test/Diagnostics/Waiters/OutliningWaiter.cs deleted file mode 100644 index 165b3cc8a0518..0000000000000 --- a/src/Test/Diagnostics/Waiters/OutliningWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.Outlining)] - internal class OutliningWaiter : EditorAdornmentWaiter { } -} diff --git a/src/Test/Diagnostics/Waiters/QuickInfoWaiter.cs b/src/Test/Diagnostics/Waiters/QuickInfoWaiter.cs deleted file mode 100644 index a1b19836e5d95..0000000000000 --- a/src/Test/Diagnostics/Waiters/QuickInfoWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.QuickInfo)] - internal class QuickInfoWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/ReferenceHighlightingWaiter.cs b/src/Test/Diagnostics/Waiters/ReferenceHighlightingWaiter.cs deleted file mode 100644 index 1546b8843c689..0000000000000 --- a/src/Test/Diagnostics/Waiters/ReferenceHighlightingWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.ReferenceHighlighting)] - internal class ReferenceHighlightingWaiter : EditorAdornmentWaiter { } -} diff --git a/src/Test/Diagnostics/Waiters/RemoteHostClientWaiter.cs b/src/Test/Diagnostics/Waiters/RemoteHostClientWaiter.cs deleted file mode 100644 index 8ea6f3ef1fadd..0000000000000 --- a/src/Test/Diagnostics/Waiters/RemoteHostClientWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.RemoteHostClient)] - internal class RemoteHostClientWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/RenameWaiter.cs b/src/Test/Diagnostics/Waiters/RenameWaiter.cs deleted file mode 100644 index 2dd52ea376beb..0000000000000 --- a/src/Test/Diagnostics/Waiters/RenameWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.Rename)] - internal class RenameWaiter : EditorAdornmentWaiter { } -} diff --git a/src/Test/Diagnostics/Waiters/SignatureHelpWaiter.cs b/src/Test/Diagnostics/Waiters/SignatureHelpWaiter.cs deleted file mode 100644 index 64452f8743930..0000000000000 --- a/src/Test/Diagnostics/Waiters/SignatureHelpWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.SignatureHelp)] - internal class SignatureHelpWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/SnippetWaiter.cs b/src/Test/Diagnostics/Waiters/SnippetWaiter.cs deleted file mode 100644 index e09b3d982bcf3..0000000000000 --- a/src/Test/Diagnostics/Waiters/SnippetWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.Snippets)] - internal class SnippetWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/SolutionCrawlerWaiter.cs b/src/Test/Diagnostics/Waiters/SolutionCrawlerWaiter.cs deleted file mode 100644 index d962f62f18228..0000000000000 --- a/src/Test/Diagnostics/Waiters/SolutionCrawlerWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.SolutionCrawler)] - internal class SolutionCrawlerWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/TodoCommentListWaiter.cs b/src/Test/Diagnostics/Waiters/TodoCommentListWaiter.cs deleted file mode 100644 index 398f03a1676fd..0000000000000 --- a/src/Test/Diagnostics/Waiters/TodoCommentListWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.TodoCommentList)] - internal class TodoCommentListWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters/WorkspaceWaiter.cs b/src/Test/Diagnostics/Waiters/WorkspaceWaiter.cs deleted file mode 100644 index 561917cbd9c6b..0000000000000 --- a/src/Test/Diagnostics/Waiters/WorkspaceWaiter.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Shared.TestHooks; - -namespace Roslyn.Hosting.Diagnostics.Waiters -{ - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.Workspace)] - internal class WorkspaceWaiter : AsynchronousOperationListener { } -} diff --git a/src/Test/Diagnostics/Waiters_Legacy/WaiterBase.cs b/src/Test/Diagnostics/Waiters_Legacy/WaiterBase.cs new file mode 100644 index 0000000000000..4a566d654c1d3 --- /dev/null +++ b/src/Test/Diagnostics/Waiters_Legacy/WaiterBase.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Shared.TestHooks; + +namespace Roslyn.Hosting.Diagnostics.Waiters +{ + internal class WaiterBase : IAsynchronousOperationListener, IAsynchronousOperationWaiter + { + private readonly AsynchronousOperationListener _delegatee; + + protected WaiterBase(string name, IAsynchronousOperationListenerProvider provider) + { + _delegatee = (AsynchronousOperationListener)provider.GetListener(name); + } + + public bool TrackActiveTokens + { + get + { + return _delegatee.TrackActiveTokens; + } + set + { + _delegatee.TrackActiveTokens = value; + } + } + + public bool HasPendingWork => _delegatee.HasPendingWork; + + public ImmutableArray ActiveDiagnosticTokens => + _delegatee.ActiveDiagnosticTokens; + + public IAsyncToken BeginAsyncOperation(string name, object tag = null, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0) => + _delegatee.BeginAsyncOperation(name, tag, filePath, lineNumber); + + public Task CreateWaitTask() => _delegatee.CreateWaitTask(); + } +} diff --git a/src/Test/Diagnostics/Waiters_Legacy/Waiters.cs b/src/Test/Diagnostics/Waiters_Legacy/Waiters.cs new file mode 100644 index 0000000000000..58bcaa2af9a74 --- /dev/null +++ b/src/Test/Diagnostics/Waiters_Legacy/Waiters.cs @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Composition; +using Microsoft.CodeAnalysis.Shared.TestHooks; + +namespace Roslyn.Hosting.Diagnostics.Waiters +{ + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.AutomaticPairCompletion)] + internal class AutomaticCompletionWaiter : WaiterBase + { + public AutomaticCompletionWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.AutomaticPairCompletion, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.AutomaticEndConstructCorrection)] + internal class AutomaticEndConstructCorrectionWaiter : WaiterBase + { + public AutomaticEndConstructCorrectionWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.AutomaticEndConstructCorrection, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.BraceHighlighting)] + internal class BraceHighlightingWaiter : WaiterBase + { + public BraceHighlightingWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.BraceHighlighting, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.Classification)] + internal class ClassificationWaiter : WaiterBase + { + public ClassificationWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.Classification, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.CompletionSet)] + internal class CompletionSetWaiter : WaiterBase + { + public CompletionSetWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.CompletionSet, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.DesignerAttribute)] + internal class DesignerAttributeWaiter : WaiterBase + { + public DesignerAttributeWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.DesignerAttribute, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.DiagnosticService)] + internal class DiagnosticServiceWaiter : WaiterBase + { + public DiagnosticServiceWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.DiagnosticService, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.EncapsulateField)] + internal class EncapsulateFieldWaiter : WaiterBase + { + public EncapsulateFieldWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.EncapsulateField, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.ErrorList)] + internal class ErrorListWaiter : WaiterBase + { + public ErrorListWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.ErrorList, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.ErrorSquiggles)] + internal class ErrorSquiggleWaiter : WaiterBase + { + public ErrorSquiggleWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.ErrorSquiggles, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.EventHookup)] + internal class EventHookupWaiter : WaiterBase + { + public EventHookupWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.EventHookup, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.FindReferences)] + internal class FindReferencesWaiter : WaiterBase + { + public FindReferencesWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.FindReferences, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.GlobalOperation)] + internal class GlobalOperationWaiter : WaiterBase + { + public GlobalOperationWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.GlobalOperation, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.GraphProvider)] + internal class GraphProviderWaiter : WaiterBase + { + public GraphProviderWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.GraphProvider, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.KeywordHighlighting)] + internal class KeywordHighlightingWaiter : WaiterBase + { + public KeywordHighlightingWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.KeywordHighlighting, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.LightBulb)] + internal class LightBulbWaiter : WaiterBase + { + public LightBulbWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.LightBulb, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.LineSeparators)] + internal class LineSeparatorWaiter : WaiterBase + { + public LineSeparatorWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.LineSeparators, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.NavigateTo)] + internal class NavigateToWaiter : WaiterBase + { + public NavigateToWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.NavigateTo, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.NavigationBar)] + internal class NavigationBarWaiter : WaiterBase + { + public NavigationBarWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.NavigationBar, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.Outlining)] + internal class OutliningWaiter : WaiterBase + { + public OutliningWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.Outlining, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.QuickInfo)] + internal class QuickInfoWaiter : WaiterBase + { + public QuickInfoWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.QuickInfo, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.ReferenceHighlighting)] + internal class ReferenceHighlightingWaiter : WaiterBase + { + public ReferenceHighlightingWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.ReferenceHighlighting, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.RemoteHostClient)] + internal class RemoteHostClientWaiter : WaiterBase + { + public RemoteHostClientWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.RemoteHostClient, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.Rename)] + internal class RenameWaiter : WaiterBase + { + public RenameWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.Rename, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.SignatureHelp)] + internal class SignatureHelpWaiter : WaiterBase + { + public SignatureHelpWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.SignatureHelp, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.Snippets)] + internal class SnippetWaiter : WaiterBase + { + public SnippetWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.Snippets, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.SolutionCrawler)] + internal class SolutionCrawlerWaiter : WaiterBase + { + public SolutionCrawlerWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.SolutionCrawler, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.TodoCommentList)] + internal class TodoCommentListWaiter : WaiterBase + { + public TodoCommentListWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.TodoCommentList, provider) + { + } + } + + [Shared] + [Export(typeof(IAsynchronousOperationListener))] + [Export(typeof(IAsynchronousOperationWaiter))] + [Feature(FeatureAttribute.Workspace)] + internal class WorkspaceWaiter : WaiterBase + { + public WorkspaceWaiter(IAsynchronousOperationListenerProvider provider) : + base(FeatureAttribute.Workspace, provider) + { + } + } +} diff --git a/src/Test/Utilities/Portable/Compilation/RuntimeUtilities.cs b/src/Test/Utilities/Portable/Compilation/RuntimeUtilities.cs index 56c07a2c78131..f71e02b10fcdc 100644 --- a/src/Test/Utilities/Portable/Compilation/RuntimeUtilities.cs +++ b/src/Test/Utilities/Portable/Compilation/RuntimeUtilities.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Reflection; using System.Runtime.InteropServices; using System.Text; using Roslyn.Test.Utilities; @@ -48,6 +49,20 @@ internal static AnalyzerAssemblyLoader CreateAnalyzerAssemblyLoader() return new DesktopAnalyzerAssemblyLoader(); #else return new ThrowingAnalyzerAssemblyLoader(); +#endif + } + + /// + /// Get the location of the assembly that contains this type + /// + internal static string GetAssemblyLocation(Type type) + { +#if NET461 || NET46 || NETCOREAPP2_0 + return type.GetTypeInfo().Assembly.Location; +#elif NETSTANDARD1_3 + throw new NotSupportedException(); +#else +#error Unsupported configuration #endif } } diff --git a/src/Test/Utilities/Portable/Metadata/IlasmUtilities.cs b/src/Test/Utilities/Portable/Metadata/IlasmUtilities.cs index a123eaa2b6561..b554ab5349500 100644 --- a/src/Test/Utilities/Portable/Metadata/IlasmUtilities.cs +++ b/src/Test/Utilities/Portable/Metadata/IlasmUtilities.cs @@ -24,14 +24,14 @@ private static string GetIlasmPath() if (CoreClrShim.AssemblyLoadContext.Type == null) { return Path.Combine( - Path.GetDirectoryName(CorLightup.Desktop.GetAssemblyLocation(typeof(object).GetTypeInfo().Assembly)), + Path.GetDirectoryName(RuntimeUtilities.GetAssemblyLocation(typeof(object))), "ilasm.exe"); } else { var ilasmExeName = PlatformInformation.IsWindows ? "ilasm.exe" : "ilasm"; - var directory = AppContext.BaseDirectory; + var directory = Path.GetDirectoryName(RuntimeUtilities.GetAssemblyLocation(typeof(RuntimeUtilities))); string path = null; while (directory != null && !File.Exists(path = Path.Combine(directory, "Binaries", "Tools", "ILAsm", ilasmExeName))) { diff --git a/src/VisualStudio/CSharp/Impl/EventHookup/EventHookupCommandHandler.cs b/src/VisualStudio/CSharp/Impl/EventHookup/EventHookupCommandHandler.cs index 78c45046e850c..79176c8776b1a 100644 --- a/src/VisualStudio/CSharp/Impl/EventHookup/EventHookupCommandHandler.cs +++ b/src/VisualStudio/CSharp/Impl/EventHookup/EventHookupCommandHandler.cs @@ -38,7 +38,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.EventHookup internal partial class EventHookupCommandHandler : ForegroundThreadAffinitizedObject { private readonly IInlineRenameService _inlineRenameService; - private readonly AggregateAsynchronousOperationListener _asyncListener; + private readonly IAsynchronousOperationListener _asyncListener; internal readonly EventHookupSessionManager EventHookupSessionManager; @@ -55,11 +55,11 @@ public EventHookupCommandHandler( IQuickInfoBroker quickInfoBroker, #pragma warning restore CS0618 // IQuickInfo* is obsolete, tracked by https://github.com/dotnet/roslyn/issues/24094 [Import(AllowDefault = true)] IHACK_EventHookupDismissalOnBufferChangePreventerService prematureDismissalPreventer, - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _inlineRenameService = inlineRenameService; _prematureDismissalPreventer = prematureDismissalPreventer; - _asyncListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.EventHookup); + _asyncListener = listenerProvider.GetListener(FeatureAttribute.EventHookup); this.EventHookupSessionManager = new EventHookupSessionManager(prematureDismissalPreventer, quickInfoBroker); } diff --git a/src/VisualStudio/CSharp/Impl/EventHookup/EventHookupSessionManager.cs b/src/VisualStudio/CSharp/Impl/EventHookup/EventHookupSessionManager.cs index b33b0f7363870..a8a6d0bda89a6 100644 --- a/src/VisualStudio/CSharp/Impl/EventHookup/EventHookupSessionManager.cs +++ b/src/VisualStudio/CSharp/Impl/EventHookup/EventHookupSessionManager.cs @@ -79,7 +79,7 @@ internal void BeginSession( EventHookupCommandHandler eventHookupCommandHandler, ITextView textView, ITextBuffer subjectBuffer, - AggregateAsynchronousOperationListener asyncListener, + IAsynchronousOperationListener asyncListener, Mutex testSessionHookupMutex) { CurrentSession = new EventHookupSession(this, eventHookupCommandHandler, textView, subjectBuffer, asyncListener, testSessionHookupMutex); diff --git a/src/VisualStudio/CSharp/Impl/Progression/CSharpGraphProvider.cs b/src/VisualStudio/CSharp/Impl/Progression/CSharpGraphProvider.cs index 92b7f5de83dc9..10f4aed127bb8 100644 --- a/src/VisualStudio/CSharp/Impl/Progression/CSharpGraphProvider.cs +++ b/src/VisualStudio/CSharp/Impl/Progression/CSharpGraphProvider.cs @@ -20,8 +20,8 @@ public CSharpGraphProvider( IGlyphService glyphService, SVsServiceProvider serviceProvider, IProgressionPrimaryWorkspaceProvider workspaceProvider, - [ImportMany] IEnumerable> asyncListeners) : - base(glyphService, serviceProvider, workspaceProvider.PrimaryWorkspace, asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) : + base(glyphService, serviceProvider, workspaceProvider.PrimaryWorkspace, listenerProvider) { } } diff --git a/src/VisualStudio/CSharp/Impl/Snippets/CSharpSnippetInfoService.cs b/src/VisualStudio/CSharp/Impl/Snippets/CSharpSnippetInfoService.cs index 7861f87059fe5..0b81cfb807f86 100644 --- a/src/VisualStudio/CSharp/Impl/Snippets/CSharpSnippetInfoService.cs +++ b/src/VisualStudio/CSharp/Impl/Snippets/CSharpSnippetInfoService.cs @@ -26,8 +26,8 @@ internal class CSharpSnippetInfoService : AbstractSnippetInfoService [ImportingConstructor] public CSharpSnippetInfoService( SVsServiceProvider serviceProvider, - [ImportMany] IEnumerable> asyncListeners) - : base(serviceProvider, Guids.CSharpLanguageServiceId, asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) + : base(serviceProvider, Guids.CSharpLanguageServiceId, listenerProvider) { } diff --git a/src/VisualStudio/CSharp/Test/EventHookup/EventHookupTestState.cs b/src/VisualStudio/CSharp/Test/EventHookup/EventHookupTestState.cs index 718c23a609b60..dc5c7ff925e87 100644 --- a/src/VisualStudio/CSharp/Test/EventHookup/EventHookupTestState.cs +++ b/src/VisualStudio/CSharp/Test/EventHookup/EventHookupTestState.cs @@ -27,7 +27,7 @@ public EventHookupTestState(XElement workspaceElement, IDictionary(), Workspace.GetService(), - prematureDismissalPreventer: null, Workspace.ExportProvider.GetExportedValues().Select(l => new Lazy(() => l, new FeatureMetadata("EventHookup")))); + prematureDismissalPreventer: null, Workspace.ExportProvider.GetExportedValue()); #pragma warning restore CS0618 // IQuickInfo* is obsolete, tracked by https://github.com/dotnet/roslyn/issues/24094 _testSessionHookupMutex = new Mutex(false); @@ -37,7 +37,7 @@ public EventHookupTestState(XElement workspaceElement, IDictionary options = null) diff --git a/src/VisualStudio/CSharp/Test/ProjectSystemShim/LegacyProject/CSharpReferencesTests.cs b/src/VisualStudio/CSharp/Test/ProjectSystemShim/LegacyProject/CSharpReferencesTests.cs index 5805df8a38767..c6822624363ad 100644 --- a/src/VisualStudio/CSharp/Test/ProjectSystemShim/LegacyProject/CSharpReferencesTests.cs +++ b/src/VisualStudio/CSharp/Test/ProjectSystemShim/LegacyProject/CSharpReferencesTests.cs @@ -19,10 +19,10 @@ public void AddingReferenceToProjectMetadataPromotesToProjectReference() using (var environment = new TestEnvironment()) { var project1 = CreateCSharpProject(environment, "project1"); - environment.ProjectTracker.UpdateProjectBinPath(project1, null, @"c:\project1.dll"); + project1.SetBinOutputPathAndRelatedData(@"c:\project1.dll"); var project2 = CreateCSharpProject(environment, "project2"); - environment.ProjectTracker.UpdateProjectBinPath(project2, null, @"c:\project2.dll"); + project2.SetBinOutputPathAndRelatedData(@"c:\project2.dll"); // since this is known to be the output path of project1, the metadata reference is converted to a project reference project2.OnImportAdded(@"c:\project1.dll", "project1"); @@ -41,10 +41,10 @@ public void AddCyclicProjectMetadataReferences() using (var environment = new TestEnvironment()) { var project1 = CreateCSharpProject(environment, "project1"); - environment.ProjectTracker.UpdateProjectBinPath(project1, null, @"c:\project1.dll"); + project1.SetBinOutputPathAndRelatedData(@"c:\project1.dll"); var project2 = CreateCSharpProject(environment, "project2"); - environment.ProjectTracker.UpdateProjectBinPath(project2, null, @"c:\project2.dll"); + project2.SetBinOutputPathAndRelatedData(@"c:\project2.dll"); project1.AddProjectReference(new ProjectReference(project2.Id)); @@ -108,34 +108,65 @@ public void AddCyclicProjectReferencesDeep() } [WorkItem(12707, "https://github.com/dotnet/roslyn/issues/12707")] - [Fact(Skip = "https://github.com/dotnet/roslyn/issues/12707")] + [WpfFact] [Trait(Traits.Feature, Traits.Features.ProjectSystemShims)] public void AddingProjectReferenceAndUpdateReferenceBinPath() { using (var environment = new TestEnvironment()) { var project1 = CreateCSharpProject(environment, "project1"); - environment.ProjectTracker.UpdateProjectBinPath(project1, null, @"c:\project1.dll"); + project1.SetBinOutputPathAndRelatedData(@"c:\project1.dll"); var project2 = CreateCSharpProject(environment, "project2"); - environment.ProjectTracker.UpdateProjectBinPath(project2, null, @"c:\project2.dll"); + project2.SetBinOutputPathAndRelatedData(@"c:\project2.dll"); // since this is known to be the output path of project1, the metadata reference is converted to a project reference project2.OnImportAdded(@"c:\project1.dll", "project1"); - Assert.Equal(true, project2.GetCurrentProjectReferences().Any(pr => pr.ProjectId == project1.Id)); + Assert.Single(project2.GetCurrentProjectReferences().Where(pr => pr.ProjectId == project1.Id)); // update bin bath for project1. - environment.ProjectTracker.UpdateProjectBinPath(project1, @"c:\project1.dll", @"c:\new_project1.dll"); + project1.SetBinOutputPathAndRelatedData(@"c:\new_project1.dll"); // Verify project reference updated after bin path change. - Assert.Equal(true, project2.GetCurrentProjectReferences().Any(pr => pr.ProjectId == project1.Id)); + Assert.Empty(project2.GetCurrentProjectReferences()); + + // This is a metadata reference to the original path + var metadataReference = Assert.Single(project2.GetCurrentMetadataReferences()); + Assert.Equal(@"c:\project1.dll", metadataReference.FilePath); project2.Disconnect(); project1.Disconnect(); } } + [WorkItem(12707, "https://github.com/dotnet/roslyn/issues/12707")] + [WpfFact] + [Trait(Traits.Feature, Traits.Features.ProjectSystemShims)] + public void DisconnectingProjectShouldConvertConvertedReferencesBack() + { + using (var environment = new TestEnvironment()) + { + var project1 = CreateCSharpProject(environment, "project1"); + project1.SetBinOutputPathAndRelatedData(@"c:\project1.dll"); + + var project2 = CreateCSharpProject(environment, "project2"); + project2.SetBinOutputPathAndRelatedData(@"c:\project2.dll"); + + // since this is known to be the output path of project1, the metadata reference is converted to a project reference + project2.OnImportAdded(@"c:\project1.dll", "project1"); + + Assert.Single(project2.GetCurrentProjectReferences().Where(pr => pr.ProjectId == project1.Id)); + + project1.Disconnect(); + + // Verify project reference updated after bin path change. + Assert.Empty(project2.GetCurrentProjectReferences()); + Assert.Single(project2.GetCurrentMetadataReferences().Where(r => r.FilePath == @"c:\project1.dll")); + + project2.Disconnect(); + } + } [WorkItem(461967, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/461967")] [WpfFact()] @@ -145,10 +176,10 @@ public void AddingMetadataReferenceToProjectThatCannotCompileInTheIdeKeepsMetada using (var environment = new TestEnvironment()) { var project1 = CreateCSharpProject(environment, "project1"); - environment.ProjectTracker.UpdateProjectBinPath(project1, null, @"c:\project1.dll"); + project1.SetBinOutputPathAndRelatedData(@"c:\project1.dll"); var project2 = CreateNonCompilableProject(environment, "project2", @"C:\project2.fsproj"); - environment.ProjectTracker.UpdateProjectBinPath(project2, null, @"c:\project2.dll"); + project2.SetBinOutputPathAndRelatedData(@"c:\project2.dll"); project1.OnImportAdded(@"c:\project2.dll", "project2"); diff --git a/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyProvider.cs b/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyProvider.cs index af49bb4f05e74..b46fa5b6cc9c9 100644 --- a/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyProvider.cs +++ b/src/VisualStudio/Core/Def/Implementation/CallHierarchy/CallHierarchyProvider.cs @@ -27,10 +27,10 @@ internal partial class CallHierarchyProvider [ImportingConstructor] public CallHierarchyProvider( - [ImportMany] IEnumerable> asyncListeners, + IAsynchronousOperationListenerProvider listenerProvider, IGlyphService glyphService) { - _asyncListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.CallHierarchy); + _asyncListener = listenerProvider.GetListener(FeatureAttribute.CallHierarchy); this.GlyphService = glyphService; } diff --git a/src/VisualStudio/Core/Def/Implementation/DesignerAttribute/DesignerAttributeIncrementalAnalyzer.cs b/src/VisualStudio/Core/Def/Implementation/DesignerAttribute/DesignerAttributeIncrementalAnalyzer.cs index 6f03937a83b47..f45842f4dc445 100644 --- a/src/VisualStudio/Core/Def/Implementation/DesignerAttribute/DesignerAttributeIncrementalAnalyzer.cs +++ b/src/VisualStudio/Core/Def/Implementation/DesignerAttribute/DesignerAttributeIncrementalAnalyzer.cs @@ -44,7 +44,7 @@ internal partial class DesignerAttributeIncrementalAnalyzer : ForegroundThreadAf public DesignerAttributeIncrementalAnalyzer( IServiceProvider serviceProvider, IForegroundNotificationService notificationService, - IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _serviceProvider = serviceProvider; Contract.ThrowIfNull(_serviceProvider); @@ -52,7 +52,7 @@ public DesignerAttributeIncrementalAnalyzer( _notificationService = notificationService; _cpsProjects = new ConcurrentDictionary(concurrencyLevel: 2, capacity: 10); - _listener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.DesignerAttribute); + _listener = listenerProvider.GetListener(FeatureAttribute.DesignerAttribute); _state = new DesignerAttributeState(); } diff --git a/src/VisualStudio/Core/Def/Implementation/DesignerAttribute/DesignerAttributeIncrementalAnalyzerProvider.cs b/src/VisualStudio/Core/Def/Implementation/DesignerAttribute/DesignerAttributeIncrementalAnalyzerProvider.cs index 5a7fd09576b6e..d1bae4f98edee 100644 --- a/src/VisualStudio/Core/Def/Implementation/DesignerAttribute/DesignerAttributeIncrementalAnalyzerProvider.cs +++ b/src/VisualStudio/Core/Def/Implementation/DesignerAttribute/DesignerAttributeIncrementalAnalyzerProvider.cs @@ -18,22 +18,22 @@ internal class DesignerAttributeIncrementalAnalyzerProvider : IIncrementalAnalyz private readonly IServiceProvider _serviceProvider; private readonly IForegroundNotificationService _notificationService; - private readonly IEnumerable> _asyncListeners; + private readonly IAsynchronousOperationListenerProvider _listenerProvider; [ImportingConstructor] public DesignerAttributeIncrementalAnalyzerProvider( SVsServiceProvider serviceProvider, IForegroundNotificationService notificationService, - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _serviceProvider = serviceProvider; _notificationService = notificationService; - _asyncListeners = asyncListeners; + _listenerProvider = listenerProvider; } public IIncrementalAnalyzer CreateIncrementalAnalyzer(CodeAnalysis.Workspace workspace) { - return new DesignerAttributeIncrementalAnalyzer(_serviceProvider, _notificationService, _asyncListeners); + return new DesignerAttributeIncrementalAnalyzer(_serviceProvider, _notificationService, _listenerProvider); } } } diff --git a/src/VisualStudio/Core/Def/Implementation/InfoBar/VisualStudioInfoBarService.cs b/src/VisualStudio/Core/Def/Implementation/InfoBar/VisualStudioInfoBarService.cs index 905b9f9d2a2bb..4fb3280d8c324 100644 --- a/src/VisualStudio/Core/Def/Implementation/InfoBar/VisualStudioInfoBarService.cs +++ b/src/VisualStudio/Core/Def/Implementation/InfoBar/VisualStudioInfoBarService.cs @@ -26,11 +26,11 @@ internal class VisualStudioInfoBarService : ForegroundThreadAffinitizedObject, I [ImportingConstructor] public VisualStudioInfoBarService(SVsServiceProvider serviceProvider, IForegroundNotificationService foregroundNotificationService, - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _serviceProvider = serviceProvider; _foregroundNotificationService = foregroundNotificationService; - _listener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.InfoBar); + _listener = listenerProvider.GetListener(FeatureAttribute.InfoBar); } public void ShowInfoBarInActiveView(string message, params InfoBarUI[] items) diff --git a/src/VisualStudio/Core/Def/Implementation/Progression/GraphProvider.cs b/src/VisualStudio/Core/Def/Implementation/Progression/GraphProvider.cs index 02dbd1a99402c..74896b67b951b 100644 --- a/src/VisualStudio/Core/Def/Implementation/Progression/GraphProvider.cs +++ b/src/VisualStudio/Core/Def/Implementation/Progression/GraphProvider.cs @@ -27,11 +27,11 @@ protected AbstractGraphProvider( IGlyphService glyphService, SVsServiceProvider serviceProvider, CodeAnalysis.Workspace workspace, - IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _glyphService = glyphService; _serviceProvider = serviceProvider; - var asyncListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.GraphProvider); + var asyncListener = listenerProvider.GetListener(FeatureAttribute.GraphProvider); _graphQueryManager = new GraphQueryManager(workspace, asyncListener); } diff --git a/src/VisualStudio/Core/Def/Implementation/Progression/GraphQueryManager.cs b/src/VisualStudio/Core/Def/Implementation/Progression/GraphQueryManager.cs index 3c09c2c739517..ca0962c2b11c2 100644 --- a/src/VisualStudio/Core/Def/Implementation/Progression/GraphQueryManager.cs +++ b/src/VisualStudio/Core/Def/Implementation/Progression/GraphQueryManager.cs @@ -29,7 +29,7 @@ internal class GraphQueryManager // We update all of our tracked queries when this delay elapses. private ResettableDelay _delay; - internal GraphQueryManager(Workspace workspace, AggregateAsynchronousOperationListener asyncListener) + internal GraphQueryManager(Workspace workspace, IAsynchronousOperationListener asyncListener) { _workspace = workspace; _asyncListener = asyncListener; diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/AbstractProject.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/AbstractProject.cs index c0d0b830dd8a7..776098298c752 100644 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/AbstractProject.cs +++ b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/AbstractProject.cs @@ -55,11 +55,6 @@ internal abstract partial class AbstractProject : ForegroundThreadAffinitizedObj /// private readonly ISet _untrackedDocuments = new HashSet(StringComparer.OrdinalIgnoreCase); - /// - /// The path to a metadata reference that was converted to project references. - /// - private readonly Dictionary _metadataFileNameToConvertedProjectReference = new Dictionary(StringComparer.OrdinalIgnoreCase); - private bool _pushingChangesToWorkspaceHosts; #endregion @@ -85,6 +80,11 @@ private Dictionary Chang } } + /// + /// Maps from the output path of a project that was converted to + /// + private readonly Dictionary _metadataFileNameToConvertedProjectReference = new Dictionary(StringComparer.OrdinalIgnoreCase); + #endregion // PERF: Create these event handlers once to be shared amongst all documents (the sender arg identifies which document and project) @@ -280,18 +280,8 @@ protected string ContainingDirectoryPathOpt internal VsENCRebuildableProjectImpl EditAndContinueImplOpt { get; private set; } - /// - /// Override this method to validate references when creating for current state. - /// By default, this method does nothing. - /// - protected virtual void ValidateReferences() - { - } - public ProjectInfo CreateProjectInfoForCurrentState() { - ValidateReferences(); - lock (_gate) { var info = ProjectInfo.Create( @@ -439,46 +429,6 @@ public VisualStudioMetadataReference TryGetCurrentMetadataReference(string filen } } - private void AddMetadataFileNameToConvertedProjectReference(string filePath, ProjectReference projectReference) - { - lock (_gate) - { - _metadataFileNameToConvertedProjectReference.Add(filePath, projectReference); - } - } - - private void UpdateMetadataFileNameToConvertedProjectReference(string filePath, ProjectReference projectReference) - { - lock (_gate) - { - _metadataFileNameToConvertedProjectReference[filePath] = projectReference; - } - } - - private bool RemoveMetadataFileNameToConvertedProjectReference(string filePath) - { - lock (_gate) - { - return _metadataFileNameToConvertedProjectReference.Remove(filePath); - } - } - - private bool TryGetMetadataFileNameToConvertedProjectReference(string filePath, out ProjectReference projectReference) - { - lock (_gate) - { - return _metadataFileNameToConvertedProjectReference.TryGetValue(filePath, out projectReference); - } - } - - private bool HasMetadataFileNameToConvertedProjectReference(string filePath) - { - lock (_gate) - { - return _metadataFileNameToConvertedProjectReference.ContainsKey(filePath); - } - } - public bool CurrentProjectReferencesContains(ProjectId projectId) { lock (_gate) @@ -574,7 +524,7 @@ protected int AddMetadataReferenceAndTryConvertingToProjectReferenceIfPossible(s if (CanAddProjectReference(projectReference)) { AddProjectReference(projectReference); - AddMetadataFileNameToConvertedProjectReference(filePath, projectReference); + _metadataFileNameToConvertedProjectReference.Add(filePath, projectReference); return VSConstants.S_OK; } } @@ -631,12 +581,12 @@ protected void RemoveMetadataReference(string filePath) AssertIsForeground(); // Is this a reference we converted to a project reference? - if (TryGetMetadataFileNameToConvertedProjectReference(filePath, out var projectReference)) + if (_metadataFileNameToConvertedProjectReference.TryGetValue(filePath, out var projectReference)) { // We converted this, so remove the project reference instead RemoveProjectReference(projectReference); - Contract.ThrowIfFalse(RemoveMetadataFileNameToConvertedProjectReference(filePath)); + Contract.ThrowIfFalse(_metadataFileNameToConvertedProjectReference.Remove(filePath)); } // Just a metadata reference, so remove all of those @@ -1195,7 +1145,7 @@ internal void TryProjectConversionForIntroducedOutputPath(string binPath, Abstra if (this.CanConvertToProjectReferences) { // We should not already have references for this, since we're only introducing the path for the first time - Contract.ThrowIfTrue(HasMetadataFileNameToConvertedProjectReference(binPath)); + Contract.ThrowIfTrue(_metadataFileNameToConvertedProjectReference.ContainsKey(binPath)); var metadataReference = TryGetCurrentMetadataReference(binPath); if (metadataReference != null) @@ -1210,7 +1160,7 @@ internal void TryProjectConversionForIntroducedOutputPath(string binPath, Abstra RemoveMetadataReferenceCore(metadataReference, disposeReference: true); AddProjectReference(projectReference); - AddMetadataFileNameToConvertedProjectReference(binPath, projectReference); + _metadataFileNameToConvertedProjectReference.Add(binPath, projectReference); } } } @@ -1220,7 +1170,7 @@ internal void UndoProjectReferenceConversionForDisappearingOutputPath(string bin { AssertIsForeground(); - if (TryGetMetadataFileNameToConvertedProjectReference(binPath, out var projectReference)) + if (_metadataFileNameToConvertedProjectReference.TryGetValue(binPath, out var projectReference)) { // We converted this, so convert it back to a metadata reference RemoveProjectReference(projectReference); @@ -1232,7 +1182,7 @@ internal void UndoProjectReferenceConversionForDisappearingOutputPath(string bin AddMetadataReferenceCore(MetadataReferenceProvider.CreateMetadataReference(binPath, metadataReferenceProperties)); - Contract.ThrowIfFalse(RemoveMetadataFileNameToConvertedProjectReference(binPath)); + Contract.ThrowIfFalse(_metadataFileNameToConvertedProjectReference.Remove(binPath)); } } @@ -1243,7 +1193,7 @@ protected void UpdateMetadataReferenceAliases(string file, ImmutableArray /// Used for unit testing: don't crash the process if something bad happens. /// diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/Legacy/AbstractLegacyProject.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/Legacy/AbstractLegacyProject.cs index 66addff958eb0..7054d495a8828 100644 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/Legacy/AbstractLegacyProject.cs +++ b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/Legacy/AbstractLegacyProject.cs @@ -169,94 +169,5 @@ private static bool GetIsWebsiteProject(IVsHierarchy hierarchy) return false; } - - protected sealed override void ValidateReferences() - { - ValidateReferencesCore(); - } - - [Conditional("DEBUG")] - private void ValidateReferencesCore() - { - // can happen when project is unloaded and reloaded or in Venus (aspx) case - if (ProjectFilePath == null || BinOutputPath == null || ObjOutputPath == null) - { - return; - } - - if (ErrorHandler.Failed(Hierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out var property))) - { - return; - } - - var dteProject = property as EnvDTE.Project; - if (dteProject == null) - { - return; - } - - var vsproject = dteProject.Object as VSProject; - if (vsproject == null) - { - return; - } - - var noReferenceOutputAssemblies = new List(); - var factory = this.ServiceProvider.GetService(typeof(SVsEnumHierarchyItemsFactory)) as IVsEnumHierarchyItemsFactory; - if (ErrorHandler.Failed(factory.EnumHierarchyItems(Hierarchy, (uint)__VSEHI.VSEHI_Leaf, (uint)VSConstants.VSITEMID.Root, out var items))) - { - return; - } - - VSITEMSELECTION[] item = new VSITEMSELECTION[1]; - while (ErrorHandler.Succeeded(items.Next(1, item, out var fetched)) && fetched == 1) - { - // ignore ReferenceOutputAssembly=false references since those will not be added to us in design time. - var storage = Hierarchy as IVsBuildPropertyStorage; - storage.GetItemAttribute(item[0].itemid, "ReferenceOutputAssembly", out var value); - Hierarchy.GetProperty(item[0].itemid, (int)__VSHPROPID.VSHPROPID_Caption, out var caption); - - if (string.Equals(value, "false", StringComparison.OrdinalIgnoreCase) || - string.Equals(value, "off", StringComparison.OrdinalIgnoreCase) || - string.Equals(value, "0", StringComparison.OrdinalIgnoreCase)) - { - noReferenceOutputAssemblies.Add((string)caption); - } - } - - var projectReferences = GetCurrentProjectReferences(); - var metadataReferences = GetCurrentMetadataReferences(); - var set = new HashSet(vsproject.References.OfType().Select(r => PathUtilities.IsAbsolute(r.Name) ? Path.GetFileNameWithoutExtension(r.Name) : r.Name), StringComparer.OrdinalIgnoreCase); - var delta = set.Count - noReferenceOutputAssemblies.Count - (projectReferences.Length + metadataReferences.Length); - if (delta == 0) - { - return; - } - - // okay, two has different set of dlls referenced. check special Microsoft.VisualBasic case. - if (delta != 1) - { - //// Contract.Requires(false, "different set of references!!!"); - return; - } - - set.ExceptWith(noReferenceOutputAssemblies); - set.ExceptWith(projectReferences.Select(r => ProjectTracker.GetProject(r.ProjectId).DisplayName)); - set.ExceptWith(metadataReferences.Select(m => Path.GetFileNameWithoutExtension(m.FilePath))); - - //// Contract.Requires(set.Count == 1); - - var reference = set.First(); - if (!string.Equals(reference, "Microsoft.VisualBasic", StringComparison.OrdinalIgnoreCase)) - { - //// Contract.Requires(false, "unknown new reference " + reference); - return; - } - -#if DEBUG - // when we are missing microsoft.visualbasic reference, make sure we have embedded vb core option on. - Contract.Requires(Debug_VBEmbeddedCoreOptionOn); -#endif - } } } diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/RuleSets/VisualStudioRuleSetManagerFactory.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/RuleSets/VisualStudioRuleSetManagerFactory.cs index 7c72fb34087be..f51c8775c1eb1 100644 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/RuleSets/VisualStudioRuleSetManagerFactory.cs +++ b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/RuleSets/VisualStudioRuleSetManagerFactory.cs @@ -24,11 +24,11 @@ internal sealed class VisualStudioRuleSetManagerFactory : IWorkspaceServiceFacto public VisualStudioRuleSetManagerFactory( SVsServiceProvider serviceProvider, IForegroundNotificationService foregroundNotificationService, - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { _serviceProvider = serviceProvider; _foregroundNotificationService = foregroundNotificationService; - _listener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.RuleSetEditor); + _listener = listenerProvider.GetListener(FeatureAttribute.RuleSetEditor); } public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.cs index 0fca1b9997faa..0d4368ca0f257 100644 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.cs +++ b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.cs @@ -431,7 +431,7 @@ internal bool TryGetProjectByBinPath(string filePath, out AbstractProject projec private static readonly char[] s_directorySeparatorChars = { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }; - private bool HACK_StripRefDirectoryFromPath(string filePath, out string binFilePath) + private static bool HACK_StripRefDirectoryFromPath(string filePath, out string binFilePath) { const string refDirectoryName = "ref"; diff --git a/src/VisualStudio/Core/Def/Implementation/Remote/RemoteHostClientServiceFactory.cs b/src/VisualStudio/Core/Def/Implementation/Remote/RemoteHostClientServiceFactory.cs index 805bdd995b3bd..6336cd5f663f7 100644 --- a/src/VisualStudio/Core/Def/Implementation/Remote/RemoteHostClientServiceFactory.cs +++ b/src/VisualStudio/Core/Def/Implementation/Remote/RemoteHostClientServiceFactory.cs @@ -19,10 +19,10 @@ internal partial class RemoteHostClientServiceFactory : IWorkspaceServiceFactory [ImportingConstructor] public RemoteHostClientServiceFactory( - [ImportMany] IEnumerable> asyncListeners, + IAsynchronousOperationListenerProvider listenerProvider, IDiagnosticAnalyzerService analyzerService) { - _listener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.RemoteHostClient); + _listener = listenerProvider.GetListener(FeatureAttribute.RemoteHostClient); _analyzerService = analyzerService; } diff --git a/src/VisualStudio/Core/Def/Implementation/Snippets/AbstractSnippetInfoService.cs b/src/VisualStudio/Core/Def/Implementation/Snippets/AbstractSnippetInfoService.cs index cf2643eaa2edd..cc66a8d0c5011 100644 --- a/src/VisualStudio/Core/Def/Implementation/Snippets/AbstractSnippetInfoService.cs +++ b/src/VisualStudio/Core/Def/Implementation/Snippets/AbstractSnippetInfoService.cs @@ -40,12 +40,12 @@ internal abstract class AbstractSnippetInfoService : ForegroundThreadAffinitized // complete. protected object cacheGuard = new object(); - private readonly AggregateAsynchronousOperationListener _waiter; + private readonly IAsynchronousOperationListener _waiter; public AbstractSnippetInfoService( Shell.SVsServiceProvider serviceProvider, Guid languageGuidForSnippets, - IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { AssertIsForeground(); @@ -55,7 +55,7 @@ public AbstractSnippetInfoService( if (textManager.GetExpansionManager(out _expansionManager) == VSConstants.S_OK) { ComEventSink.Advise(_expansionManager, this); - _waiter = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.Snippets); + _waiter = listenerProvider.GetListener(FeatureAttribute.Snippets); _languageGuidForSnippets = languageGuidForSnippets; PopulateSnippetCaches(); } diff --git a/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs b/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs index 3650f0e4f0c58..214ba534dff5f 100644 --- a/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs +++ b/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs @@ -145,7 +145,7 @@ private void PopulateInitialData(Workspace workspace, IDiagnosticService diagnos private void OnDiagnosticsUpdated(object sender, DiagnosticsUpdatedArgs e) { - using (Logger.LogBlock(FunctionId.LiveTableDataSource_OnDiagnosticsUpdated, GetDiagnosticUpdatedMessage, e, CancellationToken.None)) + using (Logger.LogBlock(FunctionId.LiveTableDataSource_OnDiagnosticsUpdated, a => GetDiagnosticUpdatedMessage(a), e, CancellationToken.None)) { if (_workspace != e.Workspace) { @@ -550,7 +550,7 @@ private static string GetDiagnosticUpdatedMessage(DiagnosticsUpdatedArgs e) id = analyzer.Analyzer.ToString(); } - return $"{e.Workspace.Kind} {id} {e.Kind} {(object)e.DocumentId ?? e.ProjectId} {e.Diagnostics.Length}"; + return $"Kind:{e.Workspace.Kind}, Analyzer:{id}, Update:{e.Kind}, {(object)e.DocumentId ?? e.ProjectId}, ({string.Join(Environment.NewLine, e.Diagnostics)})"; } } } diff --git a/src/VisualStudio/Core/Def/Implementation/TaskList/ExternalErrorDiagnosticUpdateSource.cs b/src/VisualStudio/Core/Def/Implementation/TaskList/ExternalErrorDiagnosticUpdateSource.cs index e4daa02aa07ca..99b64a720ff28 100644 --- a/src/VisualStudio/Core/Def/Implementation/TaskList/ExternalErrorDiagnosticUpdateSource.cs +++ b/src/VisualStudio/Core/Def/Implementation/TaskList/ExternalErrorDiagnosticUpdateSource.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Notification; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem; @@ -39,8 +40,8 @@ public ExternalErrorDiagnosticUpdateSource( VisualStudioWorkspaceImpl workspace, IDiagnosticAnalyzerService diagnosticService, IDiagnosticUpdateSourceRegistrationService registrationService, - [ImportMany] IEnumerable> asyncListeners) : - this(workspace, diagnosticService, registrationService, new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.ErrorList)) + IAsynchronousOperationListenerProvider listenerProvider) : + this(workspace, diagnosticService, registrationService, listenerProvider.GetListener(FeatureAttribute.ErrorList)) { Contract.Requires(!KnownUIContexts.SolutionBuildingContext.IsActive); KnownUIContexts.SolutionBuildingContext.UIContextChanged += OnSolutionBuild; @@ -110,27 +111,27 @@ private void OnWorkspaceChanged(object sender, WorkspaceChangeEventArgs e) case WorkspaceChangeKind.SolutionRemoved: case WorkspaceChangeKind.SolutionCleared: case WorkspaceChangeKind.SolutionReloaded: - { - var asyncToken = _listener.BeginAsyncOperation("OnSolutionChanged"); - _taskQueue.ScheduleTask(() => e.OldSolution.ProjectIds.Do(p => ClearProjectErrors(e.OldSolution, p))).CompletesAsyncOperation(asyncToken); - break; - } + { + var asyncToken = _listener.BeginAsyncOperation("OnSolutionChanged"); + _taskQueue.ScheduleTask(() => e.OldSolution.ProjectIds.Do(p => ClearProjectErrors(e.OldSolution, p))).CompletesAsyncOperation(asyncToken); + break; + } case WorkspaceChangeKind.ProjectRemoved: case WorkspaceChangeKind.ProjectReloaded: - { - var asyncToken = _listener.BeginAsyncOperation("OnProjectChanged"); - _taskQueue.ScheduleTask(() => ClearProjectErrors(e.OldSolution, e.ProjectId)).CompletesAsyncOperation(asyncToken); - break; - } + { + var asyncToken = _listener.BeginAsyncOperation("OnProjectChanged"); + _taskQueue.ScheduleTask(() => ClearProjectErrors(e.OldSolution, e.ProjectId)).CompletesAsyncOperation(asyncToken); + break; + } case WorkspaceChangeKind.DocumentRemoved: case WorkspaceChangeKind.DocumentReloaded: - { - var asyncToken = _listener.BeginAsyncOperation("OnDocumentRemoved"); - _taskQueue.ScheduleTask(() => ClearDocumentErrors(e.OldSolution, e.ProjectId, e.DocumentId)).CompletesAsyncOperation(asyncToken); - break; - } + { + var asyncToken = _listener.BeginAsyncOperation("OnDocumentRemoved"); + _taskQueue.ScheduleTask(() => ClearDocumentErrors(e.OldSolution, e.ProjectId, e.DocumentId)).CompletesAsyncOperation(asyncToken); + break; + } case WorkspaceChangeKind.ProjectAdded: case WorkspaceChangeKind.DocumentAdded: @@ -515,7 +516,7 @@ private void AddErrors(Dictionary> map, T var errors = GetErrorSet(map, key); foreach (var diagnostic in diagnostics) { - errors.Add(diagnostic, GetNextIncrement()); + AddError(errors, diagnostic); } } @@ -530,6 +531,8 @@ private void AddError(Dictionary errors, DiagnosticData dia // add only new errors if (!errors.TryGetValue(diagnostic, out _)) { + Logger.Log(FunctionId.ExternalErrorDiagnosticUpdateSource_AddError, d => d.ToString(), diagnostic); + errors.Add(diagnostic, GetNextIncrement()); } } diff --git a/src/VisualStudio/Core/Def/Implementation/Workspace/GlobalOperationNotificationServiceFactory.cs b/src/VisualStudio/Core/Def/Implementation/Workspace/GlobalOperationNotificationServiceFactory.cs index 17705a108c9c8..3cd44bb8f9443 100644 --- a/src/VisualStudio/Core/Def/Implementation/Workspace/GlobalOperationNotificationServiceFactory.cs +++ b/src/VisualStudio/Core/Def/Implementation/Workspace/GlobalOperationNotificationServiceFactory.cs @@ -20,9 +20,9 @@ internal class GlobalOperationNotificationServiceFactory : IWorkspaceServiceFact [ImportingConstructor] public GlobalOperationNotificationServiceFactory( - [ImportMany] IEnumerable> asyncListeners) + IAsynchronousOperationListenerProvider listenerProvider) { - _listener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.GlobalOperation); + _listener = listenerProvider.GetListener(FeatureAttribute.GlobalOperation); _singleton = new Service(_listener); } diff --git a/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioTaskSchedulerFactory.cs b/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioTaskSchedulerFactory.cs index fb83a994e8573..2d0909297d0c4 100644 --- a/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioTaskSchedulerFactory.cs +++ b/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioTaskSchedulerFactory.cs @@ -19,8 +19,8 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation internal class VisualStudioTaskSchedulerFactory : EditorTaskSchedulerFactory { [ImportingConstructor] - public VisualStudioTaskSchedulerFactory([ImportMany] IEnumerable> asyncListeners) - : base(asyncListeners) + public VisualStudioTaskSchedulerFactory(IAsynchronousOperationListenerProvider listenerProvider) + : base(listenerProvider) { } diff --git a/src/VisualStudio/Core/Def/RoslynActivityLogger.cs b/src/VisualStudio/Core/Def/RoslynActivityLogger.cs new file mode 100644 index 0000000000000..45b6a38233cc2 --- /dev/null +++ b/src/VisualStudio/Core/Def/RoslynActivityLogger.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using Microsoft.CodeAnalysis.Internal.Log; +using Roslyn.Utilities; + +namespace Microsoft.VisualStudio.LanguageServices +{ + /// + /// Let people to inject to monitor Roslyn activity + /// + /// Here, we don't technically use TraceSource as it is meant to be used. but just as an easy + /// way to log data to listeners. + /// + /// this also involves creating string, boxing and etc. so, perf wise, it will impact VS quite a bit. + /// this also won't collect trace from Roslyn OOP for now. only in proc activity + /// + internal static class RoslynActivityLogger + { + private static readonly object s_gate = new object(); + + public static void SetLogger(TraceSource traceSource) + { + Contract.ThrowIfNull(traceSource); + + lock (s_gate) + { + // internally, it just uses our existing ILogger + Logger.SetLogger(AggregateLogger.AddOrReplace(new TraceSourceLogger(traceSource), Logger.GetLogger(), l => (l as TraceSourceLogger)?.TraceSource == traceSource)); + } + } + + public static void RemoveLogger(TraceSource traceSource) + { + Contract.ThrowIfNull(traceSource); + + lock (s_gate) + { + // internally, it just uses our existing ILogger + Logger.SetLogger(AggregateLogger.Remove(Logger.GetLogger(), l => (l as TraceSourceLogger)?.TraceSource == traceSource)); + } + } + + private class TraceSourceLogger : ILogger + { + private const int LogEventId = 0; + private const int StartEventId = 1; + private const int EndEventId = 2; + + private static readonly ImmutableDictionary s_functionIdCache; + + public readonly TraceSource TraceSource; + + static TraceSourceLogger() + { + // build enum to string cache + s_functionIdCache = + Enum.GetValues(typeof(FunctionId)).Cast().ToImmutableDictionary(f => f, f => f.ToString()); + } + + public TraceSourceLogger(TraceSource traceSource) + { + TraceSource = traceSource; + } + + public bool IsEnabled(FunctionId functionId) + { + // we log every roslyn activity + return true; + } + + public void Log(FunctionId functionId, LogMessage logMessage) + { + TraceSource.TraceData(TraceEventType.Verbose, LogEventId, s_functionIdCache[functionId], logMessage.GetMessage()); + } + + public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int uniquePairId, CancellationToken cancellationToken) + { + TraceSource.TraceData(TraceEventType.Verbose, StartEventId, s_functionIdCache[functionId], uniquePairId); + } + + public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int uniquePairId, int delta, CancellationToken cancellationToken) + { + TraceSource.TraceData(TraceEventType.Verbose, EndEventId, s_functionIdCache[functionId], uniquePairId, cancellationToken.IsCancellationRequested, delta, logMessage.GetMessage()); + } + } + } +} diff --git a/src/VisualStudio/Core/Impl/CodeModel/CodeModelIncrementalAnalyzer.cs b/src/VisualStudio/Core/Impl/CodeModel/CodeModelIncrementalAnalyzer.cs index 76be190b1d4c1..9a9fd90c5c149 100644 --- a/src/VisualStudio/Core/Impl/CodeModel/CodeModelIncrementalAnalyzer.cs +++ b/src/VisualStudio/Core/Impl/CodeModel/CodeModelIncrementalAnalyzer.cs @@ -24,9 +24,9 @@ internal class CodeModelIncrementalAnalyzerProvider : IIncrementalAnalyzerProvid [ImportingConstructor] public CodeModelIncrementalAnalyzerProvider( IForegroundNotificationService notificationService, - [ImportMany]IEnumerable> listeners) + IAsynchronousOperationListenerProvider listenerProvider) { - _listener = new AggregateAsynchronousOperationListener(listeners, FeatureAttribute.CodeModel); + _listener = listenerProvider.GetListener(FeatureAttribute.CodeModel); _notificationService = notificationService; } diff --git a/src/VisualStudio/Core/Test.Next/Mocks/TestHostServices.cs b/src/VisualStudio/Core/Test.Next/Mocks/TestHostServices.cs index 2793288aeec94..621aa6c7b0c09 100644 --- a/src/VisualStudio/Core/Test.Next/Mocks/TestHostServices.cs +++ b/src/VisualStudio/Core/Test.Next/Mocks/TestHostServices.cs @@ -23,27 +23,14 @@ public static ExportProvider CreateMinimalExportProvider() { return MinimalTestExportProvider.CreateExportProvider( ServiceTestExportProvider.CreateAssemblyCatalog() - .WithPart(typeof(InProcRemoteHostClientFactory)) - .WithPart(typeof(WorkspaceWaiter))); + .WithPart(typeof(InProcRemoteHostClientFactory))); } public static ExportProvider CreateExportProvider() { return MinimalTestExportProvider.CreateExportProvider( TestExportProvider.CreateAssemblyCatalogWithCSharpAndVisualBasic() - .WithPart(typeof(InProcRemoteHostClientFactory)) - .WithPart(typeof(WorkspaceWaiter))); - } - - [Shared] - [Export(typeof(IAsynchronousOperationListener))] - [Export(typeof(IAsynchronousOperationWaiter))] - [Feature(FeatureAttribute.Workspace)] - private class WorkspaceWaiter : AsynchronousOperationListener - { - internal WorkspaceWaiter() - { - } + .WithPart(typeof(InProcRemoteHostClientFactory))); } } } diff --git a/src/VisualStudio/Core/Test.Next/Remote/RemoteHostClientServiceFactoryTests.cs b/src/VisualStudio/Core/Test.Next/Remote/RemoteHostClientServiceFactoryTests.cs index 15baf22fdeb5c..5ced0e2ab1c8f 100644 --- a/src/VisualStudio/Core/Test.Next/Remote/RemoteHostClientServiceFactoryTests.cs +++ b/src/VisualStudio/Core/Test.Next/Remote/RemoteHostClientServiceFactoryTests.cs @@ -99,10 +99,10 @@ public async Task UpdaterService() var workspace = new AdhocWorkspace(TestHostServices.CreateHostServices(exportProvider)); workspace.Options = workspace.Options.WithChangedOption(RemoteHostOptions.SolutionChecksumMonitorBackOffTimeSpanInMS, 1); - var listener = new Listener(); + var listenerProvider = exportProvider.GetExportedValue(); var analyzerReference = new AnalyzerFileReference(typeof(object).Assembly.Location, new NullAssemblyAnalyzerLoader()); - var service = CreateRemoteHostClientService(workspace, SpecializedCollections.SingletonEnumerable(analyzerReference), listener); + var service = CreateRemoteHostClientService(workspace, SpecializedCollections.SingletonEnumerable(analyzerReference), listenerProvider); service.Enable(); @@ -112,11 +112,11 @@ public async Task UpdaterService() // add solution workspace.AddSolution(SolutionInfo.Create(SolutionId.CreateNewId(), VersionStamp.Default)); - var listeners = exportProvider.GetExports(); - var workspaceListener = listeners.First(l => l.Metadata.FeatureName == FeatureAttribute.Workspace).Value as IAsynchronousOperationWaiter; - // wait for listener + var workspaceListener = listenerProvider.GetWaiter(FeatureAttribute.Workspace); await workspaceListener.CreateWaitTask(); + + var listener = listenerProvider.GetWaiter(FeatureAttribute.RemoteHostClient); await listener.CreateWaitTask(); // checksum should already exist @@ -209,7 +209,7 @@ public async Task TestRequestNewRemoteHost() private RemoteHostClientServiceFactory.RemoteHostClientService CreateRemoteHostClientService( Workspace workspace = null, IEnumerable hostAnalyzerReferences = null, - IAsynchronousOperationListener listener = null) + IAsynchronousOperationListenerProvider listenerProvider = null) { workspace = workspace ?? new AdhocWorkspace(TestHostServices.CreateHostServices()); workspace.Options = workspace.Options.WithChangedOption(RemoteHostOptions.RemoteHostTest, true) @@ -218,9 +218,7 @@ private RemoteHostClientServiceFactory.RemoteHostClientService CreateRemoteHostC var analyzerService = GetDiagnosticAnalyzerService(hostAnalyzerReferences ?? SpecializedCollections.EmptyEnumerable()); - var listeners = AsynchronousOperationListener.CreateListeners(FeatureAttribute.RemoteHostClient, listener ?? new Listener()); - - var factory = new RemoteHostClientServiceFactory(listeners, analyzerService); + var factory = new RemoteHostClientServiceFactory(listenerProvider ?? AsynchronousOperationListenerProvider.NullProvider, analyzerService); return factory.CreateService(workspace.Services) as RemoteHostClientServiceFactory.RemoteHostClientService; } @@ -251,8 +249,6 @@ public Task TestMethodAsync() } } - private class Listener : AsynchronousOperationListener { } - private class NullAssemblyAnalyzerLoader : IAnalyzerAssemblyLoader { public void AddDependencyLocation(string fullPath) diff --git a/src/VisualStudio/Core/Test/Completion/TestCSharpSnippetInfoService.vb b/src/VisualStudio/Core/Test/Completion/TestCSharpSnippetInfoService.vb index 80672b880ca3b..7b20cc4695cc6 100644 --- a/src/VisualStudio/Core/Test/Completion/TestCSharpSnippetInfoService.vb +++ b/src/VisualStudio/Core/Test/Completion/TestCSharpSnippetInfoService.vb @@ -16,8 +16,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Completion Inherits CSharpSnippetInfoService - Friend Sub New( asyncListeners As IEnumerable(Of Lazy(Of IAsynchronousOperationListener, FeatureMetadata))) - MyBase.New(Nothing, asyncListeners) + Friend Sub New(listenerProvider As IAsynchronousOperationListenerProvider) + MyBase.New(Nothing, listenerProvider) End Sub Friend Sub SetSnippetShortcuts(newSnippetShortcuts As String()) diff --git a/src/VisualStudio/Core/Test/Completion/TestVisualBasicSnippetInfoService.vb b/src/VisualStudio/Core/Test/Completion/TestVisualBasicSnippetInfoService.vb index c92e9b5763a26..77d878aa12c1c 100644 --- a/src/VisualStudio/Core/Test/Completion/TestVisualBasicSnippetInfoService.vb +++ b/src/VisualStudio/Core/Test/Completion/TestVisualBasicSnippetInfoService.vb @@ -17,8 +17,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Completion Inherits VisualBasicSnippetInfoService - Friend Sub New( asyncListeners As IEnumerable(Of Lazy(Of IAsynchronousOperationListener, FeatureMetadata))) - MyBase.New(Nothing, asyncListeners) + Friend Sub New(listenerProvider As IAsynchronousOperationListenerProvider) + MyBase.New(Nothing, listenerProvider) End Sub Friend Sub SetSnippetShortcuts(newSnippetShortcuts As String()) diff --git a/src/VisualStudio/Core/Test/DebuggerIntelliSense/CompletionWaiter.vb b/src/VisualStudio/Core/Test/DebuggerIntelliSense/CompletionWaiter.vb deleted file mode 100644 index a0d348ca49044..0000000000000 --- a/src/VisualStudio/Core/Test/DebuggerIntelliSense/CompletionWaiter.vb +++ /dev/null @@ -1,16 +0,0 @@ -' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#If False Then -Imports System.ComponentModel.Composition -Imports Microsoft.CodeAnalysis.Shared.TestHooks - -Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.DebuggerIntelliSense - - - - Friend Class CompletionWaiter - Inherits AsynchronousOperationListener - - End Class -End Namespace -#End If diff --git a/src/VisualStudio/Core/Test/DebuggerIntelliSense/SignatureHelpWaiter.vb b/src/VisualStudio/Core/Test/DebuggerIntelliSense/SignatureHelpWaiter.vb deleted file mode 100644 index 5461bc43e9038..0000000000000 --- a/src/VisualStudio/Core/Test/DebuggerIntelliSense/SignatureHelpWaiter.vb +++ /dev/null @@ -1,16 +0,0 @@ -' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#If False Then -Imports System.ComponentModel.Composition -Imports Microsoft.CodeAnalysis.Shared.TestHooks - -Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.DebuggerIntelliSense - - - - Friend Class SignatureHelpWaiter - Inherits AsynchronousOperationListener - - End Class -End Namespace -#End if diff --git a/src/VisualStudio/Core/Test/DebuggerIntelliSense/TestState.vb b/src/VisualStudio/Core/Test/DebuggerIntelliSense/TestState.vb index 41bb18bc5d50b..14b8278d45ea2 100644 --- a/src/VisualStudio/Core/Test/DebuggerIntelliSense/TestState.vb +++ b/src/VisualStudio/Core/Test/DebuggerIntelliSense/TestState.vb @@ -50,9 +50,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.DebuggerIntelliSense MyBase.New( workspaceElement, - exportProvider:=MinimalTestExportProvider.CreateExportProvider(VisualStudioTestExportProvider.PartCatalog.WithParts( - GetType(CompletionWaiter), - GetType(SignatureHelpWaiter))), + exportProvider:=MinimalTestExportProvider.CreateExportProvider(VisualStudioTestExportProvider.PartCatalog), workspaceKind:=WorkspaceKind.Debugger) Dim languageServices = Me.Workspace.CurrentSolution.Projects.First().LanguageServices @@ -67,8 +65,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.DebuggerIntelliSense GetService(Of IEditorOperationsFactoryService)(), UndoHistoryRegistry, GetService(Of IInlineRenameService)(), + GetExportedValue(Of IAsynchronousOperationListenerProvider)(), New TestCompletionPresenter(Me), - GetExports(Of IAsynchronousOperationListener, FeatureMetadata)(), GetExports(Of IBraceCompletionSessionProvider, BraceCompletionMetadata)()) Me.CompletionCommandHandler = New CompletionCommandHandler(Me.AsyncCompletionService) @@ -76,7 +74,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.DebuggerIntelliSense Me.SignatureHelpCommandHandler = New SignatureHelpCommandHandler( New TestSignatureHelpPresenter(Me), GetExports(Of ISignatureHelpProvider, OrderableLanguageMetadata)().Concat(extraSignatureHelpProviders), - GetExports(Of IAsynchronousOperationListener, FeatureMetadata)()) + GetExportedValue(Of IAsynchronousOperationListenerProvider)()) Me.IntelliSenseCommandHandler = New IntelliSenseCommandHandler(CompletionCommandHandler, SignatureHelpCommandHandler, Nothing) diff --git a/src/VisualStudio/Core/Test/Diagnostics/DefaultDiagnosticUpdateSourceTests.vb b/src/VisualStudio/Core/Test/Diagnostics/DefaultDiagnosticUpdateSourceTests.vb index e0993bca8eebe..faf6b3ae46e41 100644 --- a/src/VisualStudio/Core/Test/Diagnostics/DefaultDiagnosticUpdateSourceTests.vb +++ b/src/VisualStudio/Core/Test/Diagnostics/DefaultDiagnosticUpdateSourceTests.vb @@ -26,12 +26,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics class 123 { } Using workspace = TestWorkspace.CreateCSharp(code.Value) - Dim listener = New AsynchronousOperationListener() - Dim listeners = AsynchronousOperationListener.CreateListeners( - ValueTuple.Create(FeatureAttribute.DiagnosticService, listener), - ValueTuple.Create(FeatureAttribute.ErrorSquiggles, listener)) - - Dim diagnosticService = New DiagnosticService(listeners) + Dim listenerProvider = New AsynchronousOperationListenerProvider() + Dim diagnosticService = New DiagnosticService(listenerProvider) Dim miscService = New DefaultDiagnosticAnalyzerService(diagnosticService) Assert.False(miscService.SupportGetDiagnostics) @@ -42,13 +38,14 @@ class 123 { } WpfTestCase.RequireWpfFact("This test uses IForegroundNotificationService") Dim foregroundService = workspace.GetService(Of IForegroundNotificationService)() - Dim provider = New DiagnosticsSquiggleTaggerProvider(diagnosticService, foregroundService, listeners) + Dim provider = New DiagnosticsSquiggleTaggerProvider(diagnosticService, foregroundService, listenerProvider) Dim tagger = provider.CreateTagger(Of IErrorTag)(buffer) Using disposable = TryCast(tagger, IDisposable) Dim analyzer = miscService.CreateIncrementalAnalyzer(workspace) Await analyzer.AnalyzeSyntaxAsync(workspace.CurrentSolution.Projects.First().Documents.First(), InvocationReasons.Empty, CancellationToken.None) - Await listener.CreateWaitTask() + Await listenerProvider.GetWaiter(FeatureAttribute.DiagnosticService).CreateWaitTask() + Await listenerProvider.GetWaiter(FeatureAttribute.ErrorSquiggles).CreateWaitTask() Dim snapshot = buffer.CurrentSnapshot Dim spans = tagger.GetTags(snapshot.GetSnapshotSpanCollection()).ToImmutableArray() @@ -72,12 +69,8 @@ class A Using workspace = TestWorkspace.CreateCSharp(code.Value) - Dim listener = New AsynchronousOperationListener() - Dim listeners = AsynchronousOperationListener.CreateListeners( - ValueTuple.Create(FeatureAttribute.DiagnosticService, listener), - ValueTuple.Create(FeatureAttribute.ErrorSquiggles, listener)) - - Dim diagnosticService = New DiagnosticService(listeners) + Dim listenerProvider = New AsynchronousOperationListenerProvider() + Dim diagnosticService = New DiagnosticService(listenerProvider) Dim miscService = New DefaultDiagnosticAnalyzerService(diagnosticService) Assert.False(miscService.SupportGetDiagnostics) @@ -86,10 +79,12 @@ class A Dim document = workspace.CurrentSolution.Projects.First().Documents.First() Dim analyzer = miscService.CreateIncrementalAnalyzer(workspace) + Await analyzer.AnalyzeSyntaxAsync(document, InvocationReasons.Empty, CancellationToken.None) Await analyzer.AnalyzeDocumentAsync(document, Nothing, InvocationReasons.Empty, CancellationToken.None) - Await listener.CreateWaitTask() + Await listenerProvider.GetWaiter(FeatureAttribute.DiagnosticService).CreateWaitTask() + Await listenerProvider.GetWaiter(FeatureAttribute.ErrorSquiggles).CreateWaitTask() Assert.True( diagnosticService.GetDiagnostics(workspace, document.Project.Id, document.Id, Nothing, False, CancellationToken.None).Count() = 1) @@ -109,12 +104,8 @@ class A Using workspace = TestWorkspace.CreateCSharp(code.Value) - Dim listener = New AsynchronousOperationListener() - Dim listeners = AsynchronousOperationListener.CreateListeners( - ValueTuple.Create(FeatureAttribute.DiagnosticService, listener), - ValueTuple.Create(FeatureAttribute.ErrorSquiggles, listener)) - - Dim diagnosticService = New DiagnosticService(listeners) + Dim listenerProvider = New AsynchronousOperationListenerProvider() + Dim diagnosticService = New DiagnosticService(listenerProvider) Dim miscService = New DefaultDiagnosticAnalyzerService(diagnosticService) Assert.False(miscService.SupportGetDiagnostics) @@ -126,7 +117,8 @@ class A Await analyzer.AnalyzeSyntaxAsync(document, InvocationReasons.Empty, CancellationToken.None) Await analyzer.AnalyzeDocumentAsync(document, Nothing, InvocationReasons.Empty, CancellationToken.None) - Await listener.CreateWaitTask() + Await listenerProvider.GetWaiter(FeatureAttribute.DiagnosticService).CreateWaitTask() + Await listenerProvider.GetWaiter(FeatureAttribute.ErrorSquiggles).CreateWaitTask() Assert.True( diagnosticService.GetDiagnostics(workspace, document.Project.Id, document.Id, Nothing, False, CancellationToken.None).Count() = 1) @@ -146,12 +138,8 @@ class A Using workspace = TestWorkspace.CreateCSharp(code.Value) - Dim listener = New AsynchronousOperationListener() - Dim listeners = AsynchronousOperationListener.CreateListeners( - ValueTuple.Create(FeatureAttribute.DiagnosticService, listener), - ValueTuple.Create(FeatureAttribute.ErrorSquiggles, listener)) - - Dim diagnosticService = New DiagnosticService(listeners) + Dim listenerProvider = New AsynchronousOperationListenerProvider() + Dim diagnosticService = New DiagnosticService(listenerProvider) Dim miscService = New DefaultDiagnosticAnalyzerService(diagnosticService) Assert.False(miscService.SupportGetDiagnostics) @@ -163,7 +151,8 @@ class A Await analyzer.AnalyzeSyntaxAsync(document, InvocationReasons.Empty, CancellationToken.None) Await analyzer.AnalyzeDocumentAsync(document, Nothing, InvocationReasons.Empty, CancellationToken.None) - Await listener.CreateWaitTask() + Await listenerProvider.GetWaiter(FeatureAttribute.DiagnosticService).CreateWaitTask() + Await listenerProvider.GetWaiter(FeatureAttribute.ErrorSquiggles).CreateWaitTask() Assert.True( diagnosticService.GetDiagnostics(workspace, document.Project.Id, document.Id, Nothing, False, CancellationToken.None).Count() = 2) @@ -183,12 +172,8 @@ class A Using workspace = TestWorkspace.CreateCSharp(code.Value) - Dim listener = New AsynchronousOperationListener() - Dim listeners = AsynchronousOperationListener.CreateListeners( - ValueTuple.Create(FeatureAttribute.DiagnosticService, listener), - ValueTuple.Create(FeatureAttribute.ErrorSquiggles, listener)) - - Dim diagnosticService = New DiagnosticService(listeners) + Dim listenerProvider = New AsynchronousOperationListenerProvider() + Dim diagnosticService = New DiagnosticService(listenerProvider) Dim miscService = New DefaultDiagnosticAnalyzerService(diagnosticService) Assert.False(miscService.SupportGetDiagnostics) @@ -201,7 +186,9 @@ class A Await analyzer.AnalyzeDocumentAsync(document, Nothing, InvocationReasons.Empty, CancellationToken.None) analyzer.RemoveDocument(document.Id) - Await listener.CreateWaitTask() + + Await listenerProvider.GetWaiter(FeatureAttribute.DiagnosticService).CreateWaitTask() + Await listenerProvider.GetWaiter(FeatureAttribute.ErrorSquiggles).CreateWaitTask() Assert.True( diagnosticService.GetDiagnostics(workspace, document.Project.Id, document.Id, Nothing, False, CancellationToken.None).Count() = 0) diff --git a/src/VisualStudio/Core/Test/Diagnostics/DiagnosticTableDataSourceTests.vb b/src/VisualStudio/Core/Test/Diagnostics/DiagnosticTableDataSourceTests.vb index 6b66a88771286..ea70557f99962 100644 --- a/src/VisualStudio/Core/Test/Diagnostics/DiagnosticTableDataSourceTests.vb +++ b/src/VisualStudio/Core/Test/Diagnostics/DiagnosticTableDataSourceTests.vb @@ -616,17 +616,16 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Using workspace = TestWorkspace.Create(markup) - Dim asyncListener = New AsynchronousOperationListener() - Dim listeners = AsynchronousOperationListener.CreateListeners(ValueTuple.Create(FeatureAttribute.DiagnosticService, asyncListener)) - - Dim service = New DiagnosticService(listeners) + Dim listenerProvider = New AsynchronousOperationListenerProvider() + Dim service = New DiagnosticService(listenerProvider) Dim tableManagerProvider = New TestTableManagerProvider() Dim table = New VisualStudioDiagnosticListTable(workspace, service, tableManagerProvider) - RunCompilerAnalyzer(workspace, service, New AggregateAsynchronousOperationListener(listeners, FeatureAttribute.DiagnosticService)) + Dim listener = listenerProvider.GetListener(FeatureAttribute.DiagnosticService) + RunCompilerAnalyzer(workspace, service, listener) - Await asyncListener.CreateWaitTask() + Await DirectCast(listener, IAsynchronousOperationWaiter).CreateWaitTask() Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) Dim sinkAndSubscription = manager.Sinks_TestOnly.First() @@ -665,14 +664,14 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Using workspace = TestWorkspace.Create(markup) - Dim asyncListener = New AsynchronousOperationListener() - Dim listeners = AsynchronousOperationListener.CreateListeners(ValueTuple.Create(FeatureAttribute.DiagnosticService, asyncListener)) + Dim listenerProvider = New AsynchronousOperationListenerProvider() - Dim service = New DiagnosticService(listeners) - Dim analyzerService = New MyDiagnosticAnalyzerService(ImmutableDictionary(Of String, ImmutableArray(Of DiagnosticAnalyzer)).Empty, service, asyncListener) + Dim listener = listenerProvider.GetListener(FeatureAttribute.DiagnosticService) + Dim service = New DiagnosticService(listenerProvider) + Dim analyzerService = New MyDiagnosticAnalyzerService(ImmutableDictionary(Of String, ImmutableArray(Of DiagnosticAnalyzer)).Empty, service, listener) Dim registration = New MockDiagnosticUpdateSourceRegistrationService() - Dim updateSource = New ExternalErrorDiagnosticUpdateSource(workspace, analyzerService, registration, asyncListener) + Dim updateSource = New ExternalErrorDiagnosticUpdateSource(workspace, analyzerService, registration, listener) Dim tableManagerProvider = New TestTableManagerProvider() Dim table = New VisualStudioDiagnosticListTable(workspace, service, updateSource, tableManagerProvider) @@ -725,7 +724,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics updateSource.OnSolutionBuild(Me, Shell.UIContextChangedEventArgs.From(False)) - Await asyncListener.CreateWaitTask() + Await DirectCast(listener, IAsynchronousOperationWaiter).CreateWaitTask() Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager) Dim sinkAndSubscription = manager.Sinks_TestOnly.First() diff --git a/src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb b/src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb index 383fc31683772..486d1339b0043 100644 --- a/src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb +++ b/src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb @@ -17,7 +17,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestExternalDiagnostics_SupportGetDiagnostics() Using workspace = TestWorkspace.CreateCSharp(String.Empty) - Dim waiter = New Waiter() + Dim waiter = New AsynchronousOperationListener() Dim service = New TestDiagnosticAnalyzerService() Dim source = New ExternalErrorDiagnosticUpdateSource(workspace, service, New MockDiagnosticUpdateSourceRegistrationService(), waiter) @@ -28,7 +28,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Async Function TestExternalDiagnostics_RaiseEvents() As Task Using workspace = TestWorkspace.CreateCSharp(String.Empty) - Dim waiter = New Waiter() + Dim waiter = New AsynchronousOperationListener() Dim service = New TestDiagnosticAnalyzerService() Dim source = New ExternalErrorDiagnosticUpdateSource(workspace, service, New MockDiagnosticUpdateSourceRegistrationService(), waiter) @@ -56,7 +56,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestExternalDiagnostics_SupportedId() Using workspace = TestWorkspace.CreateCSharp(String.Empty) - Dim waiter = New Waiter() + Dim waiter = New AsynchronousOperationListener() Dim service = New TestDiagnosticAnalyzerService() Dim source = New ExternalErrorDiagnosticUpdateSource(workspace, service, New MockDiagnosticUpdateSourceRegistrationService(), waiter) @@ -71,7 +71,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Sub TestExternalDiagnostics_SupportedDiagnosticId_Concurrent() Using workspace = TestWorkspace.CreateCSharp(String.Empty) - Dim waiter = New Waiter() + Dim waiter = New AsynchronousOperationListener() Dim service = New TestDiagnosticAnalyzerService() Dim source = New ExternalErrorDiagnosticUpdateSource(workspace, service, New MockDiagnosticUpdateSourceRegistrationService(), waiter) @@ -85,7 +85,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Async Function TestExternalDiagnostics_DuplicatedError() As Task Using workspace = TestWorkspace.CreateCSharp(String.Empty) - Dim waiter = New Waiter() + Dim waiter = New AsynchronousOperationListener() Dim project = workspace.CurrentSolution.Projects.First() Dim diagnostic = GetDiagnosticData(workspace, project.Id) @@ -110,7 +110,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Async Function TestBuildStartEvent() As Task Using workspace = TestWorkspace.CreateCSharp(String.Empty) - Dim waiter = New Waiter() + Dim waiter = New AsynchronousOperationListener() Dim project = workspace.CurrentSolution.Projects.First() Dim diagnostic = GetDiagnosticData(workspace, project.Id) @@ -163,7 +163,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Public Async Function TestExternalDiagnostics_AddDuplicatedErrors() As Task Using workspace = TestWorkspace.CreateCSharp(String.Empty) - Dim waiter = New Waiter() + Dim waiter = New AsynchronousOperationListener() Dim project = workspace.CurrentSolution.Projects.First() Dim diagnostic = GetDiagnosticData(workspace, project.Id) @@ -190,10 +190,6 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics "Id", "Test", "Test Message", "Test Message Format", DiagnosticSeverity.Error, True, 0, workspace, projectId, properties:=properties) End Function - Private Class Waiter - Inherits AsynchronousOperationListener - End Class - Private Class TestDiagnosticAnalyzerService Implements IDiagnosticAnalyzerService, IDiagnosticUpdateSource diff --git a/src/VisualStudio/Core/Test/ProjectSystemShim/VisualBasicSpecialReferencesTests.vb b/src/VisualStudio/Core/Test/ProjectSystemShim/VisualBasicSpecialReferencesTests.vb index c3fd5d03fa444..7b7a343f73bf7 100644 --- a/src/VisualStudio/Core/Test/ProjectSystemShim/VisualBasicSpecialReferencesTests.vb +++ b/src/VisualStudio/Core/Test/ProjectSystemShim/VisualBasicSpecialReferencesTests.vb @@ -148,10 +148,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim Using environment = New TestEnvironment() Dim project1 = CreateVisualBasicProject(environment, "project1") - environment.ProjectTracker.UpdateProjectBinPath(project1, Nothing, "C:\project1.dll") + project1.SetBinOutputPathAndRelatedData("C:\project1.dll") Dim project2 = CreateVisualBasicProject(environment, "project2") - environment.ProjectTracker.UpdateProjectBinPath(project2, Nothing, "C:\project2.dll") + project2.SetBinOutputPathAndRelatedData("C:\project2.dll") ' since this is known to be the output path of project1, the metadata reference is converted to a project reference project2.AddMetaDataReference("c:\project1.dll", True) @@ -169,10 +169,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim Using environment = New TestEnvironment() Dim project1 = CreateVisualBasicProject(environment, "project1") - environment.ProjectTracker.UpdateProjectBinPath(project1, Nothing, "C:\project1.dll") + project1.SetBinOutputPathAndRelatedData("C:\project1.dll") Dim project2 = CreateVisualBasicProject(environment, "project2") - environment.ProjectTracker.UpdateProjectBinPath(project2, Nothing, "C:\project2.dll") + project2.SetBinOutputPathAndRelatedData("C:\project2.dll") project1.AddProjectReference(project2) diff --git a/src/VisualStudio/Core/Test/ProjectSystemShim/VisualStudioRuleSetTests.vb b/src/VisualStudio/Core/Test/ProjectSystemShim/VisualStudioRuleSetTests.vb index 8d3e4492461bb..165121acff618 100644 --- a/src/VisualStudio/Core/Test/ProjectSystemShim/VisualStudioRuleSetTests.vb +++ b/src/VisualStudio/Core/Test/ProjectSystemShim/VisualStudioRuleSetTests.vb @@ -33,7 +33,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim File.WriteAllText(ruleSetPath, ruleSetSource) Dim fileChangeService = New MockVsFileChangeEx - Using ruleSetManager = New VisualStudioRuleSetManager(fileChangeService, New TestForegroundNotificationService(), AggregateAsynchronousOperationListener.CreateEmptyListener()) + Using ruleSetManager = New VisualStudioRuleSetManager(fileChangeService, New TestForegroundNotificationService(), AsynchronousOperationListenerProvider.NullListener) Dim visualStudioRuleSet = ruleSetManager.GetOrCreateRuleSet(ruleSetPath) ' Signing up for file change notifications is lazy, so read the rule set to force it. @@ -78,7 +78,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim File.WriteAllText(includePath, includeSource) Dim fileChangeService = New MockVsFileChangeEx - Using ruleSetManager = New VisualStudioRuleSetManager(fileChangeService, New TestForegroundNotificationService(), AggregateAsynchronousOperationListener.CreateEmptyListener()) + Using ruleSetManager = New VisualStudioRuleSetManager(fileChangeService, New TestForegroundNotificationService(), AsynchronousOperationListenerProvider.NullListener) Dim visualStudioRuleSet = ruleSetManager.GetOrCreateRuleSet(ruleSetPath) ' Signing up for file change notifications is lazy, so read the rule set to force it. @@ -125,7 +125,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim File.WriteAllText(includePath, includeSource) Dim fileChangeService = New MockVsFileChangeEx - Using ruleSetManager = New VisualStudioRuleSetManager(fileChangeService, New TestForegroundNotificationService(), AggregateAsynchronousOperationListener.CreateEmptyListener()) + Using ruleSetManager = New VisualStudioRuleSetManager(fileChangeService, New TestForegroundNotificationService(), AsynchronousOperationListenerProvider.NullListener) Dim ruleSet1 = ruleSetManager.GetOrCreateRuleSet(ruleSetPath) Dim handlerCalled As Boolean = False Dim handler = Sub(sender As Object, e As EventArgs) @@ -167,7 +167,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim File.WriteAllText(ruleSetPath, ruleSetSource) Dim fileChangeService = New MockVsFileChangeEx - Using ruleSetManager = New VisualStudioRuleSetManager(fileChangeService, New TestForegroundNotificationService(), AggregateAsynchronousOperationListener.CreateEmptyListener()) + Using ruleSetManager = New VisualStudioRuleSetManager(fileChangeService, New TestForegroundNotificationService(), AsynchronousOperationListenerProvider.NullListener) Dim ruleSet1 = ruleSetManager.GetOrCreateRuleSet(ruleSetPath) ' Signing up for file change notifications is lazy, so read the rule set to force it. @@ -210,7 +210,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim File.WriteAllText(ruleSetPath, ruleSetSource) Dim fileChangeService = New MockVsFileChangeEx - Using ruleSetManager = New VisualStudioRuleSetManager(fileChangeService, New TestForegroundNotificationService(), AggregateAsynchronousOperationListener.CreateEmptyListener()) + Using ruleSetManager = New VisualStudioRuleSetManager(fileChangeService, New TestForegroundNotificationService(), AsynchronousOperationListenerProvider.NullListener) Dim ruleSet1 = ruleSetManager.GetOrCreateRuleSet(ruleSetPath) ' Signing up for file change notifications is lazy, so read the rule set to force it. @@ -247,7 +247,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim File.WriteAllText(ruleSetPath, ruleSetSource) Dim fileChangeService = New MockVsFileChangeEx - Using ruleSetManager = New VisualStudioRuleSetManager(fileChangeService, New TestForegroundNotificationService(), AggregateAsynchronousOperationListener.CreateEmptyListener()) + Using ruleSetManager = New VisualStudioRuleSetManager(fileChangeService, New TestForegroundNotificationService(), AsynchronousOperationListenerProvider.NullListener) Dim ruleSet = ruleSetManager.GetOrCreateRuleSet(ruleSetPath) Dim generalDiagnosticOption = ruleSet.GetGeneralDiagnosticOption() diff --git a/src/VisualStudio/Core/Test/Snippets/SnippetServiceWaiter.vb b/src/VisualStudio/Core/Test/Snippets/SnippetServiceWaiter.vb deleted file mode 100644 index 66313f8987551..0000000000000 --- a/src/VisualStudio/Core/Test/Snippets/SnippetServiceWaiter.vb +++ /dev/null @@ -1,15 +0,0 @@ -' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -Imports System.Composition -Imports Microsoft.CodeAnalysis.Shared.TestHooks - -Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Snippets - <[Shared]> - - - - Friend Class SnippetServiceWaiter - Inherits AsynchronousOperationListener - - End Class -End Namespace diff --git a/src/VisualStudio/Core/Test/Snippets/SnippetTestState.vb b/src/VisualStudio/Core/Test/Snippets/SnippetTestState.vb index 1a0389c2393a3..edff71c4ea6c6 100644 --- a/src/VisualStudio/Core/Test/Snippets/SnippetTestState.vb +++ b/src/VisualStudio/Core/Test/Snippets/SnippetTestState.vb @@ -49,8 +49,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Snippets GetService(Of IEditorOperationsFactoryService)(), UndoHistoryRegistry, GetService(Of IInlineRenameService)(), + GetExportedValue(Of IAsynchronousOperationListenerProvider)(), New TestCompletionPresenter(Me), - GetExports(Of IAsynchronousOperationListener, FeatureMetadata)(), GetExports(Of IBraceCompletionSessionProvider, BraceCompletionMetadata)()) Dim CompletionCommandHandler = New CompletionCommandHandler(asyncCompletionService) @@ -68,8 +68,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Snippets Public Property SnippetExpansionClient As MockSnippetExpansionClient Private Shared Function CreatePartCatalog(types As IEnumerable(Of Type)) As ComposableCatalog - Dim extraParts = types.Concat({GetType(SignatureHelpWaiter), GetType(CompletionWaiter)}) - Return MinimalTestExportProvider.CreateTypeCatalog(extraParts) + Return MinimalTestExportProvider.CreateTypeCatalog(types) End Function Public Property CurrentCompletionPresenterSession As TestCompletionPresenterSession Implements IIntelliSenseTestState.CurrentCompletionPresenterSession diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpKeywordHighlighting.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpKeywordHighlighting.cs index 60ed1984ac714..50653daf44d19 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpKeywordHighlighting.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpKeywordHighlighting.cs @@ -104,11 +104,13 @@ static void Main() private void Verify(string marker, ImmutableArray expectedCount) { VisualStudio.Editor.PlaceCaret(marker, charsOffset: -1); - VisualStudio.Workspace.WaitForAsyncOperations(string.Concat( - FeatureAttribute.SolutionCrawler, - FeatureAttribute.DiagnosticService, - FeatureAttribute.Classification, - FeatureAttribute.KeywordHighlighting)); + VisualStudio.Workspace.WaitForAllAsyncOperations( + FeatureAttribute.Workspace, + FeatureAttribute.SolutionCrawler, + FeatureAttribute.DiagnosticService, + FeatureAttribute.Classification, + FeatureAttribute.KeywordHighlighting); + Assert.Equal(expectedCount, VisualStudio.Editor.GetKeywordHighlightTags()); } } diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpReferenceHighlighting.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpReferenceHighlighting.cs index cf079dac757d8..f9ac44550d1df 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpReferenceHighlighting.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpReferenceHighlighting.cs @@ -84,11 +84,12 @@ void M() private void Verify(string marker, IDictionary> spans) { VisualStudio.Editor.PlaceCaret(marker, charsOffset: -1); - VisualStudio.Workspace.WaitForAsyncOperations(string.Concat( - FeatureAttribute.SolutionCrawler, - FeatureAttribute.DiagnosticService, - FeatureAttribute.Classification, - FeatureAttribute.ReferenceHighlighting)); + VisualStudio.Workspace.WaitForAllAsyncOperations( + FeatureAttribute.Workspace, + FeatureAttribute.SolutionCrawler, + FeatureAttribute.DiagnosticService, + FeatureAttribute.Classification, + FeatureAttribute.ReferenceHighlighting); AssertEx.SetEqual(spans["definition"], VisualStudio.Editor.GetTagSpans(DefinitionHighlightTag.TagId), message: "Testing 'definition'\r\n"); @@ -106,11 +107,12 @@ private void Verify(string marker, IDictionary> private void VerifyNone(string marker) { VisualStudio.Editor.PlaceCaret(marker, charsOffset: -1); - VisualStudio.Workspace.WaitForAsyncOperations(string.Concat( - FeatureAttribute.SolutionCrawler, - FeatureAttribute.DiagnosticService, - FeatureAttribute.Classification, - FeatureAttribute.ReferenceHighlighting)); + VisualStudio.Workspace.WaitForAllAsyncOperations( + FeatureAttribute.Workspace, + FeatureAttribute.SolutionCrawler, + FeatureAttribute.DiagnosticService, + FeatureAttribute.Classification, + FeatureAttribute.ReferenceHighlighting); Assert.Empty(VisualStudio.Editor.GetTagSpans(ReferenceHighlightTag.TagId)); Assert.Empty(VisualStudio.Editor.GetTagSpans(DefinitionHighlightTag.TagId)); diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicKeywordHighlighting.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicKeywordHighlighting.cs index 54bbe2e6d338f..e50cd3e4ab504 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicKeywordHighlighting.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicKeywordHighlighting.cs @@ -39,12 +39,14 @@ End Sub private void Verify(string marker, int expectedCount) { VisualStudio.Editor.PlaceCaret(marker, charsOffset: -1); - VisualStudio.Workspace.WaitForAsyncOperations(string.Concat( - FeatureAttribute.SolutionCrawler, - FeatureAttribute.DiagnosticService, - FeatureAttribute.Classification, - FeatureAttribute.KeywordHighlighting)); - //Assert.Equal(expectedCount, VisualStudio.Editor.GetKeywordHighlightTagCount()); + VisualStudio.Workspace.WaitForAllAsyncOperations( + FeatureAttribute.Workspace, + FeatureAttribute.SolutionCrawler, + FeatureAttribute.DiagnosticService, + FeatureAttribute.Classification, + FeatureAttribute.KeywordHighlighting); + + // Assert.Equal(expectedCount, VisualStudio.Editor.GetKeywordHighlightTagCount()); } } } diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicReferenceHighlighting.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicReferenceHighlighting.cs index 325e2dbea893b..7483c280b92bc 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicReferenceHighlighting.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicReferenceHighlighting.cs @@ -44,11 +44,12 @@ End Function private void Verify(string marker, IDictionary> spans) { VisualStudio.Editor.PlaceCaret(marker, charsOffset: -1); - VisualStudio.Workspace.WaitForAsyncOperations(string.Concat( - FeatureAttribute.SolutionCrawler, - FeatureAttribute.DiagnosticService, - FeatureAttribute.Classification, - FeatureAttribute.ReferenceHighlighting)); + VisualStudio.Workspace.WaitForAllAsyncOperations( + FeatureAttribute.Workspace, + FeatureAttribute.SolutionCrawler, + FeatureAttribute.DiagnosticService, + FeatureAttribute.Classification, + FeatureAttribute.ReferenceHighlighting); AssertEx.SetEqual(spans["reference"], VisualStudio.Editor.GetTagSpans(ReferenceHighlightTag.TagId), message: "Testing 'reference'\r\n"); AssertEx.SetEqual(spans["writtenReference"], VisualStudio.Editor.GetTagSpans(WrittenReferenceHighlightTag.TagId), message: "Testing 'writtenReference'\r\n"); @@ -58,11 +59,12 @@ private void Verify(string marker, IDictionary> private void VerifyNone(string marker) { VisualStudio.Editor.PlaceCaret(marker, charsOffset: -1); - VisualStudio.Workspace.WaitForAsyncOperations(string.Concat( - FeatureAttribute.SolutionCrawler, - FeatureAttribute.DiagnosticService, - FeatureAttribute.Classification, - FeatureAttribute.ReferenceHighlighting)); + VisualStudio.Workspace.WaitForAllAsyncOperations( + FeatureAttribute.Workspace, + FeatureAttribute.SolutionCrawler, + FeatureAttribute.DiagnosticService, + FeatureAttribute.Classification, + FeatureAttribute.ReferenceHighlighting); Assert.Empty(VisualStudio.Editor.GetTagSpans(ReferenceHighlightTag.TagId)); Assert.Empty(VisualStudio.Editor.GetTagSpans(WrittenReferenceHighlightTag.TagId)); diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/VisualStudioWorkspace_InProc.cs b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/VisualStudioWorkspace_InProc.cs index d110cf61f4ca2..94520b746a2c8 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/VisualStudioWorkspace_InProc.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/VisualStudioWorkspace_InProc.cs @@ -22,6 +22,9 @@ internal class VisualStudioWorkspace_InProc : InProcComponent private VisualStudioWorkspace_InProc() { + // we need to enable waiting service before we create workspace + GetWaitingService().Enable(true); + _visualStudioWorkspace = GetComponentModelService(); } @@ -29,7 +32,8 @@ public static VisualStudioWorkspace_InProc Create() => new VisualStudioWorkspace_InProc(); public void SetOptionInfer(string projectName, bool value) - => InvokeOnUIThread(() => { + => InvokeOnUIThread(() => + { var convertedValue = value ? 1 : 0; var project = GetProject(projectName); project.Properties.Item("OptionInfer").Value = convertedValue; @@ -55,13 +59,15 @@ public bool IsPrettyListingOn(string languageName) => _visualStudioWorkspace.Options.GetOption(FeatureOnOffOptions.PrettyListing, languageName); public void SetPrettyListing(string languageName, bool value) - => InvokeOnUIThread(() => { + => InvokeOnUIThread(() => + { _visualStudioWorkspace.Options = _visualStudioWorkspace.Options.WithChangedOption( FeatureOnOffOptions.PrettyListing, languageName, value); }); public void EnableQuickInfo(bool value) - => InvokeOnUIThread(() => { + => InvokeOnUIThread(() => + { _visualStudioWorkspace.Options = _visualStudioWorkspace.Options.WithChangedOption( InternalFeatureOnOffOptions.QuickInfo, value); }); @@ -116,8 +122,8 @@ private static TestingOnly_WaitingService GetWaitingService() public void WaitForAsyncOperations(string featuresToWaitFor, bool waitForWorkspaceFirst = true) => GetWaitingService().WaitForAsyncOperations(featuresToWaitFor, waitForWorkspaceFirst); - public void WaitForAllAsyncOperations() - => GetWaitingService().WaitForAllAsyncOperations(); + public void WaitForAllAsyncOperations(params string[] featureNames) + => GetWaitingService().WaitForAllAsyncOperations(featureNames); private static void LoadRoslynPackage() { @@ -129,16 +135,18 @@ private static void LoadRoslynPackage() } public void CleanUpWorkspace() - => InvokeOnUIThread(() => { + => InvokeOnUIThread(() => + { LoadRoslynPackage(); _visualStudioWorkspace.TestHookPartialSolutionsDisabled = true; }); public void CleanUpWaitingService() - => InvokeOnUIThread(() => { - var asynchronousOperationWaiterExports = GetComponentModel().DefaultExportProvider.GetExports(); + => InvokeOnUIThread(() => + { + var provider = GetComponentModel().DefaultExportProvider.GetExportedValue(); - if (!asynchronousOperationWaiterExports.Any()) + if (provider == null) { throw new InvalidOperationException("The test waiting service could not be located."); } diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/VisualStudioWorkspace_OutOfProc.cs b/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/VisualStudioWorkspace_OutOfProc.cs index dba57fe8ba4c0..cec7f8d1c2cf5 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/VisualStudioWorkspace_OutOfProc.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/VisualStudioWorkspace_OutOfProc.cs @@ -50,8 +50,8 @@ public void SetOption(string optionName, string feature, object value) public void WaitForAsyncOperations(string featuresToWaitFor, bool waitForWorkspaceFirst = true) => _inProc.WaitForAsyncOperations(featuresToWaitFor, waitForWorkspaceFirst); - public void WaitForAllAsyncOperations() - => _inProc.WaitForAllAsyncOperations(); + public void WaitForAllAsyncOperations(params string[] featureNames) + => _inProc.WaitForAllAsyncOperations(featureNames); public void CleanUpWorkspace() => _inProc.CleanUpWorkspace(); diff --git a/src/VisualStudio/TestUtilities2/ProjectSystemShim/Framework/TestEnvironment.vb b/src/VisualStudio/TestUtilities2/ProjectSystemShim/Framework/TestEnvironment.vb index e54b1d59963ed..4f9afa17ec4e5 100644 --- a/src/VisualStudio/TestUtilities2/ProjectSystemShim/Framework/TestEnvironment.vb +++ b/src/VisualStudio/TestUtilities2/ProjectSystemShim/Framework/TestEnvironment.vb @@ -47,7 +47,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim.Fr Dim ruleSetFileProvider = New VisualStudioRuleSetManager( DirectCast(_serviceProvider.GetService(GetType(SVsFileChangeEx)), IVsFileChangeEx), New TestForegroundNotificationService(), - AggregateAsynchronousOperationListener.CreateEmptyListener()) + AsynchronousOperationListenerProvider.NullListener) Dim documentTrackingService = New VisualStudioDocumentTrackingService(_serviceProvider) Dim documentProvider = New DocumentProvider(_projectTracker, _serviceProvider, documentTrackingService) diff --git a/src/VisualStudio/VisualBasic/Impl/Progression/VisualBasicGraphProvider.vb b/src/VisualStudio/VisualBasic/Impl/Progression/VisualBasicGraphProvider.vb index 2aa4e09a64bd9..612503bd2554f 100644 --- a/src/VisualStudio/VisualBasic/Impl/Progression/VisualBasicGraphProvider.vb +++ b/src/VisualStudio/VisualBasic/Impl/Progression/VisualBasicGraphProvider.vb @@ -16,8 +16,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Progression Inherits AbstractGraphProvider - Public Sub New(glyphService As IGlyphService, serviceProvider As SVsServiceProvider, workspaceProvider As IProgressionPrimaryWorkspaceProvider, asyncListeners As IEnumerable(Of Lazy(Of IAsynchronousOperationListener, FeatureMetadata))) - MyBase.New(glyphService, serviceProvider, workspaceProvider.PrimaryWorkspace, asyncListeners) + Public Sub New(glyphService As IGlyphService, serviceProvider As SVsServiceProvider, workspaceProvider As IProgressionPrimaryWorkspaceProvider, listenerProvider As IAsynchronousOperationListenerProvider) + MyBase.New(glyphService, serviceProvider, workspaceProvider.PrimaryWorkspace, listenerProvider) End Sub End Class End Namespace diff --git a/src/VisualStudio/VisualBasic/Impl/ProjectSystemShim/VisualBasicProject.vb b/src/VisualStudio/VisualBasic/Impl/ProjectSystemShim/VisualBasicProject.vb index a0c2e56289dff..8ff49fc91e2c0 100644 --- a/src/VisualStudio/VisualBasic/Impl/ProjectSystemShim/VisualBasicProject.vb +++ b/src/VisualStudio/VisualBasic/Impl/ProjectSystemShim/VisualBasicProject.vb @@ -502,13 +502,5 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.ProjectSystemShim SetOptions(lastCompilationOptions.WithGlobalImports(_imports), CurrentParseOptions) End If End Sub - -#If DEBUG Then - Public Overrides ReadOnly Property Debug_VBEmbeddedCoreOptionOn As Boolean - Get - Return DirectCast(CurrentCompilationOptions, VisualBasicCompilationOptions).EmbedVbCoreRuntime - End Get - End Property -#End If End Class End Namespace diff --git a/src/VisualStudio/VisualBasic/Impl/Snippets/VisualBasicSnippetInfoService.vb b/src/VisualStudio/VisualBasic/Impl/Snippets/VisualBasicSnippetInfoService.vb index 3f8c752909472..bd3f5d673a600 100644 --- a/src/VisualStudio/VisualBasic/Impl/Snippets/VisualBasicSnippetInfoService.vb +++ b/src/VisualStudio/VisualBasic/Impl/Snippets/VisualBasicSnippetInfoService.vb @@ -18,8 +18,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets Inherits AbstractSnippetInfoService - Public Sub New(serviceProvider As SVsServiceProvider, asyncListeners As IEnumerable(Of Lazy(Of IAsynchronousOperationListener, FeatureMetadata))) - MyBase.New(serviceProvider, Guids.VisualBasicDebuggerLanguageId, asyncListeners) + Public Sub New(serviceProvider As SVsServiceProvider, listenerProvider As IAsynchronousOperationListenerProvider) + MyBase.New(serviceProvider, Guids.VisualBasicDebuggerLanguageId, listenerProvider) End Sub End Class End Namespace diff --git a/src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs b/src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs index 847cd0a425d20..8d0f4d18cfab5 100644 --- a/src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs +++ b/src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs @@ -356,20 +356,12 @@ private static ImmutableArray GetSymbolsOffOfName( var usingDirective = name.GetAncestorOrThis(); if (usingDirective != null && usingDirective.Alias == null) { - if (usingDirective.StaticKeyword.IsKind(SyntaxKind.StaticKeyword)) - { - return symbols.WhereAsArray(s => !s.IsDelegateType() && !s.IsInterfaceType()); - } - else - { - symbols = symbols.WhereAsArray(s => s.IsNamespace()); - } + return usingDirective.StaticKeyword.IsKind(SyntaxKind.StaticKeyword) + ? symbols.WhereAsArray(s => !s.IsDelegateType() && !s.IsInterfaceType()) + : symbols.WhereAsArray(s => s.IsNamespace()); } - if (symbols.Any()) - { - return symbols; - } + return symbols; } return ImmutableArray.Empty; diff --git a/src/Workspaces/Core/Desktop/Workspace/Storage/PersistentStorageService.cs b/src/Workspaces/Core/Desktop/Workspace/Storage/PersistentStorageService.cs index 2a9a9d5f98a5f..50bd770eaa0ee 100644 --- a/src/Workspaces/Core/Desktop/Workspace/Storage/PersistentStorageService.cs +++ b/src/Workspaces/Core/Desktop/Workspace/Storage/PersistentStorageService.cs @@ -22,15 +22,12 @@ internal abstract partial class AbstractPersistentStorageService : IPersistentSt protected readonly IOptionService OptionService; private readonly SolutionSizeTracker _solutionSizeTracker; - private readonly object _lookupAccessLock; - private readonly Dictionary _lookup; private readonly bool _testing; + private readonly object _primaryStorageAccessLock; + private readonly PrimaryStorageInfo _primaryStorage; private string _lastSolutionPath; - private SolutionId _primarySolutionId; - private AbstractPersistentStorage _primarySolutionStorage; - protected AbstractPersistentStorageService( IOptionService optionService, SolutionSizeTracker solutionSizeTracker) @@ -38,16 +35,13 @@ protected AbstractPersistentStorageService( OptionService = optionService; _solutionSizeTracker = solutionSizeTracker; - _lookupAccessLock = new object(); - _lookup = new Dictionary(); + _primaryStorageAccessLock = new object(); _lastSolutionPath = null; - - _primarySolutionId = null; - _primarySolutionStorage = null; + _primaryStorage = new PrimaryStorageInfo(); } - protected AbstractPersistentStorageService(IOptionService optionService, bool testing) + protected AbstractPersistentStorageService(IOptionService optionService, bool testing) : this(optionService, solutionSizeTracker: null) { _testing = true; @@ -62,24 +56,17 @@ public IPersistentStorage GetStorage(Solution solution) public IPersistentStorage GetStorage(Solution solution, bool checkBranchId) { - if (!ShouldUseDatabase(solution, checkBranchId)) + if (!DatabaseSupported(solution, checkBranchId)) { return NoOpPersistentStorage.Instance; } - // can't use cached information - if (!string.Equals(solution.FilePath, _lastSolutionPath, StringComparison.OrdinalIgnoreCase)) + // check whether the solution actually exist on disk + if (!CheckSolutionFileExist(solution.FilePath)) { - // check whether the solution actually exist on disk - if (!File.Exists(solution.FilePath)) - { - return NoOpPersistentStorage.Instance; - } + return NoOpPersistentStorage.Instance; } - // cache current result. - _lastSolutionPath = solution.FilePath; - // get working folder path var workingFolderPath = GetWorkingFolderPath(solution); if (workingFolderPath == null) @@ -91,45 +78,45 @@ public IPersistentStorage GetStorage(Solution solution, bool checkBranchId) return GetStorage(solution, workingFolderPath); } + private bool CheckSolutionFileExist(string solutionFilePath) + { + if (!string.Equals(solutionFilePath, _lastSolutionPath, StringComparison.OrdinalIgnoreCase)) + { + // check whether the solution actually exist on disk + var exist = File.Exists(solutionFilePath); + + // cache current result. + _lastSolutionPath = exist ? solutionFilePath : null; + + return exist; + } + + return true; + } + private IPersistentStorage GetStorage(Solution solution, string workingFolderPath) { - lock (_lookupAccessLock) + lock (_primaryStorageAccessLock) { - // see whether we have something we can use - if (_lookup.TryGetValue(solution.FilePath, out var storage)) + // first check primary storage, this should cover most of cases + if (_primaryStorage.TryGetStorage(solution.FilePath, workingFolderPath, out var storage)) { - // previous attempt to create db storage failed. - if (storage == null && !SolutionSizeAboveThreshold(solution)) - { - return NoOpPersistentStorage.Instance; - } - - // everything seems right, use what we have - if (storage?.WorkingFolderPath == workingFolderPath) - { - storage.AddRefUnsafe(); - return storage; - } + return storage; } - // either this is the first time, or working folder path has changed. - // remove existing one - _lookup.Remove(solution.FilePath); - + // okay, go through steps to see whether persistent service should be + // supported var dbFile = GetDatabaseFilePath(workingFolderPath); if (!File.Exists(dbFile) && !SolutionSizeAboveThreshold(solution)) { - _lookup.Add(solution.FilePath, storage); return NoOpPersistentStorage.Instance; } // try create new one storage = TryCreatePersistentStorage(solution, workingFolderPath); - _lookup.Add(solution.FilePath, storage); - if (storage != null) { - RegisterPrimarySolutionStorageIfNeeded(solution, storage); + _primaryStorage.EnsureStorage(solution, storage); storage.AddRefUnsafe(); return storage; @@ -139,7 +126,7 @@ private IPersistentStorage GetStorage(Solution solution, string workingFolderPat } } - private bool ShouldUseDatabase(Solution solution, bool checkBranchId) + private bool DatabaseSupported(Solution solution, bool checkBranchId) { if (_testing) { @@ -185,18 +172,6 @@ private bool SolutionSizeAboveThreshold(Solution solution) return size >= threshold; } - private void RegisterPrimarySolutionStorageIfNeeded(Solution solution, AbstractPersistentStorage storage) - { - if (_primarySolutionStorage != null || solution.Id != _primarySolutionId) - { - return; - } - - // hold onto the primary solution when it is used the first time. - _primarySolutionStorage = storage; - storage.AddRefUnsafe(); - } - private string GetWorkingFolderPath(Solution solution) { if (_testing) @@ -268,11 +243,10 @@ private bool TryCreatePersistentStorage( protected void Release(AbstractPersistentStorage storage) { - lock (_lookupAccessLock) + lock (_primaryStorageAccessLock) { if (storage.ReleaseRefUnsafe()) { - _lookup.Remove(storage.SolutionFilePath); storage.Close(); } } @@ -282,52 +256,117 @@ public void RegisterPrimarySolution(SolutionId solutionId) { // don't create database storage file right away. it will be // created when first C#/VB project is added - lock (_lookupAccessLock) + lock (_primaryStorageAccessLock) { - Contract.ThrowIfTrue(_primarySolutionStorage != null); - - // just reset solutionId as long as there is no storage has created. - _primarySolutionId = solutionId; + _primaryStorage.RegisterPrimarySolution(solutionId); } } public void UnregisterPrimarySolution(SolutionId solutionId, bool synchronousShutdown) { AbstractPersistentStorage storage = null; - lock (_lookupAccessLock) + lock (_primaryStorageAccessLock) { - if (_primarySolutionId == null) + _primaryStorage.UnregisterPrimarySolution(solutionId, out storage); + } + + ReleaseStorage(storage, synchronousShutdown); + } + + private static void ReleaseStorage(AbstractPersistentStorage storage, bool synchronousShutdown) + { + if (storage == null) + { + return; + } + + if (synchronousShutdown) + { + // dispose storage outside of the lock + storage.Dispose(); + } + else + { + // make it to shutdown asynchronously + Task.Run(() => storage.Dispose()); + } + } + + private class PrimaryStorageInfo + { + public SolutionId SolutionId { get; private set; } + + public AbstractPersistentStorage Storage { get; private set; } + + public bool TryGetStorage( + string solutionFilePath, + string workingFolderPath, + out AbstractPersistentStorage storage) + { + storage = null; + + if (Storage == null) { - // primary solution is never registered or already unregistered - Contract.ThrowIfTrue(_primarySolutionStorage != null); - return; + return false; } - Contract.ThrowIfFalse(_primarySolutionId == solutionId); + if (Storage.SolutionFilePath != solutionFilePath || + Storage.WorkingFolderPath != workingFolderPath) + { + return false; + } + + storage = Storage; + storage.AddRefUnsafe(); + + return true; + } - _primarySolutionId = null; - if (_primarySolutionStorage == null) + public void EnsureStorage(Solution solution, AbstractPersistentStorage storage) + { + if (Storage != null || solution.Id != SolutionId) { - // primary solution is registered but no C#/VB project was added return; } - storage = _primarySolutionStorage; - _primarySolutionStorage = null; + // hold onto the primary solution when it is used the first time. + Storage = storage; + storage.AddRefUnsafe(); } - if (storage != null) + public void RegisterPrimarySolution(SolutionId solutionId) { - if (synchronousShutdown) + Contract.ThrowIfNull(solutionId); + + if (SolutionId == solutionId) { - // dispose storage outside of the lock - storage.Dispose(); + // this can happen if user opened solution without creating actual file + // (ex, "Projects and Solutions" -> "Save new projects when created" option off in VS) + // and then later save the solution. then certain host such as VS can call it again + // without unregister solution first through IVsSolutionWorkingFoldersEvents + return; } - else + + SolutionId = solutionId; + ReleaseStorage(Storage, synchronousShutdown: false); + } + + public void UnregisterPrimarySolution(SolutionId solutionId, out AbstractPersistentStorage storage) + { + storage = null; + if (SolutionId == null) { - // make it to shutdown asynchronously - Task.Run(() => storage.Dispose()); + // primary solution is never registered or already unregistered + Contract.ThrowIfTrue(Storage != null); + return; } + + Contract.ThrowIfFalse(SolutionId == solutionId); + + storage = Storage; + + SolutionId = null; + Storage = null; } } } diff --git a/src/Workspaces/Core/Portable/CodeStyle/AccessibilityModifiersRequired.cs b/src/Workspaces/Core/Portable/CodeStyle/AccessibilityModifiersRequired.cs index 7c11deb5d5a77..55bfe217960f5 100644 --- a/src/Workspaces/Core/Portable/CodeStyle/AccessibilityModifiersRequired.cs +++ b/src/Workspaces/Core/Portable/CodeStyle/AccessibilityModifiersRequired.cs @@ -5,7 +5,10 @@ namespace Microsoft.CodeAnalysis.CodeStyle { internal enum AccessibilityModifiersRequired { + // The rule is not run Never = 0, + + // Accessibility modifiers are added if missing, even if default Always = 1, // Future proofing for when C# adds default interface methods. At that point @@ -13,5 +16,8 @@ internal enum AccessibilityModifiersRequired // want to require them, while some may want to keep the traditional C# style // that public interface members do not need accessibility modifiers. ForNonInterfaceMembers = 2, + + // Remove any accessibility modifier that matches the default + OmitIfDefault = 3 } } diff --git a/src/Workspaces/Core/Portable/CodeStyle/CodeStyleOptions.cs b/src/Workspaces/Core/Portable/CodeStyle/CodeStyleOptions.cs index 411958caafa64..dda125309e83d 100644 --- a/src/Workspaces/Core/Portable/CodeStyle/CodeStyleOptions.cs +++ b/src/Workspaces/Core/Portable/CodeStyle/CodeStyleOptions.cs @@ -205,6 +205,8 @@ private static CodeStyleOption ParseAccessibilit return new CodeStyleOption(AccessibilityModifiersRequired.Always, notificationOpt); case "for_non_interface_members": return new CodeStyleOption(AccessibilityModifiersRequired.ForNonInterfaceMembers, notificationOpt); + case "omit_if_default": + return new CodeStyleOption(AccessibilityModifiersRequired.OmitIfDefault, notificationOpt); } } } diff --git a/src/Workspaces/Core/Portable/Log/FunctionId.cs b/src/Workspaces/Core/Portable/Log/FunctionId.cs index 395234a70d70d..0e574315cc81e 100644 --- a/src/Workspaces/Core/Portable/Log/FunctionId.cs +++ b/src/Workspaces/Core/Portable/Log/FunctionId.cs @@ -403,5 +403,7 @@ internal enum FunctionId MetadataOnlyImage_EmitFailure, LiveTableDataSource_OnDiagnosticsUpdated, Experiment_KeybindingsReset, + ExternalErrorDiagnosticUpdateSource_AddError, + DiagnosticIncrementalAnalyzer_SynchronizeWithBuildAsync, } } diff --git a/src/Workspaces/Core/Portable/Log/KeyValueLogMessage.cs b/src/Workspaces/Core/Portable/Log/KeyValueLogMessage.cs index 5b0d72d2103c1..523ba9b94e8a8 100644 --- a/src/Workspaces/Core/Portable/Log/KeyValueLogMessage.cs +++ b/src/Workspaces/Core/Portable/Log/KeyValueLogMessage.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Linq; using Microsoft.CodeAnalysis.PooledObjects; -using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Internal.Log { @@ -61,7 +60,7 @@ public bool ContainsProperty get { EnsureMap(); - return _map?.Count > 0; + return _map.Count > 0; } } @@ -91,17 +90,21 @@ protected override void FreeCore() if (_propertySetter != null) { _propertySetter = null; - s_pool.Free(this); } + + // always pool it back + s_pool.Free(this); } private void EnsureMap() { - if (_map == null && _propertySetter != null) + // always create _map + if (_map == null) { _map = SharedPools.Default>().AllocateAndClear(); - _propertySetter(_map); } + + _propertySetter?.Invoke(_map); } } diff --git a/src/Workspaces/Core/Portable/SolutionCrawler/InvocationReasons.cs b/src/Workspaces/Core/Portable/SolutionCrawler/InvocationReasons.cs index ec195e04f29b5..36a1dfec8d45d 100644 --- a/src/Workspaces/Core/Portable/SolutionCrawler/InvocationReasons.cs +++ b/src/Workspaces/Core/Portable/SolutionCrawler/InvocationReasons.cs @@ -59,5 +59,10 @@ IEnumerator IEnumerable.GetEnumerator() { return _reasons.GetEnumerator(); } + + public override string ToString() + { + return string.Join("|", _reasons ?? ImmutableHashSet.Empty); + } } } diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/DocumentState.cs b/src/Workspaces/Core/Portable/Workspace/Solution/DocumentState.cs index 7bd32863a8724..be45ada229034 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/DocumentState.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/DocumentState.cs @@ -693,32 +693,25 @@ public override async Task GetTopLevelChangeTextVersionAsync(Cance return treeAndVersion.Version; } - private static readonly ReaderWriterLockSlim s_syntaxTreeToIdMapLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion); private static readonly ConditionalWeakTable s_syntaxTreeToIdMap = new ConditionalWeakTable(); private static void BindSyntaxTreeToId(SyntaxTree tree, DocumentId id) { - using (s_syntaxTreeToIdMapLock.DisposableWrite()) + if (!s_syntaxTreeToIdMap.TryGetValue(tree, out var existingId)) { - if (s_syntaxTreeToIdMap.TryGetValue(tree, out var existingId)) - { - Contract.ThrowIfFalse(existingId == id); - } - else - { - s_syntaxTreeToIdMap.Add(tree, id); - } + // Avoid closing over parameter 'id' on the method's fast path + var localId = id; + existingId = s_syntaxTreeToIdMap.GetValue(tree, t => localId); } + + Contract.ThrowIfFalse(existingId == id); } public static DocumentId GetDocumentIdForTree(SyntaxTree tree) { - using (s_syntaxTreeToIdMapLock.DisposableRead()) - { - s_syntaxTreeToIdMap.TryGetValue(tree, out var id); - return id; - } + s_syntaxTreeToIdMap.TryGetValue(tree, out var id); + return id; } } } diff --git a/src/Workspaces/Remote/Core/Services/AssetService.cs b/src/Workspaces/Remote/Core/Services/AssetService.cs index ca9c368fa6ec5..526b3813da3aa 100644 --- a/src/Workspaces/Remote/Core/Services/AssetService.cs +++ b/src/Workspaces/Remote/Core/Services/AssetService.cs @@ -17,8 +17,7 @@ namespace Microsoft.CodeAnalysis.Remote /// internal class AssetService { - // PREVIEW: unfortunately, I need dummy workspace since workspace services can be workspace specific - private static readonly Serializer s_serializer = new Serializer(new AdhocWorkspace(RoslynServices.HostServices, workspaceKind: "dummy")); + private static readonly Serializer s_serializer = new Serializer(SolutionService.PrimaryWorkspace); private readonly int _scopeId; private readonly AssetStorage _assetStorage; diff --git a/src/Workspaces/Remote/ServiceHub/Services/RemoteHostService.cs b/src/Workspaces/Remote/ServiceHub/Services/RemoteHostService.cs index 8c79dde056f16..9498ce86a3f74 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/RemoteHostService.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/RemoteHostService.cs @@ -263,10 +263,7 @@ private static TelemetrySession GetTelemetrySession(string serializedSession) private static AbstractPersistentStorageService GetPersistentStorageService() { - // A bit slimy. We just create an adhoc workspace so it will create the singleton - // PersistentStorageService. This service will be shared among all Workspaces we - // create in this process. So updating it will be seen by all. - var workspace = new AdhocWorkspace(RoslynServices.HostServices); + var workspace = SolutionService.PrimaryWorkspace; var persistentStorageService = workspace.Services.GetService() as AbstractPersistentStorageService; return persistentStorageService; } diff --git a/src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb b/src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb index 484b5d59eba45..88b698dc580cb 100644 --- a/src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb +++ b/src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb @@ -2706,6 +2706,13 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration End If Dim newTokens = GetModifierList(accessibility, mods, GetDeclarationKind(declaration), isDefault) + 'GetDeclarationKind returns None for Field if the count is > 1 + 'To handle multiple declarations on a field if the Accessibility is NotApplicable, we need to add the Dim + If declaration.Kind = SyntaxKind.FieldDeclaration AndAlso accessibility = Accessibility.NotApplicable AndAlso newTokens.Count = 0 Then + ' Add the Dim + newTokens = newTokens.Add(SyntaxFactory.Token(SyntaxKind.DimKeyword)) + End If + Return WithModifierTokens(declaration, Merge(tokens, newTokens)) End Function From b4879f7302a27dbc97ad985f4e2fb7507c0c564a Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 6 Feb 2018 17:05:17 -0800 Subject: [PATCH 05/43] Merge dev15.7.x to dev15.7.x-vs-deps (#24665) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove duplicate lock DocumentState.s_syntaxTreeToIdMapLock This lock is only being used to protect access to an instance which contains internal synchronization. * Better handle surrounding directives when inlining a local variable. * Add tests. * Share code between VB and C#. * Reduce allocations in UnboundLambda Fixes #23463 * Restore ReturnInferenceCacheKey as the key for _returnInferenceCache * Update code to more closely follow patterns of the original code * Cleanup from code review * Verify MSBuild version in Developer CMD prompt Roslyn is designed to have the simplest possible contribution story: clone then build. Every pre-req needed is either located on the machine or bootstrapped via NuGet. All the way down to using an xcopy MSBuild if needed. The one case which causes a problem is the VS command prompt. In this case MSBuild is pre-installed on the machine and may or may not be suitable for building Roslyn. Previously when building from a VS command prompt we just used whatever MSBuild was provided. The assumption being a developer command prompt was an explicit statement of whath MSBuild you wanted to use. Based on all of our customer reports though this does not seem to be the assumption that consumers of our repo have. The build gave them no explicit errors about the provided toolset and hence when the build failed they assigned flakiness to our repo. Going forward we are applying the same version validation to MSBuild when provided via a developer command prompt. If it doesn't match we will refuse to build asking the user to upgrade VS or build from a normal command prompt. * Remove unneeded debugging line * Comment about pre-release * Added minimum version * Add Omit If Default style option * Add space to be like test without the omit * Add/Remove without needing a property * Reformat * PR feedback * Fix VB diagnostic based on feedback * Handle case of NotApplicable modifier and field declaration list * Fix tests * PR feedback * PR feedback * Support negative null-check when we are suggesting to inline type checks Fixes #21097 Fixes #24286 * fix a case where persistent storage registration fails and some clean… (#24458) * fix a case where persistent storage registration fails and some clean up code around it. * added readonly * address PR feedback * removed comments no longer relevant * renamed lock name * moved waiter from diagnostics.dll to features.dll where all interfaces are defined. (#24512) * put listener change back in (https://github.com/dotnet/roslyn/pull/24120) * leave old types in legacy folder until partner teams move to new interface * added legacy waiter to support partner teams * Remove methods indirecting access to _metadataFileNameToConvertedProjectReference This field is documented as being written and read from any thread, but in practice all uses are guarded by an AssertIsForeground(). Thus we can get rid of the helper methods that are trying to "help" by locking before accessing the fields, making it really hard to track all the real uses of it. * Make method static that doesn't need state * Fix up tests of P2P to metadata reference conversion It turns out we had some tests, but the tests were disabled. This was because the tests weren't working properly anyways: they were calling into UpdateProjectBinPath which only updated some (but not all) of the project state. That was an internal helper method that shouldn't be used by tests. Updating the tests to use SetBinOutputPathAndRelatedData works better. * Delete debug-only reference validation This was some legacy code that tried to verify that the references we have from the project system match up to what DTE and other sources say. This was debug-only, and the actual asserts were commented out. This is deadweight at this point, so delete it. * added and cleaned up logs around build and live diagnostics. (#24551) also added RoslynActivityLogger that can be enabled through project-system-tool * Avoid closure allocations on the BindSyntaxTreeToId fast path * CS1628 error text mentions in parameters; fixes #24584 * Update optimization data to 2.7.0-beta3-62526-01... * Small cleanup of completion logic. * Locate implementations for reference assemblies using the process binding path * Use GlobalAssemblyCache helper to locate assemblies directly in the GAC * Update InteractiveEditorFeatures to account for a second definition of GlobalAssemblyCache * Move to xunit.console for CoreClr tests Previously we were using xunit.console for desktop tests and dotnet-xunit for our CoreClr tests. This change unifies us on top of xunit.console (now that it has a netcoreapp2.0 version available). * Move unix builds to xunit.runner.console as well * Fixes 559223 Fix and re-enable test that would catch this error * Update LanguageServices training data again... * Get actual directory name, not file * Fix dir name issue * Cleanup based on code review feedback * Check fully-qualified names for SuppressIldasmAttribute and ReferenceAssemblyAttribute * Use correct reference location, or fail decompilation if it's not available * Fix typo... * Don't use inferred member name if that creates duplicates (#24632) * Fixes #23983 * Added test for unique IDEDiagnosticIDs * Fixed capitalization on local variable * Fix `is` and pattern-matching behavior in presence of implicit UD conversion (#24547) * Fix `is` and pattern-matching behavior in presence of implicit UD conversion and also an explicit reference conversion. User-defined conversions should never be considered for `is` and pattern-matching. Fixes #24522 --- build/Targets/Packages.props | 2 +- .../Portable/Binder/Binder_Operators.cs | 2 +- .../CSharp/Portable/Binder/Binder_Patterns.cs | 2 +- .../LocalRewriter/LocalRewriter_Patterns.cs | 2 +- .../Lowering/SyntheticBoundNodeFactory.cs | 4 +- .../CSharp/Test/Emit/CodeGen/PatternTests.cs | 96 +++++++++++++++++++ .../FusionAssemblyIdentity.cs | 4 +- .../UseInferredMemberNameTests.cs | 32 +++++++ src/EditorFeatures/Core/EditorFeatures.csproj | 7 ++ .../MetadataAsSourceFileService.cs | 35 ++++++- .../ForegroundThreadAffinitizedObject.cs | 2 +- .../IDEDiagnosticIDUniquenessTest.cs | 20 ++++ .../AbstractCodeActionOrUserDiagnosticTest.cs | 2 +- .../UseInferredMemberNameTests.vb | 29 ++++++ .../Diagnostics/Analyzers/IDEDiagnosticIds.cs | 3 +- .../GlobalAssemblyCacheCompletionHelper.cs | 6 +- .../IntegrationTests/CSharp/CSharpBuild.cs | 2 +- .../CSharpInferredMemberNameReducer.cs | 50 ++++++++++ .../VisualBasicInferredMemberNameReducer.vb | 43 +++++++++ 19 files changed, 325 insertions(+), 18 deletions(-) create mode 100644 src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDUniquenessTest.cs diff --git a/build/Targets/Packages.props b/build/Targets/Packages.props index 8264a644ef87d..b4c95e3b33bee 100644 --- a/build/Targets/Packages.props +++ b/build/Targets/Packages.props @@ -143,7 +143,7 @@ 1.1.0-beta1-62506-02 105.2.3 0.9.8-beta - 2.6.0-beta1-62205-01 + 2.7.0-beta3-62526-01-2 0.2.4-beta 0.3.7-beta 0.4.0-beta diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs index 33f466bd9ffec..60cc8c7973e07 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs @@ -2751,7 +2751,7 @@ private BoundExpression BindIsOperator(BinaryExpressionSyntax node, DiagnosticBa operandType = GetSpecialType(SpecialType.System_Object, diagnostics, node); } - Conversion conversion = Conversions.ClassifyConversionFromType(operandType, targetType, ref useSiteDiagnostics); + Conversion conversion = Conversions.ClassifyBuiltInConversion(operandType, targetType, ref useSiteDiagnostics); diagnostics.Add(node, useSiteDiagnostics); ReportIsOperatorConstantWarnings(node, diagnostics, operandType, targetType, conversion.Kind, operand.ConstantValue); return new BoundIsOperator(node, operand, typeExpression, conversion, resultType); diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs index a6fa796576238..7633bfa95db1d 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs @@ -224,7 +224,7 @@ private bool CheckValidPatternType( expressionType = conversions.CorLibrary.GetSpecialType(SpecialType.System_Object); } - conversion = conversions.ClassifyConversionFromType(expressionType, patternType, ref useSiteDiagnostics); + conversion = conversions.ClassifyBuiltInConversion(expressionType, patternType, ref useSiteDiagnostics); var result = Binder.GetIsOperatorConstantResult(expressionType, patternType, conversion.Kind, operandConstantValue, operandCouldBeNull); return (result == null) ? (bool?)null : diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs index fbf4fec8bda69..2ca2bc931b69d 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs @@ -164,7 +164,7 @@ private BoundExpression CompareWithConstant(BoundExpression input, BoundExpressi // use site diagnostics will already have been reported during binding. HashSet ignoredDiagnostics = null; var sourceType = source.Type.IsDynamic() ? _compilation.GetSpecialType(SpecialType.System_Object) : source.Type; - var conversionKind = _compilation.Conversions.ClassifyConversionFromType(sourceType, targetType, ref ignoredDiagnostics).Kind; + var conversionKind = _compilation.Conversions.ClassifyBuiltInConversion(sourceType, targetType, ref ignoredDiagnostics).Kind; var constantResult = Binder.GetIsOperatorConstantResult(sourceType, targetType, conversionKind, source.ConstantValue, requiredNullTest); return constantResult == ConstantValue.True ? true : diff --git a/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs b/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs index 331cbb06bed73..33f1fc9fb1f3e 100644 --- a/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs +++ b/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs @@ -504,7 +504,9 @@ public BoundAsOperator As(BoundExpression operand, TypeSymbol type) public BoundIsOperator Is(BoundExpression operand, TypeSymbol type) { HashSet discarded = null; - Conversion c = Compilation.Conversions.ClassifyConversionFromExpression(operand, type, ref discarded); + // Because compiler-generated nodes are not lowered, this conversion is not used later in the compiler. + // But it is a required part of the `BoundIsOperator` node, so we compute a conversion here. + Conversion c = Compilation.Conversions.ClassifyBuiltInConversion(operand.Type, type, ref discarded); return new BoundIsOperator(this.Syntax, operand, Type(type), c, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean)) { WasCompilerGenerated = true }; } diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/PatternTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/PatternTests.cs index 2cc45630bac2c..e0a8bf739732f 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/PatternTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/PatternTests.cs @@ -270,6 +270,102 @@ .locals init (U V_0, //u IL_003a: nop IL_003b: nop IL_003c: ret +}"); + } + + [Fact, WorkItem(24522, "https://github.com/dotnet/roslyn/issues/24522")] + public void IgnoreDeclaredConversion_01() + { + var source = +@"class Base +{ + public static implicit operator Derived(Base obj) + { + return new Derived(); + } +} + +class Derived : Base +{ +} + +class Program +{ + static void Main(string[] args) + { + Base x = new Derived(); + System.Console.WriteLine(x is Derived); + System.Console.WriteLine(x is Derived y); + switch (x) + { + case Derived z: System.Console.WriteLine(true); break; + } + System.Console.WriteLine(null != (x as Derived)); + } +}"; + var compilation = CreateStandardCompilation(source, options: TestOptions.DebugExe, references: new[] { LinqAssemblyRef }); + compilation.VerifyDiagnostics(); + var expectedOutput = +@"True +True +True +True"; + var compVerifier = CompileAndVerify(compilation, expectedOutput: expectedOutput); + compVerifier.VerifyIL("Program.Main", +@"{ + // Code size 94 (0x5e) + .maxstack 2 + .locals init (Base V_0, //x + Derived V_1, //y + Base V_2, + Derived V_3, + Derived V_4, //z + Base V_5) + IL_0000: nop + IL_0001: newobj ""Derived..ctor()"" + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: isinst ""Derived"" + IL_000d: ldnull + IL_000e: cgt.un + IL_0010: call ""void System.Console.WriteLine(bool)"" + IL_0015: nop + IL_0016: ldloc.0 + IL_0017: isinst ""Derived"" + IL_001c: dup + IL_001d: stloc.1 + IL_001e: ldnull + IL_001f: cgt.un + IL_0021: call ""void System.Console.WriteLine(bool)"" + IL_0026: nop + IL_0027: ldloc.0 + IL_0028: stloc.s V_5 + IL_002a: ldloc.s V_5 + IL_002c: stloc.2 + IL_002d: ldloc.2 + IL_002e: brtrue.s IL_0032 + IL_0030: br.s IL_003e + IL_0032: ldloc.2 + IL_0033: isinst ""Derived"" + IL_0038: dup + IL_0039: stloc.3 + IL_003a: brfalse.s IL_003e + IL_003c: br.s IL_0040 + IL_003e: br.s IL_004e + IL_0040: ldloc.3 + IL_0041: stloc.s V_4 + IL_0043: br.s IL_0045 + IL_0045: ldc.i4.1 + IL_0046: call ""void System.Console.WriteLine(bool)"" + IL_004b: nop + IL_004c: br.s IL_004e + IL_004e: ldloc.0 + IL_004f: isinst ""Derived"" + IL_0054: ldnull + IL_0055: cgt.un + IL_0057: call ""void System.Console.WriteLine(bool)"" + IL_005c: nop + IL_005d: ret }"); } } diff --git a/src/Compilers/Shared/GlobalAssemblyCacheHelpers/FusionAssemblyIdentity.cs b/src/Compilers/Shared/GlobalAssemblyCacheHelpers/FusionAssemblyIdentity.cs index e82849b46b5d5..cf345dc91ba4a 100644 --- a/src/Compilers/Shared/GlobalAssemblyCacheHelpers/FusionAssemblyIdentity.cs +++ b/src/Compilers/Shared/GlobalAssemblyCacheHelpers/FusionAssemblyIdentity.cs @@ -441,7 +441,7 @@ internal static IAssemblyName ToAssemblyNameObject(AssemblyName name) throw new ArgumentException(Scripting.ScriptingResources.InvalidCharactersInAssemblyName, nameof(name)); -#elif WORKSPACE_DESKTOP +#elif WORKSPACE_DESKTOP || EDITOR_FEATURES throw new ArgumentException(Microsoft.CodeAnalysis.WorkspaceDesktopResources.Invalid_characters_in_assembly_name, nameof(name)); @@ -471,7 +471,7 @@ internal static IAssemblyName ToAssemblyNameObject(AssemblyName name) throw new ArgumentException(Microsoft.CodeAnalysis.Scripting.ScriptingResources.InvalidCharactersInAssemblyName, nameof(name)); -#elif WORKSPACE_DESKTOP +#elif WORKSPACE_DESKTOP || EDITOR_FEATURES throw new ArgumentException(Microsoft.CodeAnalysis.WorkspaceDesktopResources.Invalid_characters_in_assembly_name, nameof(name)); diff --git a/src/EditorFeatures/CSharpTest/UseInferredMemberName/UseInferredMemberNameTests.cs b/src/EditorFeatures/CSharpTest/UseInferredMemberName/UseInferredMemberNameTests.cs index 97ac6d747e56d..62284e3d5ad4a 100644 --- a/src/EditorFeatures/CSharpTest/UseInferredMemberName/UseInferredMemberNameTests.cs +++ b/src/EditorFeatures/CSharpTest/UseInferredMemberName/UseInferredMemberNameTests.cs @@ -44,6 +44,22 @@ void M() }", parseOptions: s_parseOptions); } + [Fact] + [WorkItem(24480, "https://github.com/dotnet/roslyn/issues/24480")] + public async Task TestInferredTupleName_WithAmbiguity() + { + await TestMissingAsync( +@" +class C +{ + void M() + { + int alice = 1; + (int, int, string) t = ([||]alice: alice, alice, null); + } +}", parameters: new TestParameters(parseOptions: s_parseOptions)); + } + [Fact] public async Task TestInferredTupleNameAfterCommaWithCSharp6() { @@ -124,6 +140,22 @@ void M() }", parseOptions: s_parseOptions); } + [Fact] + [WorkItem(24480, "https://github.com/dotnet/roslyn/issues/24480")] + public async Task TestInferredAnonymousTypeMemberName_WithAmbiguity() + { + await TestMissingAsync( +@" +class C +{ + void M() + { + int alice = 1; + var t = new { [||]alice=alice, alice }; + } +}", parameters: new TestParameters(parseOptions: s_parseOptions)); + } + [Fact] public async Task TestFixAllInferredAnonymousTypeMemberNameWithTrivia() { diff --git a/src/EditorFeatures/Core/EditorFeatures.csproj b/src/EditorFeatures/Core/EditorFeatures.csproj index 64b6357f49107..8bd82310a14ad 100644 --- a/src/EditorFeatures/Core/EditorFeatures.csproj +++ b/src/EditorFeatures/Core/EditorFeatures.csproj @@ -9,6 +9,7 @@ Microsoft.CodeAnalysis.EditorFeatures net46 true + $(DefineConstants);EDITOR_FEATURES @@ -97,6 +98,12 @@ + + + + + + EditorFeaturesResources.resx diff --git a/src/EditorFeatures/Core/Implementation/MetadataAsSource/MetadataAsSourceFileService.cs b/src/EditorFeatures/Core/Implementation/MetadataAsSource/MetadataAsSourceFileService.cs index 231701595ce17..706d6c6032278 100644 --- a/src/EditorFeatures/Core/Implementation/MetadataAsSource/MetadataAsSourceFileService.cs +++ b/src/EditorFeatures/Core/Implementation/MetadataAsSource/MetadataAsSourceFileService.cs @@ -3,8 +3,10 @@ using System; using System.Collections.Generic; using System.ComponentModel.Composition; +using System.Globalization; using System.IO; using System.Linq; +using System.Reflection; using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; @@ -117,7 +119,8 @@ public async Task GetGeneratedFileAsync(Project project, I var useDecompiler = allowDecompilation; if (useDecompiler) { - useDecompiler = !symbol.ContainingAssembly.GetAttributes().Any(attribute => attribute.AttributeClass.Name == nameof(SuppressIldasmAttribute)); + useDecompiler = !symbol.ContainingAssembly.GetAttributes().Any(attribute => attribute.AttributeClass.Name == nameof(SuppressIldasmAttribute) + && attribute.AttributeClass.ToNameDisplayString() == typeof(SuppressIldasmAttribute).FullName); } if (useDecompiler) @@ -194,10 +197,34 @@ private async Task DecompileSymbolAsync(Document temporaryDocument, IS var fullName = GetFullReflectionName(containingOrThis); var compilation = await temporaryDocument.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); - // TODO: retrieve path to actual assembly instead of reference assembly - var reference = compilation.GetMetadataReference(symbol.ContainingAssembly); + + string assemblyLocation = null; + var isReferenceAssembly = symbol.ContainingAssembly.GetAttributes().Any(attribute => attribute.AttributeClass.Name == nameof(ReferenceAssemblyAttribute) + && attribute.AttributeClass.ToNameDisplayString() == typeof(ReferenceAssemblyAttribute).FullName); + if (isReferenceAssembly) + { + try + { + var fullAssemblyName = symbol.ContainingAssembly.Identity.GetDisplayName(); + GlobalAssemblyCache.Instance.ResolvePartialName(fullAssemblyName, out assemblyLocation, preferredCulture: CultureInfo.CurrentCulture); + } + catch (Exception e) when (FatalError.ReportWithoutCrash(e)) + { + } + } + + if (assemblyLocation == null) + { + var reference = compilation.GetMetadataReference(symbol.ContainingAssembly); + assemblyLocation = (reference as PortableExecutableReference)?.FilePath; + if (assemblyLocation == null) + { + throw new NotSupportedException(EditorFeaturesResources.Cannot_navigate_to_the_symbol_under_the_caret); + } + } + // Load the assembly. - var ad = AssemblyDefinition.ReadAssembly(reference.Display, new ReaderParameters() { AssemblyResolver = new RoslynAssemblyResolver(compilation) }); + var ad = AssemblyDefinition.ReadAssembly(assemblyLocation, new ReaderParameters() { AssemblyResolver = new RoslynAssemblyResolver(compilation) }); // Initialize a decompiler with default settings. var decompiler = new CSharpDecompiler(ad.MainModule, new DecompilerSettings()); diff --git a/src/EditorFeatures/Core/Shared/Utilities/ForegroundThreadAffinitizedObject.cs b/src/EditorFeatures/Core/Shared/Utilities/ForegroundThreadAffinitizedObject.cs index b520f24bd2bac..65a0190e345c9 100644 --- a/src/EditorFeatures/Core/Shared/Utilities/ForegroundThreadAffinitizedObject.cs +++ b/src/EditorFeatures/Core/Shared/Utilities/ForegroundThreadAffinitizedObject.cs @@ -32,7 +32,7 @@ internal static ForegroundThreadData CreateDefault(ForegroundThreadDataKind defa { var kind = ForegroundThreadDataInfo.CreateDefault(defaultKind); - return new ForegroundThreadData(Thread.CurrentThread, new SynchronizationContextTaskScheduler(SynchronizationContext.Current), kind); + return new ForegroundThreadData(Thread.CurrentThread, SynchronizationContext.Current == null ? TaskScheduler.Default : new SynchronizationContextTaskScheduler(SynchronizationContext.Current), kind); } } diff --git a/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDUniquenessTest.cs b/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDUniquenessTest.cs new file mode 100644 index 0000000000000..692ed9d9c9b2a --- /dev/null +++ b/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDUniquenessTest.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.CodeAnalysis.Diagnostics; +using Roslyn.Test.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics +{ + public class IDEDiagnosticIDUniquenessTest + { + [Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)] + public void UniqueIDEDiagnosticIds() + { + Type type = typeof(IDEDiagnosticIds); + List listOfIDEDiagnosticIds = type.GetFields().Select(x => x.GetValue(null).ToString()).ToList(); + Assert.Equal(listOfIDEDiagnosticIds.Count, listOfIDEDiagnosticIds.Distinct().Count()); + } + } +} diff --git a/src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs b/src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs index 4e083a44897cd..b1e0cc0e0d70b 100644 --- a/src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs +++ b/src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs @@ -87,7 +87,7 @@ protected async Task TestMissingAsync( using (var workspace = CreateWorkspaceFromOptions(initialMarkup, parameters)) { var actions = await GetCodeActionsAsync(workspace, parameters); - Assert.True(actions.Length == 0); + Assert.True(actions.Length == 0, "An action was offered when none was expected"); } } diff --git a/src/EditorFeatures/VisualBasicTest/UseInferredMemberName/UseInferredMemberNameTests.vb b/src/EditorFeatures/VisualBasicTest/UseInferredMemberName/UseInferredMemberNameTests.vb index 4d2fda9d9f998..975a6144eda19 100644 --- a/src/EditorFeatures/VisualBasicTest/UseInferredMemberName/UseInferredMemberNameTests.vb +++ b/src/EditorFeatures/VisualBasicTest/UseInferredMemberName/UseInferredMemberNameTests.vb @@ -39,6 +39,21 @@ End Class ", parseOptions:=s_parseOptions) End Function + + + Public Async Function TestInferredTupleName_WithAmbiguity() As Task + Await TestMissingAsync( +" +Class C + Sub M() + Dim alice As Integer = 1 + Dim Alice As Integer = 2 + Dim t = ( [||]alice:= alice, Alice) + End Sub +End Class +", parameters:=New TestParameters(s_parseOptions)) + End Function + Public Async Function TestMissingForObjectCreation() As Task @@ -119,6 +134,20 @@ End Class ", parseOptions:=s_parseOptions) End Function + + + Public Async Function TestInferredAnonymousTypeMemberName_WithAmbiguity() As Task + Await TestMissingAsync(" +Class C + Sub M() + Dim alice As Integer = 1 + Dim Alice As Integer = 2 + Dim t = New With {[|.alice =|] alice, Alice} + End Sub +End Class +", parameters:=New TestParameters(s_parseOptions)) + End Function + Public Async Function TestFixAllInferredAnonymousTypeMemberName() As Task Await TestAsync( diff --git a/src/Features/Core/Portable/Diagnostics/Analyzers/IDEDiagnosticIds.cs b/src/Features/Core/Portable/Diagnostics/Analyzers/IDEDiagnosticIds.cs index a659fec4dab3d..0439d77deb54b 100644 --- a/src/Features/Core/Portable/Diagnostics/Analyzers/IDEDiagnosticIds.cs +++ b/src/Features/Core/Portable/Diagnostics/Analyzers/IDEDiagnosticIds.cs @@ -45,7 +45,6 @@ internal static class IDEDiagnosticIds public const string UseExplicitTupleNameDiagnosticId = "IDE0033"; public const string UseDefaultLiteralDiagnosticId = "IDE0034"; - public const string ValidateFormatStringDiagnosticID = "IDE0035"; public const string RemoveUnreachableCodeDiagnosticId = "IDE0035"; @@ -63,6 +62,8 @@ internal static class IDEDiagnosticIds public const string UseDeconstructionDiagnosticId = "IDE0042"; + public const string ValidateFormatStringDiagnosticID = "IDE0043"; + // Analyzer error Ids public const string AnalyzerChangedId = "IDE1001"; public const string AnalyzerDependencyConflictId = "IDE1002"; diff --git a/src/Interactive/EditorFeatures/Core/Completion/GlobalAssemblyCacheCompletionHelper.cs b/src/Interactive/EditorFeatures/Core/Completion/GlobalAssemblyCacheCompletionHelper.cs index d953e32fd35d3..27e0b40313ca6 100644 --- a/src/Interactive/EditorFeatures/Core/Completion/GlobalAssemblyCacheCompletionHelper.cs +++ b/src/Interactive/EditorFeatures/Core/Completion/GlobalAssemblyCacheCompletionHelper.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +extern alias Scripting; using System; using System.Collections.Generic; using System.Collections.Immutable; @@ -9,7 +10,6 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.PooledObjects; -using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.Utilities; using Roslyn.Utilities; @@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis.Editor.Completion.FileSystem internal sealed class GlobalAssemblyCacheCompletionHelper { private static readonly Lazy> s_lazyAssemblySimpleNames = - new Lazy>(() => GlobalAssemblyCache.Instance.GetAssemblySimpleNames().ToList()); + new Lazy>(() => Scripting::Microsoft.CodeAnalysis.GlobalAssemblyCache.Instance.GetAssemblySimpleNames().ToList()); private readonly CompletionItemRules _itemRules; @@ -61,7 +61,7 @@ internal ImmutableArray GetItems(string directoryPath, Cancellat private IEnumerable GetAssemblyIdentities(string partialName) { - return IOUtilities.PerformIO(() => GlobalAssemblyCache.Instance.GetAssemblyIdentities(partialName), + return IOUtilities.PerformIO(() => Scripting::Microsoft.CodeAnalysis.GlobalAssemblyCache.Instance.GetAssemblyIdentities(partialName), SpecializedCollections.EmptyEnumerable()); } } diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpBuild.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpBuild.cs index 35a44579c38fd..b06e6d26c9ed8 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpBuild.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpBuild.cs @@ -38,7 +38,7 @@ static void Main(string[] args) // TODO: Validate build works as expected } - [Fact(Skip = "https://github.com/dotnet/roslyn/issues/18299"), Trait(Traits.Feature, Traits.Features.Build)] + [Fact, Trait(Traits.Feature, Traits.Features.Build)] public void BuildWithCommandLine() { VisualStudio.SolutionExplorer.SaveAll(); diff --git a/src/Workspaces/CSharp/Portable/Simplification/Reducers/CSharpInferredMemberNameReducer.cs b/src/Workspaces/CSharp/Portable/Simplification/Reducers/CSharpInferredMemberNameReducer.cs index 3b684144cde76..f64d96e581ee9 100644 --- a/src/Workspaces/CSharp/Portable/Simplification/Reducers/CSharpInferredMemberNameReducer.cs +++ b/src/Workspaces/CSharp/Portable/Simplification/Reducers/CSharpInferredMemberNameReducer.cs @@ -33,6 +33,11 @@ internal static bool CanSimplifyTupleElementName(ArgumentSyntax node, CSharpPars return false; } + if (RemovalCausesAmbiguity(((TupleExpressionSyntax)node.Parent).Arguments, node)) + { + return false; + } + var inferredName = node.Expression.TryGetInferredMemberName(); if (inferredName == null || inferredName != node.NameColon.Name.Identifier.ValueText) { @@ -49,6 +54,11 @@ internal static bool CanSimplifyAnonymousTypeMemberName(AnonymousObjectMemberDec return false; } + if (RemovalCausesAmbiguity(((AnonymousObjectCreationExpressionSyntax)node.Parent).Initializers, node)) + { + return false; + } + var inferredName = node.Expression.TryGetInferredMemberName(); if (inferredName == null || inferredName != node.NameEquals.Name.Identifier.ValueText) { @@ -57,5 +67,45 @@ internal static bool CanSimplifyAnonymousTypeMemberName(AnonymousObjectMemberDec return true; } + + // An explicit name cannot be removed if some other position would produce it as inferred name + private static bool RemovalCausesAmbiguity(SeparatedSyntaxList arguments, ArgumentSyntax toRemove) + { + string name = toRemove.NameColon.Name.Identifier.ValueText; + foreach (var argument in arguments) + { + if (argument == toRemove) + { + continue; + } + + if (argument.NameColon is null && argument.Expression.TryGetInferredMemberName()?.Equals(name) == true) + { + return true; + } + } + + return false; + } + + // An explicit name cannot be removed if some other position would produce it as inferred name + private static bool RemovalCausesAmbiguity(SeparatedSyntaxList initializers, AnonymousObjectMemberDeclaratorSyntax toRemove) + { + string name = toRemove.NameEquals.Name.Identifier.ValueText; + foreach (var initializer in initializers) + { + if (initializer == toRemove) + { + continue; + } + + if (initializer.NameEquals is null && initializer.Expression.TryGetInferredMemberName()?.Equals(name) == true) + { + return true; + } + } + + return false; + } } } diff --git a/src/Workspaces/VisualBasic/Portable/Simplification/Reducers/VisualBasicInferredMemberNameReducer.vb b/src/Workspaces/VisualBasic/Portable/Simplification/Reducers/VisualBasicInferredMemberNameReducer.vb index 6837b18de1a12..e8686719f2ff5 100644 --- a/src/Workspaces/VisualBasic/Portable/Simplification/Reducers/VisualBasicInferredMemberNameReducer.vb +++ b/src/Workspaces/VisualBasic/Portable/Simplification/Reducers/VisualBasicInferredMemberNameReducer.vb @@ -33,6 +33,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Simplification Return False End If + If RemovalCausesAmbiguity(DirectCast(node.Parent, TupleExpressionSyntax).Arguments, node) Then + Return False + End If + Dim inferredName = node.Expression.TryGetInferredMemberName() If inferredName Is Nothing OrElse Not CaseInsensitiveComparison.Equals(inferredName, node.NameColonEquals.Name.Identifier.ValueText) Then @@ -54,6 +58,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Simplification End Function Friend Shared Function CanSimplifyNamedFieldInitializer(node As NamedFieldInitializerSyntax) As Boolean + If RemovalCausesAmbiguity(DirectCast(node.Parent, ObjectMemberInitializerSyntax).Initializers, node) Then + Return False + End If + Dim inferredName = node.Expression.TryGetInferredMemberName() If inferredName Is Nothing OrElse Not CaseInsensitiveComparison.Equals(inferredName, node.Name.Identifier.ValueText) Then @@ -62,5 +70,40 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Simplification Return True End Function + + ' An explicit name cannot be removed if some other position would produce it as inferred name + Private Shared Function RemovalCausesAmbiguity(arguments As SeparatedSyntaxList(Of SimpleArgumentSyntax), toRemove As SimpleArgumentSyntax) As Boolean + Dim name = toRemove.NameColonEquals.Name.Identifier.ValueText + For Each argument In arguments + + If argument Is toRemove Then + Continue For + End If + + If argument.NameColonEquals Is Nothing AndAlso CaseInsensitiveComparison.Equals(argument.Expression.TryGetInferredMemberName(), name) Then + Return True + End If + Next + + Return False + End Function + + ' An explicit name cannot be removed if some other position would produce it as inferred name + Private Shared Function RemovalCausesAmbiguity(initializers As SeparatedSyntaxList(Of FieldInitializerSyntax), toRemove As NamedFieldInitializerSyntax) As Boolean + Dim name = toRemove.Name.Identifier.ValueText + For Each initializer In initializers + + If initializer Is toRemove Then + Continue For + End If + + Dim inferredInitializer = TryCast(initializer, InferredFieldInitializerSyntax) + If inferredInitializer IsNot Nothing AndAlso CaseInsensitiveComparison.Equals(inferredInitializer.Expression.TryGetInferredMemberName(), name) Then + Return True + End If + Next + + Return False + End Function End Class End Namespace From 7a71038c9aa4b3b67436f66eef85fc8d12d6da16 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Fri, 9 Feb 2018 14:30:47 -0800 Subject: [PATCH 06/43] Call the transaction creationg helper function and move it --- .../Formatting/FormatCommandHandler.TypeChar.cs | 5 ----- .../Core/Implementation/Formatting/FormatCommandHandler.cs | 7 ++++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.TypeChar.cs b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.TypeChar.cs index 4141e4df30e60..c0e38c1dc6ac3 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.TypeChar.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.TypeChar.cs @@ -50,10 +50,5 @@ private bool TryFormat( return true; } - - private CaretPreservingEditTransaction CreateEditTransaction(ITextView view, string description) - { - return new CaretPreservingEditTransaction(description, view, _undoHistoryRegistry, _editorOperationsFactoryService); - } } } diff --git a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs index 120cc30ce0360..278372c5261a1 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs @@ -53,7 +53,7 @@ private void Format(ITextView textView, Document document, TextSpan? selectionOp var formattingService = document.GetLanguageService(); using (Logger.LogBlock(FunctionId.CommandHandler_FormatCommand, KeyValueLogMessage.Create(LogType.UserAction, m => m["Span"] = selectionOpt?.Length ?? -1), cancellationToken)) - using (var transaction = new CaretPreservingEditTransaction(EditorFeaturesResources.Formatting, textView, _undoHistoryRegistry, _editorOperationsFactoryService)) + using (var transaction = CreateEditTransaction(textView, EditorFeaturesResources.Formatting)) { var changes = formattingService.GetFormattingChangesAsync(document, selectionOpt, cancellationToken).WaitAndGetResult(cancellationToken); if (changes.Count == 0) @@ -176,5 +176,10 @@ public void ExecuteReturnOrTypeCommand(EditorCommandArgs args, Action nextHandle // caret has moved to wrong position, move it back to correct position args.TextView.TryMoveCaretToAndEnsureVisible(oldCaretPosition); } + + private CaretPreservingEditTransaction CreateEditTransaction(ITextView view, string description) + { + return new CaretPreservingEditTransaction(description, view, _undoHistoryRegistry, _editorOperationsFactoryService); + } } } From 4df1c5105438698cbfc7d1dc758d413d5c3b1e0f Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Fri, 9 Feb 2018 14:33:20 -0800 Subject: [PATCH 07/43] Move helper out of FormatCommandHandler.TypeChar and into FormatCommandHandler This is where the helper is used, so it makes more sense. --- .../FormatCommandHandler.TypeChar.cs | 22 ------------------- .../Formatting/FormatCommandHandler.cs | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.TypeChar.cs b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.TypeChar.cs index c0e38c1dc6ac3..109a0ba771a74 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.TypeChar.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.TypeChar.cs @@ -28,27 +28,5 @@ private void ExecuteCommand(TypeCharCommandArgs args, Action nextHandler, Cancel { ExecuteReturnOrTypeCommand(args, nextHandler, cancellationToken); } - - private bool TryFormat( - ITextView textView, Document document, IEditorFormattingService formattingService, char typedChar, int position, bool formatOnReturn, CancellationToken cancellationToken) - { - var changes = formatOnReturn - ? formattingService.GetFormattingChangesOnReturnAsync(document, position, cancellationToken).WaitAndGetResult(cancellationToken) - : formattingService.GetFormattingChangesAsync(document, typedChar, position, cancellationToken).WaitAndGetResult(cancellationToken); - - if (changes == null || changes.Count == 0) - { - return false; - } - - using (var transaction = CreateEditTransaction(textView, EditorFeaturesResources.Automatic_Formatting)) - { - transaction.MergePolicy = AutomaticCodeChangeMergePolicy.Instance; - document.Project.Solution.Workspace.ApplyTextChanges(document.Id, changes, cancellationToken); - transaction.Complete(); - } - - return true; - } } } diff --git a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs index 278372c5261a1..6445e9ba3752d 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs @@ -177,6 +177,28 @@ public void ExecuteReturnOrTypeCommand(EditorCommandArgs args, Action nextHandle args.TextView.TryMoveCaretToAndEnsureVisible(oldCaretPosition); } + private bool TryFormat( + ITextView textView, Document document, IEditorFormattingService formattingService, char typedChar, int position, bool formatOnReturn, CancellationToken cancellationToken) + { + var changes = formatOnReturn + ? formattingService.GetFormattingChangesOnReturnAsync(document, position, cancellationToken).WaitAndGetResult(cancellationToken) + : formattingService.GetFormattingChangesAsync(document, typedChar, position, cancellationToken).WaitAndGetResult(cancellationToken); + + if (changes == null || changes.Count == 0) + { + return false; + } + + using (var transaction = CreateEditTransaction(textView, EditorFeaturesResources.Automatic_Formatting)) + { + transaction.MergePolicy = AutomaticCodeChangeMergePolicy.Instance; + document.Project.Solution.Workspace.ApplyTextChanges(document.Id, changes, cancellationToken); + transaction.Complete(); + } + + return true; + } + private CaretPreservingEditTransaction CreateEditTransaction(ITextView view, string description) { return new CaretPreservingEditTransaction(description, view, _undoHistoryRegistry, _editorOperationsFactoryService); From e1fcb5ffd9b762172e4738a61bbc4d8ede174e5a Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Fri, 9 Feb 2018 14:35:32 -0800 Subject: [PATCH 08/43] Don't throw away the cancellation token from FormatCommandHandler.TypeChar --- .../Formatting/FormatCommandHandler.TypeChar.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.TypeChar.cs b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.TypeChar.cs index 109a0ba771a74..cd499a1b02d57 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.TypeChar.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.TypeChar.cs @@ -21,12 +21,7 @@ public VSCommanding.CommandState GetCommandState(TypeCharCommandArgs args, Func< public void ExecuteCommand(TypeCharCommandArgs args, Action nextHandler, CommandExecutionContext context) { - ExecuteCommand(args, nextHandler, CancellationToken.None); - } - - private void ExecuteCommand(TypeCharCommandArgs args, Action nextHandler, CancellationToken cancellationToken) - { - ExecuteReturnOrTypeCommand(args, nextHandler, cancellationToken); + ExecuteReturnOrTypeCommand(args, nextHandler, context.WaitContext.UserCancellationToken); } } } From 396962fba95ae42cc2a236b9570bebdac48da5bf Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Fri, 9 Feb 2018 14:36:07 -0800 Subject: [PATCH 09/43] Clean up ExecuteReturnOrTypeCommand This function called a helper in a really unclean way, and it made stuff hard to follow what is going on. --- .../Formatting/FormatCommandHandler.cs | 61 ++++++++----------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs index 6445e9ba3752d..cadf6f11f79b2 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; using System.Threading; @@ -103,12 +104,6 @@ private static VSCommanding.CommandState GetCommandState(ITextBuffer buffer) public void ExecuteReturnOrTypeCommand(EditorCommandArgs args, Action nextHandler, CancellationToken cancellationToken) { - // This method handles only return / type char - if (!(args is ReturnKeyCommandArgs || args is TypeCharCommandArgs)) - { - return; - } - // run next handler first so that editor has chance to put the return into the buffer first. nextHandler(); @@ -137,24 +132,42 @@ public void ExecuteReturnOrTypeCommand(EditorCommandArgs args, Action nextHandle return; } + IList textChanges; + // save current caret position - var caretPositionMarker = new SnapshotPoint(args.SubjectBuffer.CurrentSnapshot, caretPosition.Value); if (args is ReturnKeyCommandArgs) { - if (!service.SupportsFormatOnReturn || - !TryFormat(textView, document, service, ' ', caretPositionMarker, formatOnReturn: true, cancellationToken: cancellationToken)) + if (!service.SupportsFormatOnReturn) { return; } + + textChanges = service.GetFormattingChangesOnReturnAsync(document, caretPosition.Value, cancellationToken).WaitAndGetResult(cancellationToken); } else if (args is TypeCharCommandArgs typeCharArgs) { - var typedChar = typeCharArgs.TypedChar; - if (!service.SupportsFormattingOnTypedCharacter(document, typedChar) || - !TryFormat(textView, document, service, typedChar, caretPositionMarker, formatOnReturn: false, cancellationToken: cancellationToken)) + if (!service.SupportsFormattingOnTypedCharacter(document, typeCharArgs.TypedChar)) { return; } + + textChanges = service.GetFormattingChangesAsync(document, typeCharArgs.TypedChar, caretPosition.Value, cancellationToken).WaitAndGetResult(cancellationToken); + } + else + { + throw ExceptionUtilities.UnexpectedValue(args); + } + + if (textChanges == null || textChanges.Count == 0) + { + return; + } + + using (var transaction = CreateEditTransaction(textView, EditorFeaturesResources.Automatic_Formatting)) + { + transaction.MergePolicy = AutomaticCodeChangeMergePolicy.Instance; + document.Project.Solution.Workspace.ApplyTextChanges(document.Id, textChanges, cancellationToken); + transaction.Complete(); } // get new caret position after formatting @@ -166,7 +179,7 @@ public void ExecuteReturnOrTypeCommand(EditorCommandArgs args, Action nextHandle var snapshotAfterFormatting = args.SubjectBuffer.CurrentSnapshot; - var oldCaretPosition = caretPositionMarker.TranslateTo(snapshotAfterFormatting, PointTrackingMode.Negative); + var oldCaretPosition = caretPosition.Value.TranslateTo(snapshotAfterFormatting, PointTrackingMode.Negative); var newCaretPosition = newCaretPositionMarker.Value.TranslateTo(snapshotAfterFormatting, PointTrackingMode.Negative); if (oldCaretPosition.Position == newCaretPosition.Position) { @@ -177,28 +190,6 @@ public void ExecuteReturnOrTypeCommand(EditorCommandArgs args, Action nextHandle args.TextView.TryMoveCaretToAndEnsureVisible(oldCaretPosition); } - private bool TryFormat( - ITextView textView, Document document, IEditorFormattingService formattingService, char typedChar, int position, bool formatOnReturn, CancellationToken cancellationToken) - { - var changes = formatOnReturn - ? formattingService.GetFormattingChangesOnReturnAsync(document, position, cancellationToken).WaitAndGetResult(cancellationToken) - : formattingService.GetFormattingChangesAsync(document, typedChar, position, cancellationToken).WaitAndGetResult(cancellationToken); - - if (changes == null || changes.Count == 0) - { - return false; - } - - using (var transaction = CreateEditTransaction(textView, EditorFeaturesResources.Automatic_Formatting)) - { - transaction.MergePolicy = AutomaticCodeChangeMergePolicy.Instance; - document.Project.Solution.Workspace.ApplyTextChanges(document.Id, changes, cancellationToken); - transaction.Complete(); - } - - return true; - } - private CaretPreservingEditTransaction CreateEditTransaction(ITextView view, string description) { return new CaretPreservingEditTransaction(description, view, _undoHistoryRegistry, _editorOperationsFactoryService); From 5ed5b9b32b5e83269ae34c53ae7837056646846c Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Fri, 9 Feb 2018 14:55:38 -0800 Subject: [PATCH 10/43] Remove some silly methods and use a helper in more places --- .../Formatting/FormatCommandHandler.FormatDocument.cs | 7 +------ .../Core/Implementation/Formatting/FormatCommandHandler.cs | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.FormatDocument.cs b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.FormatDocument.cs index 3c3cd17d2476c..cb0ae88f49c39 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.FormatDocument.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.FormatDocument.cs @@ -18,12 +18,7 @@ public VSCommanding.CommandState GetCommandState(FormatDocumentCommandArgs args) public bool ExecuteCommand(FormatDocumentCommandArgs args, CommandExecutionContext context) { - return TryExecuteCommand(args, context); - } - - private bool TryExecuteCommand(FormatDocumentCommandArgs args, CommandExecutionContext context) - { - if (!args.SubjectBuffer.CanApplyChangeDocumentToWorkspace()) + if (!CanExecuteCommand(args.SubjectBuffer)) { return false; } diff --git a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs index cadf6f11f79b2..8b5f00efb98c0 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.cs @@ -109,7 +109,7 @@ public void ExecuteReturnOrTypeCommand(EditorCommandArgs args, Action nextHandle var textView = args.TextView; var subjectBuffer = args.SubjectBuffer; - if (!subjectBuffer.CanApplyChangeDocumentToWorkspace()) + if (!CanExecuteCommand(subjectBuffer)) { return; } From 918bc8e618b4eb53dde75b9467f71826ae541796 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Fri, 9 Feb 2018 14:57:27 -0800 Subject: [PATCH 11/43] Don't throw away the cancellation tokens --- .../Implementation/Formatting/FormatCommandHandler.ReturnKey.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.ReturnKey.cs b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.ReturnKey.cs index a396a0967bba6..adb6b02d19dc8 100644 --- a/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.ReturnKey.cs +++ b/src/EditorFeatures/Core/Implementation/Formatting/FormatCommandHandler.ReturnKey.cs @@ -17,7 +17,7 @@ public VSCommanding.CommandState GetCommandState(ReturnKeyCommandArgs args, Func public void ExecuteCommand(ReturnKeyCommandArgs args, Action nextHandler, CommandExecutionContext context) { - ExecuteReturnOrTypeCommand(args, nextHandler, CancellationToken.None); + ExecuteReturnOrTypeCommand(args, nextHandler, context.WaitContext.UserCancellationToken); } } } From 43988649f63fe19c996d0b51668717a188ad72fe Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Fri, 9 Feb 2018 16:47:06 -0800 Subject: [PATCH 12/43] Remove dependency on Microsoft.VisualStudio.Text.UI.Wpf Microsoft.CodeAnalysis.VisualBasic.EditorFeatures was depending on Microsoft.VisualStudio.Text.UI.Wpf but there are now new APIs to fix this problem. Fixes dotnet/roslyn#23182 --- src/EditorFeatures/VisualBasic/BasicEditorFeatures.vbproj | 1 - .../VisualBasic/LineCommit/CommitConnectionListener.vb | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/EditorFeatures/VisualBasic/BasicEditorFeatures.vbproj b/src/EditorFeatures/VisualBasic/BasicEditorFeatures.vbproj index d85f6f01c9abc..07a4cf9331483 100644 --- a/src/EditorFeatures/VisualBasic/BasicEditorFeatures.vbproj +++ b/src/EditorFeatures/VisualBasic/BasicEditorFeatures.vbproj @@ -32,7 +32,6 @@ - diff --git a/src/EditorFeatures/VisualBasic/LineCommit/CommitConnectionListener.vb b/src/EditorFeatures/VisualBasic/LineCommit/CommitConnectionListener.vb index 8fd9816d9ee22..08d7deefe56cb 100644 --- a/src/EditorFeatures/VisualBasic/LineCommit/CommitConnectionListener.vb +++ b/src/EditorFeatures/VisualBasic/LineCommit/CommitConnectionListener.vb @@ -9,11 +9,11 @@ Imports Microsoft.VisualStudio.Text.Operations Imports Microsoft.VisualStudio.Utilities Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LineCommit - + Friend Class CommitConnectionListener - Implements IWpfTextViewConnectionListener + Implements ITextViewConnectionListener Private ReadOnly _commitBufferManagerFactory As CommitBufferManagerFactory Private ReadOnly _textBufferAssociatedViewService As ITextBufferAssociatedViewService @@ -31,7 +31,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LineCommit _waitIndicator = waitIndicator End Sub - Public Sub SubjectBuffersConnected(view As IWpfTextView, reason As ConnectionReason, subjectBuffers As Collection(Of ITextBuffer)) Implements IWpfTextViewConnectionListener.SubjectBuffersConnected + Public Sub SubjectBuffersConnected(view As ITextView, reason As ConnectionReason, subjectBuffers As IReadOnlyCollection(Of ITextBuffer)) Implements ITextViewConnectionListener.SubjectBuffersConnected ' Make sure we have a view manager view.Properties.GetOrCreateSingletonProperty( Function() New CommitViewManager(view, _commitBufferManagerFactory, _textBufferAssociatedViewService, _textUndoHistoryRegistry, _waitIndicator)) @@ -42,7 +42,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LineCommit Next End Sub - Public Sub SubjectBuffersDisconnected(view As IWpfTextView, reason As ConnectionReason, subjectBuffers As Collection(Of ITextBuffer)) Implements IWpfTextViewConnectionListener.SubjectBuffersDisconnected + Public Sub SubjectBuffersDisconnected(view As ITextView, reason As ConnectionReason, subjectBuffers As IReadOnlyCollection(Of ITextBuffer)) Implements ITextViewConnectionListener.SubjectBuffersDisconnected For Each buffer In subjectBuffers _commitBufferManagerFactory.CreateForBuffer(buffer).RemoveReferencingView() Next From 8643e455c2157cc8c4f0b0d6aaef0501f68a9138 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Fri, 9 Feb 2018 16:47:44 -0800 Subject: [PATCH 13/43] Remove packaging hack This removes a hack that worked around a versioning problem in older Editor packages. We don't need it anymore. --- src/EditorFeatures/Core/EditorFeatures.csproj | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/EditorFeatures/Core/EditorFeatures.csproj b/src/EditorFeatures/Core/EditorFeatures.csproj index 8bd82310a14ad..9155bf64c7a7e 100644 --- a/src/EditorFeatures/Core/EditorFeatures.csproj +++ b/src/EditorFeatures/Core/EditorFeatures.csproj @@ -29,14 +29,6 @@ - - - all - From 4f4da93fce83cb2dc311afb1fa480fb2266838c5 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Tue, 13 Feb 2018 13:58:52 -0800 Subject: [PATCH 14/43] Add reference to tracking bug for package hack --- src/EditorFeatures/CSharpTest/CSharpEditorServicesTest.csproj | 2 +- src/EditorFeatures/Test/EditorServicesTest.csproj | 2 +- src/EditorFeatures/Test2/EditorServicesTest2.vbproj | 2 +- src/EditorFeatures/TestUtilities/ServicesTestUtilities.csproj | 2 +- .../VisualBasicTest/BasicEditorServicesTest.vbproj | 2 +- src/VisualStudio/CSharp/Test/CSharpVisualStudioTest.csproj | 2 +- .../TestUtilities2/VisualStudioTestUtilities2.vbproj | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/CSharpEditorServicesTest.csproj b/src/EditorFeatures/CSharpTest/CSharpEditorServicesTest.csproj index 1dd9d9b7764ca..e2e94adf05645 100644 --- a/src/EditorFeatures/CSharpTest/CSharpEditorServicesTest.csproj +++ b/src/EditorFeatures/CSharpTest/CSharpEditorServicesTest.csproj @@ -64,7 +64,7 @@ + does depend on internal APIs, so we need to a force a reference here. This hack is tracked by https://devdiv.visualstudio.com/DevDiv/_workitems/edit/567115 --> diff --git a/src/EditorFeatures/Test/EditorServicesTest.csproj b/src/EditorFeatures/Test/EditorServicesTest.csproj index a3e314dfb21a5..9ac7b0b2e0761 100644 --- a/src/EditorFeatures/Test/EditorServicesTest.csproj +++ b/src/EditorFeatures/Test/EditorServicesTest.csproj @@ -69,7 +69,7 @@ + does depend on internal APIs, so we need to a force a reference here. This hack is tracked by https://devdiv.visualstudio.com/DevDiv/_workitems/edit/567115 --> diff --git a/src/EditorFeatures/Test2/EditorServicesTest2.vbproj b/src/EditorFeatures/Test2/EditorServicesTest2.vbproj index 7478a62e0bb1e..e41205ce12105 100644 --- a/src/EditorFeatures/Test2/EditorServicesTest2.vbproj +++ b/src/EditorFeatures/Test2/EditorServicesTest2.vbproj @@ -63,7 +63,7 @@ + does depend on internal APIs, so we need to a force a reference here. This hack is tracked by https://devdiv.visualstudio.com/DevDiv/_workitems/edit/567115 --> diff --git a/src/EditorFeatures/TestUtilities/ServicesTestUtilities.csproj b/src/EditorFeatures/TestUtilities/ServicesTestUtilities.csproj index 1e2e0335f7706..39dfd7bcd8a94 100644 --- a/src/EditorFeatures/TestUtilities/ServicesTestUtilities.csproj +++ b/src/EditorFeatures/TestUtilities/ServicesTestUtilities.csproj @@ -52,7 +52,7 @@ + does depend on internal APIs, so we need to a force a reference here. This hack is tracked by https://devdiv.visualstudio.com/DevDiv/_workitems/edit/567115 --> diff --git a/src/EditorFeatures/VisualBasicTest/BasicEditorServicesTest.vbproj b/src/EditorFeatures/VisualBasicTest/BasicEditorServicesTest.vbproj index aea62d2344112..f49c1cdadff94 100644 --- a/src/EditorFeatures/VisualBasicTest/BasicEditorServicesTest.vbproj +++ b/src/EditorFeatures/VisualBasicTest/BasicEditorServicesTest.vbproj @@ -60,7 +60,7 @@ + does depend on internal APIs, so we need to a force a reference here. This hack is tracked by https://devdiv.visualstudio.com/DevDiv/_workitems/edit/567115 --> diff --git a/src/VisualStudio/CSharp/Test/CSharpVisualStudioTest.csproj b/src/VisualStudio/CSharp/Test/CSharpVisualStudioTest.csproj index f74ddcaa5bbfc..f76f499150496 100644 --- a/src/VisualStudio/CSharp/Test/CSharpVisualStudioTest.csproj +++ b/src/VisualStudio/CSharp/Test/CSharpVisualStudioTest.csproj @@ -68,7 +68,7 @@ + does depend on internal APIs, so we need to a force a reference here. This hack is tracked by https://devdiv.visualstudio.com/DevDiv/_workitems/edit/567115 --> diff --git a/src/VisualStudio/TestUtilities2/VisualStudioTestUtilities2.vbproj b/src/VisualStudio/TestUtilities2/VisualStudioTestUtilities2.vbproj index 2bc7cad0f6d3f..5c4062792ba24 100644 --- a/src/VisualStudio/TestUtilities2/VisualStudioTestUtilities2.vbproj +++ b/src/VisualStudio/TestUtilities2/VisualStudioTestUtilities2.vbproj @@ -69,7 +69,7 @@ + does depend on internal APIs, so we need to a force a reference here. This hack is tracked by https://devdiv.visualstudio.com/DevDiv/_workitems/edit/567115 --> From 7d381c87b9b5f0c48830b165b4230304f7768578 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Wed, 14 Feb 2018 13:58:36 -0800 Subject: [PATCH 15/43] Publish only the desired package versions (#24843) Roslyn produces multiple versions of the same package. For product construction, only push those packages we need downstream --- src/Tools/MicroBuild/PublishBlobAssets.proj | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Tools/MicroBuild/PublishBlobAssets.proj b/src/Tools/MicroBuild/PublishBlobAssets.proj index 1218b8454cfec..c4be375eae674 100644 --- a/src/Tools/MicroBuild/PublishBlobAssets.proj +++ b/src/Tools/MicroBuild/PublishBlobAssets.proj @@ -1,22 +1,39 @@ - + + + false + false + - + + + + + + + + Date: Thu, 15 Feb 2018 11:25:40 -0800 Subject: [PATCH 16/43] Redesign active statement handling during debugging (#24428) * Active Statement Handling * Start active statement tracking on background thread * Ensure XAPI is initialized before calling Concord APIs. * Fix up and add comments * Call UninitializeThread in VisualStudioActiveStatementProvider * Fixes * PR feedback * Use dispose pattern for debugger thread initialization * Finish test * PR feedback * Do not track active statements in projects that do not support Roslyn EnC service (e.g. F#) * Update comment. * EnC: Report diagnostics for unexpected recoverable exceptions. * Tweak NFW reporting * Account for workspace changes in ActiveStatementTagger * Unsubscribe event in dispose * Fix initialization of non-remappable regions for unchanged AS in updated method * Keep non-remappable regions from previous edit session if no edits were made. * Update xlfs * Avoid double-free on cancellation * Avoid calling DkmWorkList.Cancel for now * Handle active statement without location --- build/Targets/Packages.props | 5 +- .../Portable/InternalUtilities/FatalError.cs | 37 +- .../EditAndContinue/ActiveStatementTests.cs | 144 ++- .../CSharpEditAndContinueAnalyzerTests.cs | 27 +- .../EditAndContinue/EditSessionTests.cs | 840 ++++++++++++++++++ .../Helpers/DummyLanguageService.cs | 18 + .../EditAndContinue/Helpers/Extensions.cs | 2 +- .../EditAndContinue/ActiveStatementTagger.cs | 56 +- .../ActiveStatementTaggerProvider.cs | 15 +- .../ActiveStatementTrackingService.cs | 203 +++-- .../EditAndContinueDiagnosticUpdateSource.cs | 2 +- ...tion.cs => ActiveStatementsDescription.cs} | 91 +- .../EditAndContinueTestHelpers.cs | 27 +- .../TestActiveStatementTrackingService.cs | 27 +- .../Workspaces/CSharpTestWorkspaceFixture.cs | 2 +- .../Workspaces/TestWorkspace_Create.cs | 13 +- .../EditAndContinue/ActiveStatementTests.vb | 42 +- .../EditAndContinue/Helpers/Extensions.vb | 2 +- ...VisualBasicEditAndContinueAnalyzerTests.vb | 19 +- .../CSharpEditAndContinueAnalyzer.cs | 19 +- .../AbstractEditAndContinueAnalyzer.cs | 144 +-- .../EditAndContinue/ActiveInstructionId.cs | 37 + .../EditAndContinue/ActiveMethodId.cs | 40 + .../EditAndContinue/ActiveStatement.cs | 90 ++ .../ActiveStatementDebugInfo.cs | 59 ++ .../ActiveStatementExceptionRegions.cs | 26 + .../EditAndContinue/ActiveStatementFlags.cs | 20 +- .../EditAndContinue/ActiveStatementId.cs | 6 +- .../EditAndContinue/ActiveStatementSpan.cs | 26 - .../ActiveStatementTextSpan.cs | 14 +- .../EditAndContinue/ActiveStatementsMap.cs | 33 + .../EditAndContinue/DebuggingSession.cs | 7 +- .../Core/Portable/EditAndContinue/Deltas.cs | 25 +- .../DocumentAnalysisResults.cs | 11 +- .../EditAndContinue/EditAndContinueService.cs | 152 +++- .../Portable/EditAndContinue/EditSession.cs | 387 +++++++- .../IActiveStatementProvider.cs | 22 + .../IActiveStatementTrackingService.cs | 2 +- .../IEditAndContinueAnalyzer.cs | 4 +- .../IEditAndContinueService.cs | 11 +- .../LinePositionSpanExtensions.cs | 38 + .../EditAndContinue/NonRemappableRegion.cs | 39 + .../EditAndContinue/ProjectChanges.cs | 30 +- .../VisualBasicEditAndContinueAnalyzer.vb | 11 +- .../DebuggeeModuleMetadataProvider.cs | 13 +- .../EditAndContinue/DebuggerComponent.cs | 41 + .../Interop/ENCPROG_ACTIVE_STATEMENT_REMAP.cs | 20 + .../Interop/ENCPROG_EXCEPTION_RANGE.cs | 18 + .../Interop/IDebugUpdateInMemoryPE.cs | 12 + ...StudioActiveStatementProvider.Utilities.cs | 69 ++ .../VisualStudioActiveStatementProvider.cs | 158 ++++ .../VisualStudioActiveStatementTracker.cs | 31 + .../VisualStudioEditAndContinueService.cs | 4 +- .../VsENCRebuildableProjectImpl.cs | 560 +++++------- .../Core/Def/ServicesVSResources.Designer.cs | 20 +- .../Core/Def/ServicesVSResources.resx | 8 +- .../Core/Def/ServicesVisualStudio.csproj | 1 + .../Core/Def/xlf/ServicesVSResources.cs.xlf | 14 +- .../Core/Def/xlf/ServicesVSResources.de.xlf | 14 +- .../Core/Def/xlf/ServicesVSResources.es.xlf | 14 +- .../Core/Def/xlf/ServicesVSResources.fr.xlf | 14 +- .../Core/Def/xlf/ServicesVSResources.it.xlf | 14 +- .../Core/Def/xlf/ServicesVSResources.ja.xlf | 14 +- .../Core/Def/xlf/ServicesVSResources.ko.xlf | 14 +- .../Core/Def/xlf/ServicesVSResources.pl.xlf | 14 +- .../Def/xlf/ServicesVSResources.pt-BR.xlf | 14 +- .../Core/Def/xlf/ServicesVSResources.ru.xlf | 14 +- .../Core/Def/xlf/ServicesVSResources.tr.xlf | 14 +- .../Def/xlf/ServicesVSResources.zh-Hans.xlf | 14 +- .../Def/xlf/ServicesVSResources.zh-Hant.xlf | 14 +- .../Mocks/DkmActiveStatement.cs | 34 + .../Mocks/DkmClrInstructionAddress.cs | 14 + .../Mocks/DkmClrModuleInstance.cs | 11 + .../EditAndContiue/Mocks/DkmModule.cs | 11 + .../EditAndContiue/Mocks/DkmThread.cs | 11 + ...isualStudioActiveStatementProviderTests.cs | 115 +++ .../Test.Next/VisualStudioTest.Next.csproj | 4 + .../EditAndContinueWorkspaceServiceTests.vb | 21 +- .../TestActiveStatementProvider.vb | 16 + .../VsReadOnlyDocumentTrackerTests.vb | 26 +- .../Utilities/IDictionaryExtensions.cs | 52 -- .../Utilities/PooledBuilderExtensions.cs | 81 ++ 82 files changed, 3361 insertions(+), 997 deletions(-) create mode 100644 src/EditorFeatures/CSharpTest/EditAndContinue/EditSessionTests.cs create mode 100644 src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/DummyLanguageService.cs rename src/EditorFeatures/TestUtilities/EditAndContinue/{ActiveStatementDescription.cs => ActiveStatementsDescription.cs} (69%) create mode 100644 src/Features/Core/Portable/EditAndContinue/ActiveInstructionId.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/ActiveMethodId.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/ActiveStatement.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/ActiveStatementDebugInfo.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/ActiveStatementExceptionRegions.cs delete mode 100644 src/Features/Core/Portable/EditAndContinue/ActiveStatementSpan.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/ActiveStatementsMap.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/IActiveStatementProvider.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/LinePositionSpanExtensions.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/NonRemappableRegion.cs create mode 100644 src/VisualStudio/Core/Def/Implementation/EditAndContinue/DebuggerComponent.cs create mode 100644 src/VisualStudio/Core/Def/Implementation/EditAndContinue/Interop/ENCPROG_ACTIVE_STATEMENT_REMAP.cs create mode 100644 src/VisualStudio/Core/Def/Implementation/EditAndContinue/Interop/ENCPROG_EXCEPTION_RANGE.cs create mode 100644 src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.Utilities.cs create mode 100644 src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.cs create mode 100644 src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementTracker.cs create mode 100644 src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmActiveStatement.cs create mode 100644 src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmClrInstructionAddress.cs create mode 100644 src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmClrModuleInstance.cs create mode 100644 src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmModule.cs create mode 100644 src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmThread.cs create mode 100644 src/VisualStudio/Core/Test.Next/EditAndContiue/VisualStudioActiveStatementProviderTests.cs create mode 100644 src/VisualStudio/Core/Test/EditAndContinue/TestActiveStatementProvider.vb create mode 100644 src/Workspaces/Core/Portable/Utilities/PooledBuilderExtensions.cs diff --git a/build/Targets/Packages.props b/build/Targets/Packages.props index 9aa9a952ba95a..718d25192abc7 100644 --- a/build/Targets/Packages.props +++ b/build/Targets/Packages.props @@ -73,8 +73,9 @@ 15.0.26730-alpha 15.5.23 15.6.281-preview - 15.0.26811-vsucorediag - 15.0.26811-vsucorediag + 15.0.27309-vsucorediag + 15.0.27309-vsucorediag + 15.0.27309-vsucorediag 10.0.30319 1.1.4322 15.0.26730-alpha diff --git a/src/Compilers/Core/Portable/InternalUtilities/FatalError.cs b/src/Compilers/Core/Portable/InternalUtilities/FatalError.cs index 42e17592e1128..806915fc5b018 100644 --- a/src/Compilers/Core/Portable/InternalUtilities/FatalError.cs +++ b/src/Compilers/Core/Portable/InternalUtilities/FatalError.cs @@ -147,13 +147,48 @@ public static bool ReportWithoutCrash(Exception exception) return true; } + /// + /// Report a non-fatal error like but propagates the exception. + /// + /// False to propagate the exception. + [DebuggerHidden] + public static bool ReportWithoutCrashAndPropagate(Exception exception) + { + Report(exception, s_nonFatalHandler); + return false; + } + + private static object s_reportedMarker = new object(); + private static void Report(Exception exception, Action handler) { // hold onto last exception to make investigation easier s_reportedException = exception; s_reportedExceptionMessage = exception.ToString(); - handler?.Invoke(exception); + if (handler == null) + { + return; + } + + // only report exception once + if (exception.Data[s_reportedMarker] != null) + { + return; + } + +#if !NETFX20 + if (exception is AggregateException aggregate && aggregate.InnerExceptions.Count == 1 && aggregate.InnerExceptions[0].Data[s_reportedMarker] != null) + { + return; + } +#endif + if (!exception.Data.IsReadOnly) + { + exception.Data[s_reportedMarker] = s_reportedMarker; + } + + handler.Invoke(exception); } } } diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs index 24efa5f9250f3..3d2b837c31151 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs @@ -6339,7 +6339,7 @@ static void Goo() Diagnostic(RudeEditKind.InsertAroundActiveStatement, "finally", CSharpFeaturesResources.finally_clause)); } - [Fact] + [Fact, WorkItem(23865, "https://github.com/dotnet/roslyn/issues/23865")] public void TryCatchFinally_Regions() { string src1 = @" @@ -6402,6 +6402,103 @@ static void Goo() var edits = GetTopEdits(src1, src2); var active = GetActiveStatements(src1, src2); + // TODO: this is incorrect, we need to report a rude edit: + edits.VerifyRudeDiagnostics(active); + } + + [Fact, WorkItem(23865, "https://github.com/dotnet/roslyn/issues/23865")] + public void TryCatchFinally2_Regions() + { + string src1 = @" +class C +{ + static void Main(string[] args) + { + try + { + try + { + try + { + try + { + Goo(); + } + catch + { + } + } + catch (Exception) + { + } + } + finally + { + } + } + catch (IOException) + { + + } + finally + { + + } + } + + static void Goo() + { + Console.WriteLine(1); + } +}"; + string src2 = @" +class C +{ + static void Main(string[] args) + { + try + { + try + { + try + { + try + { + Goo(); + } + catch + { + + } + } + catch (Exception) + { + } + } + finally + { + } + } + catch (IOException) + { + + } + finally + { + + } + } + + static void Goo() + { + Console.WriteLine(1); + } +} +"; + var edits = GetTopEdits(src1, src2); + var active = GetActiveStatements(src1, src2); + + // TODO: this is incorrect, we need to report a rude edit since an ER span has been changed (empty line added): edits.VerifyRudeDiagnostics(active); } @@ -8882,6 +8979,7 @@ public static void F() Console.WriteLine(2); Console.WriteLine(3); Console.WriteLine(4); + Console.WriteLine(5); } }"; string src2 = @" @@ -8893,24 +8991,27 @@ public static void F() Console.WriteLine(20); Console.WriteLine(30); Console.WriteLine(40); + Console.WriteLine(50); } }"; var edits = GetTopEdits(src1, src2); var active = GetActiveStatements(src1, src2); - active.OldSpans[0] = new ActiveStatementSpan(ActiveStatementFlags.PartiallyExecuted | ActiveStatementFlags.LeafFrame, active.OldSpans[0].Span); - active.OldSpans[1] = new ActiveStatementSpan(ActiveStatementFlags.PartiallyExecuted, active.OldSpans[1].Span); - active.OldSpans[2] = new ActiveStatementSpan(ActiveStatementFlags.LeafFrame, active.OldSpans[2].Span); - active.OldSpans[3] = new ActiveStatementSpan(ActiveStatementFlags.None, active.OldSpans[3].Span); + active.OldStatements[0] = active.OldStatements[0].WithFlags(ActiveStatementFlags.PartiallyExecuted | ActiveStatementFlags.IsLeafFrame); + active.OldStatements[1] = active.OldStatements[1].WithFlags(ActiveStatementFlags.PartiallyExecuted | ActiveStatementFlags.IsNonLeafFrame); + active.OldStatements[2] = active.OldStatements[2].WithFlags(ActiveStatementFlags.IsLeafFrame); + active.OldStatements[3] = active.OldStatements[3].WithFlags(ActiveStatementFlags.IsNonLeafFrame); + active.OldStatements[4] = active.OldStatements[4].WithFlags(ActiveStatementFlags.IsNonLeafFrame | ActiveStatementFlags.IsLeafFrame); edits.VerifyRudeDiagnostics(active, Diagnostic(RudeEditKind.PartiallyExecutedActiveStatementUpdate, "Console.WriteLine(10);"), Diagnostic(RudeEditKind.ActiveStatementUpdate, "Console.WriteLine(20);"), - Diagnostic(RudeEditKind.ActiveStatementUpdate, "Console.WriteLine(40);")); + Diagnostic(RudeEditKind.ActiveStatementUpdate, "Console.WriteLine(40);"), + Diagnostic(RudeEditKind.ActiveStatementUpdate, "Console.WriteLine(50);")); } [Fact] - public void PartiallyExecutedActiveStatement_Deleted() + public void PartiallyExecutedActiveStatement_Deleted1() { string src1 = @" class C @@ -8930,12 +9031,39 @@ public static void F() var edits = GetTopEdits(src1, src2); var active = GetActiveStatements(src1, src2); - active.OldSpans[0] = new ActiveStatementSpan(ActiveStatementFlags.PartiallyExecuted | ActiveStatementFlags.LeafFrame, active.OldSpans[0].Span); + active.OldStatements[0] = active.OldStatements[0].WithFlags(ActiveStatementFlags.PartiallyExecuted | ActiveStatementFlags.IsLeafFrame); edits.VerifyRudeDiagnostics(active, Diagnostic(RudeEditKind.PartiallyExecutedActiveStatementDelete, "{")); } + [Fact] + public void PartiallyExecutedActiveStatement_Deleted2() + { + string src1 = @" +class C +{ + public static void F() + { + Console.WriteLine(1); + } +}"; + string src2 = @" +class C +{ + public static void F() + { + } +}"; + var edits = GetTopEdits(src1, src2); + var active = GetActiveStatements(src1, src2); + + active.OldStatements[0] = active.OldStatements[0].WithFlags(ActiveStatementFlags.IsNonLeafFrame | ActiveStatementFlags.IsLeafFrame); + + edits.VerifyRudeDiagnostics(active, + Diagnostic(RudeEditKind.DeleteActiveStatement, "{")); + } + #endregion } } diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/CSharpEditAndContinueAnalyzerTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/CSharpEditAndContinueAnalyzerTests.cs index 2d0faa1dfb214..e599c97e9646b 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/CSharpEditAndContinueAnalyzerTests.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/CSharpEditAndContinueAnalyzerTests.cs @@ -9,6 +9,7 @@ using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Differencing; using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.UnitTests; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Text; using Roslyn.Test.Utilities; @@ -272,14 +273,14 @@ public static void Main() var oldStatementSpan = oldText.Lines.GetLinePositionSpan(oldStatementTextSpan); var oldStatementSyntax = oldSyntaxRoot.FindNode(oldStatementTextSpan); - var baseActiveStatements = ImmutableArray.Create(new ActiveStatementSpan(ActiveStatementFlags.LeafFrame, oldStatementSpan)); - var result = await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newDocument, default(CancellationToken)); + var baseActiveStatements = ImmutableArray.Create(ActiveStatementsDescription.CreateActiveStatement(ActiveStatementFlags.IsLeafFrame, oldStatementSpan, DocumentId.CreateNewId(ProjectId.CreateNewId()))); + var result = await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newDocument, CancellationToken.None); Assert.True(result.HasChanges); Assert.True(result.SemanticEdits[0].PreserveLocalVariables); var syntaxMap = result.SemanticEdits[0].SyntaxMap; - var newStatementSpan = result.ActiveStatements[0]; + var newStatementSpan = result.ActiveStatements[0].Span; var newStatementTextSpan = newText.Lines.GetTextSpan(newStatementSpan); var newStatementSyntax = newSyntaxRoot.FindNode(newStatementTextSpan); @@ -317,7 +318,7 @@ public static void Main() var oldSolution = workspace.CurrentSolution; var newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2)); - var baseActiveStatements = ImmutableArray.Create(); + var baseActiveStatements = ImmutableArray.Create(); var result = await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newSolution.GetDocument(documentId), default(CancellationToken)); Assert.True(result.HasChanges); @@ -343,7 +344,7 @@ public static void Main() using (var workspace = TestWorkspace.CreateCSharp(source)) { var document = workspace.CurrentSolution.Projects.First().Documents.First(); - var baseActiveStatements = ImmutableArray.Create(); + var baseActiveStatements = ImmutableArray.Create(); var result = await analyzer.AnalyzeDocumentAsync(workspace.CurrentSolution, baseActiveStatements, document, default(CancellationToken)); Assert.False(result.HasChanges); @@ -381,7 +382,7 @@ public static void Main() var oldSolution = workspace.CurrentSolution; var newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2)); - var baseActiveStatements = ImmutableArray.Create(); + var baseActiveStatements = ImmutableArray.Create(); var result = await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newSolution.GetDocument(documentId), default(CancellationToken)); Assert.False(result.HasChanges); @@ -410,7 +411,7 @@ public static void Main() source, parseOptions: experimental, compilationOptions: null, exportProvider: null)) { var document = workspace.CurrentSolution.Projects.First().Documents.First(); - var baseActiveStatements = ImmutableArray.Create(); + var baseActiveStatements = ImmutableArray.Create(); var result = await analyzer.AnalyzeDocumentAsync(workspace.CurrentSolution, baseActiveStatements, document, default(CancellationToken)); Assert.False(result.HasChanges); @@ -458,7 +459,7 @@ public static void Main() var oldSolution = workspace.CurrentSolution; var newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2)); - var baseActiveStatements = ImmutableArray.Create(); + var baseActiveStatements = ImmutableArray.Create(); var result = await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newSolution.GetDocument(documentId), default(CancellationToken)); Assert.True(result.HasChanges); @@ -487,7 +488,7 @@ public static void Main() using (var workspace = TestWorkspace.CreateCSharp(source)) { var document = workspace.CurrentSolution.Projects.First().Documents.First(); - var baseActiveStatements = ImmutableArray.Create(); + var baseActiveStatements = ImmutableArray.Create(); var result = await analyzer.AnalyzeDocumentAsync(workspace.CurrentSolution, baseActiveStatements, document, default(CancellationToken)); Assert.False(result.HasChanges); @@ -527,7 +528,7 @@ public static void Main() var oldSolution = workspace.CurrentSolution; var newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2)); - var baseActiveStatements = ImmutableArray.Create(); + var baseActiveStatements = ImmutableArray.Create(); var result = await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newSolution.GetDocument(documentId), default(CancellationToken)); Assert.True(result.HasChanges); @@ -567,7 +568,7 @@ public static void Main(Bar x) var oldSolution = workspace.CurrentSolution; var newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2)); - var baseActiveStatements = ImmutableArray.Create(); + var baseActiveStatements = ImmutableArray.Create(); var result = await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newSolution.GetDocument(documentId), default(CancellationToken)); Assert.True(result.HasChanges); @@ -620,7 +621,7 @@ public class D var changedDocuments = changes.GetChangedDocuments().Concat(changes.GetAddedDocuments()); var result = new List(); - var baseActiveStatements = ImmutableArray.Create(); + var baseActiveStatements = ImmutableArray.Create(); foreach (var changedDocumentId in changedDocuments) { result.Add(await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newProject.GetDocument(changedDocumentId), default(CancellationToken))); @@ -670,7 +671,7 @@ public static void Main() var changedDocuments = changes.GetChangedDocuments().Concat(changes.GetAddedDocuments()); var result = new List(); - var baseActiveStatements = ImmutableArray.Create(); + var baseActiveStatements = ImmutableArray.Create(); foreach (var changedDocumentId in changedDocuments) { result.Add(await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newProject.GetDocument(changedDocumentId), default(CancellationToken))); diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/EditSessionTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/EditSessionTests.cs new file mode 100644 index 0000000000000..8f60ce9620a89 --- /dev/null +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/EditSessionTests.cs @@ -0,0 +1,840 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.UnitTests; +using Microsoft.CodeAnalysis.Editor.UnitTests; +using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; +using Microsoft.CodeAnalysis.Text; +using Roslyn.Test.Utilities; +using Roslyn.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests +{ + public class EditSessionTests : TestBase + { + internal sealed class TestActiveStatementProvider : IActiveStatementProvider + { + private readonly ImmutableArray _infos; + + public TestActiveStatementProvider(ImmutableArray infos) + => _infos = infos; + + public Task> GetActiveStatementsAsync(CancellationToken cancellationToken) + => Task.FromResult(_infos); + } + + internal static ImmutableArray GetActiveStatementDebugInfos( + string[] markedSources, + string extension = ".cs", + int[] methodRowIds = null, + Guid[] modules = null, + int[] methodVersions = null, + int[] ilOffsets = null, + ActiveStatementFlags[] flags = null, + ImmutableArray[] threads = null) + { + IEnumerable<(TextSpan Span, int Id, SourceText Text, string DocumentName, DocumentId DocumentId)> EnumerateAllSpans() + { + int sourceIndex = 0; + foreach (var markedSource in markedSources) + { + var documentName = TestWorkspace.GetDefaultTestSourceDocumentName(sourceIndex, extension); + var documentId = DocumentId.CreateNewId(ProjectId.CreateNewId(), documentName); + var text = SourceText.From(markedSource); + + foreach (var (span, id) in ActiveStatementsDescription.GetActiveSpans(markedSource)) + { + yield return (span, id, text, documentName, documentId); + } + + sourceIndex++; + } + } + + IEnumerable Enumerate() + { + var moduleId = new Guid("00000000-0000-0000-0000-000000000001"); + var threadId = new Guid("00000000-0000-0000-0000-000000000010"); + + int index = 0; + foreach (var (span, id, text, documentName, documentId) in EnumerateAllSpans().OrderBy(s => s.Id)) + { + yield return new ActiveStatementDebugInfo( + new ActiveInstructionId( + (modules != null) ? modules[index] : moduleId, + methodToken: 0x06000000 | (methodRowIds != null ? methodRowIds[index] : index + 1), + methodVersion: (methodVersions != null) ? methodVersions[index] : 1, + ilOffset: (ilOffsets != null) ? ilOffsets[index] : 0), + documentNameOpt: documentName, + linePositionSpan: text.Lines.GetLinePositionSpan(span), + threadIds: (threads != null) ? threads[index] : ImmutableArray.Create(threadId), + flags: (flags != null) ? flags[index] : ((id == 0 ? ActiveStatementFlags.IsLeafFrame : ActiveStatementFlags.IsNonLeafFrame) | ActiveStatementFlags.MethodUpToDate)); + + index++; + } + } + + return Enumerate().ToImmutableArray(); + } + + internal static async Task<(ActiveStatementsMap, ImmutableArray, ImmutableArray)> GetBaseActiveStatementsAndExceptionRegions( + string[] markedSource, + ImmutableArray activeStatements, + ImmutableDictionary> nonRemappableRegions = null, + Func adjustSolution = null) + { + var exportProvider = MinimalTestExportProvider.CreateExportProvider( + TestExportProvider.MinimumCatalogWithCSharpAndVisualBasic.WithPart(typeof(CSharpEditAndContinueAnalyzer)).WithPart(typeof(DummyLanguageService))); + + using (var workspace = TestWorkspace.CreateCSharp( + ActiveStatementsDescription.ClearTags(markedSource), + exportProvider: exportProvider)) + { + var baseSolution = workspace.CurrentSolution; + if (adjustSolution != null) + { + baseSolution = adjustSolution(baseSolution); + } + + var docsIds = from p in baseSolution.Projects + from d in p.DocumentIds + select d; + + var debuggingSession = new DebuggingSession(baseSolution); + var activeStatementProvider = new TestActiveStatementProvider(activeStatements); + + var editSession = new EditSession( + baseSolution, + debuggingSession, + activeStatementProvider, + ImmutableDictionary.Empty, + nonRemappableRegions ?? ImmutableDictionary>.Empty, + stoppedAtException: false); + + return (await editSession.BaseActiveStatements.GetValueAsync(CancellationToken.None).ConfigureAwait(false), + await editSession.BaseActiveExceptionRegions.GetValueAsync(CancellationToken.None).ConfigureAwait(false), + docsIds.ToImmutableArray()); + } + } + + private static string Delete(string src, string marker) + { + while (true) + { + string startStr = "/*delete" + marker; + string endStr = "*/"; + int start = src.IndexOf(startStr); + if (start == -1) + { + return src; + } + + int end = src.IndexOf(endStr, start + startStr.Length) + endStr.Length; + src = src.Substring(0, start) + src.Substring(end); + } + } + + private static string Insert(string src, string marker) + { + while (true) + { + string startStr = "/*insert" + marker + "["; + string endStr = "*/"; + + int start = src.IndexOf(startStr); + if (start == -1) + { + return src; + } + + int startOfLineCount = start + startStr.Length; + int endOfLineCount = src.IndexOf(']', startOfLineCount); + int lineCount = int.Parse(src.Substring(startOfLineCount, endOfLineCount - startOfLineCount)); + + var end = src.IndexOf(endStr, endOfLineCount) + endStr.Length; + + src = src.Substring(0, start) + string.Join("", Enumerable.Repeat(Environment.NewLine, lineCount)) + src.Substring(end); + } + } + + private static string Update(string src, string marker) + => Insert(Delete(src, marker), marker); + + private static string InspectActiveStatement(ActiveStatement statement) + => $"{statement.Ordinal}: {statement.Span} flags=[{statement.Flags}] pdid={statement.PrimaryDocumentId.DebugName} docs=[{string.Join(",", statement.DocumentIds.Select(d => d.DebugName))}]"; + + private static string InspectActiveStatementAndInstruction(ActiveStatement statement) + => InspectActiveStatement(statement) + " " + statement.InstructionId.GetDebuggerDisplay(); + + private static string InspectActiveStatementAndInstruction(ActiveStatement statement, SourceText text) + => InspectActiveStatementAndInstruction(statement) + $" '{GetFirstLineText(statement.Span, text)}'"; + + private static string GetFirstLineText(LinePositionSpan span, SourceText text) + => text.Lines[span.Start.Line].ToString().Trim(); + + [Fact] + public async Task BaseActiveStatementsAndExceptionRegions1() + { + var markedSource = new[] + { +@"class Test1 +{ + static void M1() + { + try { } finally { F1(); } + } + + static void F1() + { + Console.WriteLine(1); + } +}", +@"class Test2 +{ + static void M2() + { + try + { + try + { + F2(); + } + catch (Exception1 e1) + { + } + } + catch (Exception2 e2) + { + } + } + + static void F2() + { + Test1.M1() + } + + static void Main() + { + try { M2(); } finally { } + } +} +" + }; + + var module1 = new Guid("11111111-1111-1111-1111-111111111111"); + var module2 = new Guid("22222222-2222-2222-2222-222222222222"); + + var activeStatements = GetActiveStatementDebugInfos(markedSource, + methodRowIds: new[] { 1, 2, 3, 4, 5 }, + ilOffsets: new[] { 1, 1, 1, 2, 3 }, + modules: new[] { module1, module1, module2, module2, module2 }); + + // add an extra active statement that has no location, it should be ignored: + activeStatements = activeStatements.Add( + new ActiveStatementDebugInfo( + new ActiveInstructionId(moduleId: Guid.NewGuid(), methodToken: 0x06000005, methodVersion: 1, ilOffset: 10), + documentNameOpt: null, + linePositionSpan: default, + threadIds: ImmutableArray.Create(Guid.NewGuid()), + ActiveStatementFlags.IsNonLeafFrame)); + + // add an extra active statement from project not belonging to the solution, it should be ignored: + activeStatements = activeStatements.Add( + new ActiveStatementDebugInfo( + new ActiveInstructionId(moduleId: Guid.NewGuid(), methodToken: 0x06000005, methodVersion: 1, ilOffset: 10), + "NonRoslynDocument.mcpp", + new LinePositionSpan(new LinePosition(1, 1), new LinePosition(1, 10)), + threadIds: ImmutableArray.Create(Guid.NewGuid()), + ActiveStatementFlags.IsNonLeafFrame)); + + // Add an extra active statement from language that doesn't support Roslyn EnC should be ignored: + // See https://github.com/dotnet/roslyn/issues/24408 for test scenario. + activeStatements = activeStatements.Add( + new ActiveStatementDebugInfo( + new ActiveInstructionId(moduleId: Guid.NewGuid(), methodToken: 0x06000005, methodVersion: 1, ilOffset: 10), + "a.dummy", + new LinePositionSpan(new LinePosition(1, 1), new LinePosition(1, 10)), + threadIds: ImmutableArray.Create(Guid.NewGuid()), + ActiveStatementFlags.IsNonLeafFrame)); + + var adjustSolution = new Func(solution => + { + var project = solution.AddProject("dummy_proj", "dummy_proj", DummyLanguageService.LanguageName); + return project.Solution.AddDocument(DocumentId.CreateNewId(project.Id, DummyLanguageService.LanguageName), "a.dummy", ""); + }); + + var (baseActiveStatements, baseExceptionRegions, docs) = await GetBaseActiveStatementsAndExceptionRegions(markedSource, activeStatements, adjustSolution: adjustSolution).ConfigureAwait(false); + + // Active Statements + + var statements = baseActiveStatements.InstructionMap.Values.OrderBy(v => v.Ordinal).ToArray(); + AssertEx.Equal(new[] + { + "0: (9,14)-(9,35) flags=[IsLeafFrame, MethodUpToDate] pdid=test1.cs docs=[test1.cs] mvid=11111111-1111-1111-1111-111111111111 0x06000001 v1 IL_0001", + "1: (4,32)-(4,37) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test1.cs docs=[test1.cs] mvid=11111111-1111-1111-1111-111111111111 0x06000002 v1 IL_0001", + "2: (21,14)-(21,24) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test2.cs docs=[test2.cs] mvid=22222222-2222-2222-2222-222222222222 0x06000003 v1 IL_0001", + "3: (8,20)-(8,25) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test2.cs docs=[test2.cs] mvid=22222222-2222-2222-2222-222222222222 0x06000004 v1 IL_0002", + "4: (26,20)-(26,25) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test2.cs docs=[test2.cs] mvid=22222222-2222-2222-2222-222222222222 0x06000005 v1 IL_0003" + }, statements.Select(InspectActiveStatementAndInstruction)); + + // Active Statements per document + + Assert.Equal(2, baseActiveStatements.DocumentMap.Count); + + AssertEx.Equal(new[] + { + "0: (9,14)-(9,35) flags=[IsLeafFrame, MethodUpToDate] pdid=test1.cs docs=[test1.cs]", + "1: (4,32)-(4,37) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test1.cs docs=[test1.cs]" + }, baseActiveStatements.DocumentMap[docs[0]].Select(InspectActiveStatement)); + + AssertEx.Equal(new[] + { + "2: (21,14)-(21,24) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test2.cs docs=[test2.cs]", + "3: (8,20)-(8,25) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test2.cs docs=[test2.cs]", + "4: (26,20)-(26,25) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test2.cs docs=[test2.cs]" + }, baseActiveStatements.DocumentMap[docs[1]].Select(InspectActiveStatement)); + + // Exception Regions + + AssertEx.Equal(new[] + { + "[]", + "[(4,8)-(4,46)]", + "[]", + "[(14,8)-(16,9),(10,10)-(12,11)]", + "[(26,35)-(26,46)]" + }, baseExceptionRegions.Select(r => "[" + string.Join(",", r.Spans) + "]")); + + // GetActiveStatementAndExceptionRegionSpans + + // Assume 2 updates in Project2: + // Test2.M2: adding a line in front of try-catch. + // Test2.F2: moving the entire method 2 lines down. + + LinePositionSpan AddDelta(LinePositionSpan span, int lineDelta) + => new LinePositionSpan(new LinePosition(span.Start.Line + lineDelta, span.Start.Character), new LinePosition(span.End.Line + lineDelta, span.End.Character)); + + var newActiveStatementsInChangedDocuments = ImmutableArray.Create( + ( + docs[1], + + ImmutableArray.Create( + statements[2].WithSpan(AddDelta(statements[2].Span, +2)), + statements[3].WithSpan(AddDelta(statements[3].Span, +1)), + statements[4]), + + ImmutableArray.Create( + baseExceptionRegions[2].Spans, + baseExceptionRegions[3].Spans.SelectAsArray(es => AddDelta(es, +1)), + baseExceptionRegions[4].Spans) + ) + ); + + EditSession.GetActiveStatementAndExceptionRegionSpans( + module2, + baseActiveStatements, + baseExceptionRegions, + updatedMethodTokens: new[] { 0x06000004 }, // contains only recompiled methods in the project we are interested in (module2) + ImmutableDictionary>.Empty, + newActiveStatementsInChangedDocuments, + out var activeStatementsInUpdatedMethods, + out var nonRemappableRegions); + + AssertEx.Equal(new[] + { + "mvid=22222222-2222-2222-2222-222222222222 0x06000004 v1 | AS (8,20)-(8,25) δ=1", + "mvid=22222222-2222-2222-2222-222222222222 0x06000004 v1 | ER (14,8)-(16,9) δ=1", + "mvid=22222222-2222-2222-2222-222222222222 0x06000004 v1 | ER (10,10)-(12,11) δ=1" + }, nonRemappableRegions.Select(r => $"{r.Method.GetDebuggerDisplay()} | {r.Region.GetDebuggerDisplay()}")); + + AssertEx.Equal(new[] + { + "thread=00000000-0000-0000-0000-000000000010 mvid=22222222-2222-2222-2222-222222222222 0x06000004 v1 IL_0002: (9,20)-(9,25)" + }, activeStatementsInUpdatedMethods.Select(v => $"thread={v.ThreadId} {v.OldInstructionId.GetDebuggerDisplay()}: {v.NewSpan}")); + } + + [Fact, WorkItem(24439, "https://github.com/dotnet/roslyn/issues/24439")] + public async Task BaseActiveStatementsAndExceptionRegions2() + { + var baseSource = +@"class Test +{ + static void F1() + { + try + { + F2(); + } + catch (Exception) { + Console.WriteLine(1); + Console.WriteLine(2); + Console.WriteLine(3); + } + /*insert1[1]*/ + } + + static void F2() + { + throw new Exception(); + } +}"; + var updatedSource = Update(baseSource, "1"); + + var module1 = new Guid("11111111-1111-1111-1111-111111111111"); + var baseText = SourceText.From(baseSource); + var updatedText = SourceText.From(updatedSource); + + var baseActiveStatementInfos = GetActiveStatementDebugInfos(new[] { baseSource }, + modules: new[] { module1, module1 }, + methodVersions: new[] { 1, 1 }, + flags: new[] + { + ActiveStatementFlags.MethodUpToDate | ActiveStatementFlags.IsNonLeafFrame, // F1 + ActiveStatementFlags.MethodUpToDate | ActiveStatementFlags.IsLeafFrame, // F2 + }); + + var (baseActiveStatementMap, baseExceptionRegions, docs) = await GetBaseActiveStatementsAndExceptionRegions(new[] { baseSource }, baseActiveStatementInfos).ConfigureAwait(false); + + // Active Statements + + var baseActiveStatements = baseActiveStatementMap.InstructionMap.Values.OrderBy(v => v.Ordinal).ToArray(); + + AssertEx.Equal(new[] + { + "0: (6,18)-(6,23) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test1.cs docs=[test1.cs] mvid=11111111-1111-1111-1111-111111111111 0x06000001 v1 IL_0000 'F2();'", + "1: (18,14)-(18,36) flags=[IsLeafFrame, MethodUpToDate] pdid=test1.cs docs=[test1.cs] mvid=11111111-1111-1111-1111-111111111111 0x06000002 v1 IL_0000 'throw new Exception();'" + }, baseActiveStatements.Select(s => InspectActiveStatementAndInstruction(s, baseText))); + + // Exception Regions + + // Note that the spans correspond to the base snapshot (V2). + AssertEx.Equal(new[] + { + "[(8,8)-(12,9) 'catch (Exception) {']", + "[]", + }, baseExceptionRegions.Select(r => "[" + string.Join(", ", r.Spans.Select(s => $"{s} '{GetFirstLineText(s, baseText)}'")) + "]")); + + // GetActiveStatementAndExceptionRegionSpans + + var newActiveStatementsInChangedDocuments = ImmutableArray.Create( + ( + docs[0], + + ImmutableArray.Create( + baseActiveStatements[0], + baseActiveStatements[1].WithSpan(baseActiveStatements[1].Span.AddLineDelta(+1))), + + ImmutableArray.Create( + baseExceptionRegions[0].Spans, + baseExceptionRegions[1].Spans) + ) + ); + + EditSession.GetActiveStatementAndExceptionRegionSpans( + module1, + baseActiveStatementMap, + baseExceptionRegions, + updatedMethodTokens: new[] { 0x06000001 }, // F1 + ImmutableDictionary>.Empty, + newActiveStatementsInChangedDocuments, + out var activeStatementsInUpdatedMethods, + out var nonRemappableRegions); + + // although the span has not changed the method has, so we need to add corresponding non-remappable regions + AssertEx.Equal(new[] + { + "mvid=11111111-1111-1111-1111-111111111111 0x06000001 v1 | AS (6,18)-(6,23) δ=0", + "mvid=11111111-1111-1111-1111-111111111111 0x06000001 v1 | ER (8,8)-(12,9) δ=0", + }, nonRemappableRegions.OrderBy(r => r.Region.Span.Start.Line).Select(r => $"{r.Method.GetDebuggerDisplay()} | {r.Region.GetDebuggerDisplay()}")); + + AssertEx.Equal(new[] + { + "thread=00000000-0000-0000-0000-000000000010 mvid=11111111-1111-1111-1111-111111111111 0x06000001 v1 IL_0000: (6,18)-(6,23) 'F2();'" + }, activeStatementsInUpdatedMethods.Select(v => $"thread={v.ThreadId} {v.OldInstructionId.GetDebuggerDisplay()}: {v.NewSpan} '{GetFirstLineText(v.NewSpan, updatedText)}'")); + } + + [Fact] + public async Task BaseActiveStatementsAndExceptionRegions_WithInitialNonRemappableRegions() + { + var markedSourceV1 = +@"class Test +{ + static void F1() + { + try + { + M(); + } + catch + { + } + } + + static void F2() + { /*delete2 + */try + { + } + catch + { + M(); + }/*insert2[1]*/ + } + + static void F3() + { + try + { + try + { /*delete1 + */M();/*insert1[3]*/ + } + finally + { + } + } + catch + { + } +/*delete1 + +*/ } + + static void F4() + { /*insert1[1]*//*insert2[2]*/ + try + { + try + { + } + catch + { + M(); + } + } + catch + { + } + } +}"; + var markedSourceV2 = Update(markedSourceV1, "1"); + var markedSourceV3 = Update(markedSourceV2, "2"); + + var module1 = new Guid("11111111-1111-1111-1111-111111111111"); + var sourceTextV1 = SourceText.From(markedSourceV1); + var sourceTextV2 = SourceText.From(markedSourceV2); + var sourceTextV3 = SourceText.From(markedSourceV3); + + var activeStatementsPreRemap = GetActiveStatementDebugInfos(new[] { markedSourceV1 }, + modules: new[] { module1, module1, module1, module1 }, + methodVersions: new[] { 2, 2, 1, 1 }, // method F3 and F4 were not remapped + flags: new[] + { + ActiveStatementFlags.MethodUpToDate | ActiveStatementFlags.IsNonLeafFrame, // F1 + ActiveStatementFlags.MethodUpToDate | ActiveStatementFlags.IsNonLeafFrame, // F2 + ActiveStatementFlags.None | ActiveStatementFlags.IsNonLeafFrame, // F3 + ActiveStatementFlags.None | ActiveStatementFlags.IsNonLeafFrame, // F4 + }); + + var exceptionSpans = ActiveStatementsDescription.GetExceptionRegions(markedSourceV1, activeStatementsPreRemap.Length); + + var spanPreRemap2 = activeStatementsPreRemap[2].LinePositionSpan; + var erPreRemap20 = sourceTextV1.Lines.GetLinePositionSpan(exceptionSpans[2][0]); + var erPreRemap21 = sourceTextV1.Lines.GetLinePositionSpan(exceptionSpans[2][1]); + var spanPreRemap3 = activeStatementsPreRemap[3].LinePositionSpan; + var erPreRemap30 = sourceTextV1.Lines.GetLinePositionSpan(exceptionSpans[3][0]); + var erPreRemap31 = sourceTextV1.Lines.GetLinePositionSpan(exceptionSpans[3][1]); + + // Assume that the following edits have been made to F3 and F4 and set up non-remappable regions mapping + // from the pre-remap spans of AS:2 and AS:3 to their current location. + var initialNonRemappableRegions = new Dictionary> + { + { new ActiveMethodId(module1, 0x06000003, 1), ImmutableArray.Create( + // move AS:2 one line up: + new NonRemappableRegion(spanPreRemap2, lineDelta: -1, isExceptionRegion: false), + // move ER:2.0 and ER:2.1 two lines down: + new NonRemappableRegion(erPreRemap20, lineDelta: +2, isExceptionRegion: true), + new NonRemappableRegion(erPreRemap21, lineDelta: +2, isExceptionRegion: true)) }, + { new ActiveMethodId(module1, 0x06000004, 1), ImmutableArray.Create( + // move AS:3 one line down: + new NonRemappableRegion(spanPreRemap3, lineDelta: +1, isExceptionRegion: false), + // move ER:3.0 and ER:3.1 one line down: + new NonRemappableRegion(erPreRemap30, lineDelta: +1, isExceptionRegion: true), + new NonRemappableRegion(erPreRemap31, lineDelta: +1, isExceptionRegion: true)) } + }.ToImmutableDictionary(); + + var (baseActiveStatementMap, baseExceptionRegions, docs) = await GetBaseActiveStatementsAndExceptionRegions(new[] { markedSourceV2 }, activeStatementsPreRemap, initialNonRemappableRegions).ConfigureAwait(false); + + // Active Statements + + var baseActiveStatements = baseActiveStatementMap.InstructionMap.Values.OrderBy(v => v.Ordinal).ToArray(); + + // Note that the spans of AS:2 and AS:3 correspond to the base snapshot (V2). + AssertEx.Equal(new[] + { + "0: (6,18)-(6,22) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test1.cs docs=[test1.cs] mvid=11111111-1111-1111-1111-111111111111 0x06000001 v2 IL_0000 'M();'", + "1: (20,18)-(20,22) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test1.cs docs=[test1.cs] mvid=11111111-1111-1111-1111-111111111111 0x06000002 v2 IL_0000 'M();'", + "2: (29,22)-(29,26) flags=[IsNonLeafFrame] pdid=test1.cs docs=[test1.cs] mvid=11111111-1111-1111-1111-111111111111 0x06000003 v1 IL_0000 '{ M();'", + "3: (53,22)-(53,26) flags=[IsNonLeafFrame] pdid=test1.cs docs=[test1.cs] mvid=11111111-1111-1111-1111-111111111111 0x06000004 v1 IL_0000 'M();'" + }, baseActiveStatements.Select(s => InspectActiveStatementAndInstruction(s, sourceTextV2))); + + // Exception Regions + + // Note that the spans correspond to the base snapshot (V2). + AssertEx.Equal(new[] + { + "[(8,16)-(10,9) 'catch']", + "[(18,16)-(21,9) 'catch']", + "[(38,16)-(40,9) 'catch', (34,20)-(36,13) 'finally']", + "[(56,16)-(58,9) 'catch', (51,20)-(54,13) 'catch']", + }, baseExceptionRegions.Select(r => "[" + string.Join(", ", r.Spans.Select(s => $"{s} '{GetFirstLineText(s, sourceTextV2)}'")) + "]")); + + // GetActiveStatementAndExceptionRegionSpans + + // Assume 2 more updates: + // F2: Move 'try' one line up (a new non-remappable entries will be added) + // F4: Insert 2 new lines before the first 'try' (an existing non-remappable entries will be updated) + var newActiveStatementsInChangedDocuments = ImmutableArray.Create( + ( + docs[0], + + ImmutableArray.Create( + baseActiveStatements[0], + baseActiveStatements[1].WithSpan(baseActiveStatements[1].Span.AddLineDelta(-1)), + baseActiveStatements[2], + baseActiveStatements[3].WithSpan(baseActiveStatements[3].Span.AddLineDelta(+2))), + + ImmutableArray.Create( + baseExceptionRegions[0].Spans, + baseExceptionRegions[1].Spans.SelectAsArray(es => es.AddLineDelta(-1)), + baseExceptionRegions[2].Spans, + baseExceptionRegions[3].Spans.SelectAsArray(es => es.AddLineDelta(+2))) + ) + ); + + EditSession.GetActiveStatementAndExceptionRegionSpans( + module1, + baseActiveStatementMap, + baseExceptionRegions, + updatedMethodTokens: new[] { 0x06000002, 0x06000004 }, // F2, F4 + initialNonRemappableRegions, + newActiveStatementsInChangedDocuments, + out var activeStatementsInUpdatedMethods, + out var nonRemappableRegions); + + // Note: Since no method have been remapped yet all the following spans are in their pre-remap locations: + AssertEx.Equal(new[] + { + "mvid=11111111-1111-1111-1111-111111111111 0x06000002 v2 | ER (18,16)-(21,9) δ=-1", + "mvid=11111111-1111-1111-1111-111111111111 0x06000002 v2 | AS (20,18)-(20,22) δ=-1", + "mvid=11111111-1111-1111-1111-111111111111 0x06000003 v1 | AS (30,22)-(30,26) δ=-1", // AS:2 moved -1 in first edit, 0 in second + "mvid=11111111-1111-1111-1111-111111111111 0x06000003 v1 | ER (32,20)-(34,13) δ=2", // ER:2.0 moved +2 in first edit, 0 in second + "mvid=11111111-1111-1111-1111-111111111111 0x06000003 v1 | ER (36,16)-(38,9) δ=2", // ER:2.0 moved +2 in first edit, 0 in second + "mvid=11111111-1111-1111-1111-111111111111 0x06000004 v1 | ER (50,20)-(53,13) δ=3", // ER:3.0 moved +1 in first edit, +2 in second + "mvid=11111111-1111-1111-1111-111111111111 0x06000004 v1 | AS (52,22)-(52,26) δ=3", // AS:3 moved +1 in first edit, +2 in second + "mvid=11111111-1111-1111-1111-111111111111 0x06000004 v1 | ER (55,16)-(57,9) δ=3", // ER:3.1 moved +1 in first edit, +2 in second + }, nonRemappableRegions.OrderBy(r => r.Region.Span.Start.Line).Select(r => $"{r.Method.GetDebuggerDisplay()} | {r.Region.GetDebuggerDisplay()}")); + + AssertEx.Equal(new[] + { + "thread=00000000-0000-0000-0000-000000000010 mvid=11111111-1111-1111-1111-111111111111 0x06000002 v2 IL_0000: (19,18)-(19,22) 'M();'", + "thread=00000000-0000-0000-0000-000000000010 mvid=11111111-1111-1111-1111-111111111111 0x06000004 v1 IL_0000: (55,22)-(55,26) 'M();'" + }, activeStatementsInUpdatedMethods.Select(v => $"thread={v.ThreadId} {v.OldInstructionId.GetDebuggerDisplay()}: {v.NewSpan} '{GetFirstLineText(v.NewSpan, sourceTextV3)}'")); + } + + [Fact] + public async Task BaseActiveStatementsAndExceptionRegions_Recursion() + { + var markedSource = new[] + { +@"class C +{ + static void M() + { + try + { + M(); + } + catch (Exception e) + { + } + } + + static void F() + { + M(); + } +}" + }; + + var thread1 = Guid.NewGuid(); + var thread2 = Guid.NewGuid(); + + // Thread1 stack trace: F (AS:0), M (AS:1 leaf) + // Thread2 stack trace: F (AS:0), M (AS:1), M (AS:1 leaf) + + var activeStatements = GetActiveStatementDebugInfos( + markedSource, + methodRowIds: new[] { 1, 2 }, + ilOffsets: new[] { 1, 1 }, + flags: new[] + { + ActiveStatementFlags.IsNonLeafFrame | ActiveStatementFlags.NonUserCode | ActiveStatementFlags.PartiallyExecuted | ActiveStatementFlags.MethodUpToDate, + ActiveStatementFlags.IsNonLeafFrame | ActiveStatementFlags.IsLeafFrame | ActiveStatementFlags.MethodUpToDate + }, + threads: new[] { ImmutableArray.Create(thread1, thread2), ImmutableArray.Create(thread1, thread2, thread2) }); + + var (baseActiveStatements, baseExceptionRegions, docs) = await GetBaseActiveStatementsAndExceptionRegions(markedSource, activeStatements).ConfigureAwait(false); + + // Active Statements + + Assert.Equal(1, baseActiveStatements.DocumentMap.Count); + + AssertEx.Equal(new[] + { + "0: (15,14)-(15,18) flags=[PartiallyExecuted, NonUserCode, MethodUpToDate, IsNonLeafFrame] pdid=test1.cs docs=[test1.cs]", + "1: (6,18)-(6,22) flags=[IsLeafFrame, MethodUpToDate, IsNonLeafFrame] pdid=test1.cs docs=[test1.cs]", + }, baseActiveStatements.DocumentMap[docs[0]].Select(InspectActiveStatement)); + + Assert.Equal(2, baseActiveStatements.InstructionMap.Count); + + var statements = baseActiveStatements.InstructionMap.Values.OrderBy(v => v.InstructionId.MethodId.Token).ToArray(); + var s = statements[0]; + Assert.Equal(0x06000001, s.InstructionId.MethodId.Token); + Assert.Equal(0, s.PrimaryDocumentOrdinal); + Assert.Equal(docs[0], s.DocumentIds.Single()); + Assert.True(s.IsNonLeaf); + AssertEx.Equal(new[] { thread1, thread2 }, s.ThreadIds); + + s = statements[1]; + Assert.Equal(0x06000002, s.InstructionId.MethodId.Token); + Assert.Equal(1, s.PrimaryDocumentOrdinal); + Assert.Equal(docs[0], s.DocumentIds.Single()); + Assert.True(s.IsLeaf); + Assert.True(s.IsNonLeaf); + AssertEx.Equal(new[] { thread1, thread2, thread2 }, s.ThreadIds); + + // Exception Regions + + AssertEx.Equal(new[] + { + "[]", + "[(8,8)-(10,9)]" + }, baseExceptionRegions.Select(r => "[" + string.Join(",", r.Spans) + "]")); + } + + [Fact, WorkItem(24320, "https://github.com/dotnet/roslyn/issues/24320")] + public async Task BaseActiveStatementsAndExceptionRegions_LinkedDocuments() + { + var markedSource = new[] + { +@"class Test1 +{ + static void Main() => Project2::Test1.F(); + static void F() => Project4::Test2.M(); +}", +@" +class Test2 +{ + static void M() => Console.WriteLine(); +}" + }; + + var module1 = Guid.NewGuid(); + var module2 = Guid.NewGuid(); + var module4 = Guid.NewGuid(); + + var activeStatements = GetActiveStatementDebugInfos( + markedSource, + methodRowIds: new[] { 1, 2, 1 }, + modules: new[] { module4, module2, module1 }); + + // Project1: Test1.cs [AS 2], Test2.cs + // Project2: Test1.cs (link from P1) [AS 1] + // Project3: Test1.cs (link from P1) + // Project4: Test2.cs (link from P1) [AS 0] + + var adjustSolution = new Func(solution => + { + var project1 = solution.Projects.Single(); + var doc1 = project1.Documents.First(); + var doc2 = project1.Documents.Skip(1).First(); + Assert.True(doc1.TryGetText(out var text1)); + Assert.True(doc2.TryGetText(out var text2)); + + void AddProjectAndLinkDocument(string projectName, Document doc, SourceText text) + { + var p = solution.AddProject(projectName, projectName, "C#"); + solution = p.Solution.AddDocument(DocumentId.CreateNewId(p.Id, projectName + "->" + doc.Name), doc.Name, text, filePath: doc.FilePath); + } + + AddProjectAndLinkDocument("Project2", doc1, text1); + AddProjectAndLinkDocument("Project3", doc1, text1); + AddProjectAndLinkDocument("Project4", doc2, text2); + return solution; + }); + + var (baseActiveStatements, baseExceptionRegions, docs) = await GetBaseActiveStatementsAndExceptionRegions(markedSource, activeStatements, adjustSolution: adjustSolution).ConfigureAwait(false); + + // Active Statements + + var documentMap = baseActiveStatements.DocumentMap; + + Assert.Equal(5, docs.Length); + Assert.Equal(5, documentMap.Count); + + // TODO: currently we associate all linked documents to the AS regardless of whether they belong to a project that matches the AS module. + // https://github.com/dotnet/roslyn/issues/24320 + + AssertEx.Equal(new[] + { + "1: (3,29)-(3,49) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test1.cs docs=[test1.cs,Project2->test1.cs,Project3->test1.cs]", + "2: (2,32)-(2,52) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test1.cs docs=[test1.cs,Project2->test1.cs,Project3->test1.cs]" + }, documentMap[docs[0]].Select(InspectActiveStatement)); + + AssertEx.Equal(new[] + { + "0: (3,29)-(3,49) flags=[IsLeafFrame, MethodUpToDate] pdid=test2.cs docs=[test2.cs,Project4->test2.cs]", + }, documentMap[docs[1]].Select(InspectActiveStatement)); + + AssertEx.Equal(new[] + { + "1: (3,29)-(3,49) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test1.cs docs=[test1.cs,Project2->test1.cs,Project3->test1.cs]", + "2: (2,32)-(2,52) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test1.cs docs=[test1.cs,Project2->test1.cs,Project3->test1.cs]" + }, documentMap[docs[2]].Select(InspectActiveStatement)); + + AssertEx.Equal(new[] + { + "1: (3,29)-(3,49) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test1.cs docs=[test1.cs,Project2->test1.cs,Project3->test1.cs]", + "2: (2,32)-(2,52) flags=[MethodUpToDate, IsNonLeafFrame] pdid=test1.cs docs=[test1.cs,Project2->test1.cs,Project3->test1.cs]" + }, documentMap[docs[3]].Select(InspectActiveStatement)); + + AssertEx.Equal(new[] + { + "0: (3,29)-(3,49) flags=[IsLeafFrame, MethodUpToDate] pdid=test2.cs docs=[test2.cs,Project4->test2.cs]", + }, documentMap[docs[4]].Select(InspectActiveStatement)); + + Assert.Equal(3, baseActiveStatements.InstructionMap.Count); + + var statements = baseActiveStatements.InstructionMap.Values.OrderBy(v => v.Ordinal).ToArray(); + var s = statements[0]; + Assert.Equal(0x06000001, s.InstructionId.MethodId.Token); + Assert.Equal(module4, s.InstructionId.MethodId.ModuleId); + + s = statements[1]; + Assert.Equal(0x06000002, s.InstructionId.MethodId.Token); + Assert.Equal(module2, s.InstructionId.MethodId.ModuleId); + + s = statements[2]; + Assert.Equal(0x06000001, s.InstructionId.MethodId.Token); + Assert.Equal(module1, s.InstructionId.MethodId.ModuleId); + } + } +} diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/DummyLanguageService.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/DummyLanguageService.cs new file mode 100644 index 0000000000000..2e8860e3547fa --- /dev/null +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/DummyLanguageService.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Composition; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Host.Mef; + +namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests +{ + internal interface IDummyLanguageService : ILanguageService { } + + [ExportLanguageService(typeof(IDummyLanguageService), LanguageName), Shared] + internal class DummyLanguageService : IDummyLanguageService + { + public const string LanguageName = "Dummy"; + + // do nothing + } +} diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/Extensions.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/Extensions.cs index 877df16e72d2e..a4fd86ff046b5 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/Extensions.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/Extensions.cs @@ -17,7 +17,7 @@ internal static void VerifyUnchangedDocument( { CSharpEditAndContinueTestHelpers.Instance.VerifyUnchangedDocument( ActiveStatementsDescription.ClearTags(source), - description.OldSpans, + description.OldStatements, description.OldTrackingSpans, description.NewSpans, description.OldRegions, diff --git a/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTagger.cs b/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTagger.cs index 8b22b7b26eff1..72940f7be74e3 100644 --- a/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTagger.cs +++ b/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTagger.cs @@ -3,7 +3,9 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Text.Shared.Extensions; using Microsoft.VisualStudio.Text; @@ -11,25 +13,53 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.EditAndContinue { - internal sealed class ActiveStatementTagger : ITagger, IDisposable + internal sealed class ActiveStatementTagger : ForegroundThreadAffinitizedObject, ITagger, IDisposable { - private readonly IActiveStatementTrackingService _trackingService; + private readonly WorkspaceRegistration _workspaceRegistration; private readonly ITextBuffer _buffer; - public ActiveStatementTagger(IActiveStatementTrackingService trackingService, ITextBuffer buffer) + private IActiveStatementTrackingService _trackingServiceOpt; + + public ActiveStatementTagger(ITextBuffer buffer) { - _trackingService = trackingService; - _trackingService.TrackingSpansChanged += OnTrackingSpansChanged; + // A buffer can switch between workspaces (from misc files workspace to primary workspace, etc.). + // The following code handles such transitions. + + _workspaceRegistration = Workspace.GetWorkspaceRegistration(buffer.AsTextContainer()); + ConnectToWorkspace(_workspaceRegistration.Workspace); + _workspaceRegistration.WorkspaceChanged += OnWorkspaceChanged; + _buffer = buffer; } - public event EventHandler TagsChanged; + private void OnWorkspaceChanged(object sender, EventArgs e) + => ConnectToWorkspace(_workspaceRegistration.Workspace); + + private void ConnectToWorkspace(Workspace workspaceOpt) + { + var newServiceOpt = workspaceOpt?.Services.GetService(); + if (newServiceOpt != null) + { + newServiceOpt.TrackingSpansChanged += OnTrackingSpansChanged; + } + + var previousServiceOpt = Interlocked.Exchange(ref _trackingServiceOpt, newServiceOpt); + if (previousServiceOpt != null) + { + previousServiceOpt.TrackingSpansChanged -= OnTrackingSpansChanged; + } + } public void Dispose() { - _trackingService.TrackingSpansChanged -= OnTrackingSpansChanged; + AssertIsForeground(); + + _workspaceRegistration.WorkspaceChanged -= OnWorkspaceChanged; + ConnectToWorkspace(workspaceOpt: null); } + public event EventHandler TagsChanged; + private void OnTrackingSpansChanged(bool leafChanged) { var handler = TagsChanged; @@ -43,11 +73,19 @@ private void OnTrackingSpansChanged(bool leafChanged) public IEnumerable> GetTags(NormalizedSnapshotSpanCollection spans) { + AssertIsForeground(); + + var service = _trackingServiceOpt; + if (service == null) + { + yield break; + } + var snapshot = spans.First().Snapshot; - foreach (ActiveStatementTextSpan asSpan in _trackingService.GetSpans(snapshot.AsText())) + foreach (ActiveStatementTextSpan asSpan in service.GetSpans(snapshot.AsText())) { - if ((asSpan.Flags & ActiveStatementFlags.LeafFrame) != 0) + if (asSpan.IsLeaf) { continue; } diff --git a/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTaggerProvider.cs b/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTaggerProvider.cs index 921ae267a6e30..a2425c331cc65 100644 --- a/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTaggerProvider.cs +++ b/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTaggerProvider.cs @@ -22,19 +22,6 @@ public ActiveStatementTaggerProvider() } public ITagger CreateTagger(ITextBuffer buffer) where T : ITag - { - if (!Workspace.TryGetWorkspace(buffer.AsTextContainer(), out var workspace)) - { - return null; - } - - var trackingService = workspace.Services.GetService(); - if (trackingService == null) - { - return null; - } - - return new ActiveStatementTagger(trackingService, buffer) as ITagger; - } + => new ActiveStatementTagger(buffer) as ITagger; } } diff --git a/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTrackingService.cs b/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTrackingService.cs index 793cd9275cf1f..1339f0665aa49 100644 --- a/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTrackingService.cs +++ b/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTrackingService.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; +using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Text.Shared.Extensions; using Microsoft.VisualStudio.Text; @@ -27,7 +28,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.EditAndContinue [Export(typeof(IActiveStatementTrackingService))] internal sealed class ActiveStatementTrackingService : IActiveStatementTrackingService { - private TrackingSession _session; + private TrackingSession _sessionOpt; internal ActiveStatementTrackingService() { @@ -42,23 +43,24 @@ private void OnTrackingSpansChanged(bool leafChanged) public void StartTracking(EditSession editSession) { - if (Interlocked.CompareExchange(ref _session, new TrackingSession(this, editSession), null) != null) + var newSession = new TrackingSession(this, editSession); + if (Interlocked.CompareExchange(ref _sessionOpt, newSession, null) != null) { - Debug.Assert(false, "Can only track active statements for a single edit session."); + newSession.EndTracking(); + Contract.Fail("Can only track active statements for a single edit session."); } } public void EndTracking() { - TrackingSession session = Interlocked.Exchange(ref _session, null); - Debug.Assert(session != null, "Active statement tracking not started."); - + var session = Interlocked.Exchange(ref _sessionOpt, null); + Contract.ThrowIfNull(session, "Active statement tracking not started."); session.EndTracking(); } public bool TryGetSpan(ActiveStatementId id, SourceText source, out TextSpan span) { - TrackingSession session = _session; + var session = _sessionOpt; if (session == null) { span = default; @@ -70,34 +72,36 @@ public bool TryGetSpan(ActiveStatementId id, SourceText source, out TextSpan spa public IEnumerable GetSpans(SourceText source) { - TrackingSession session = _session; - if (session == null) - { - return SpecializedCollections.EmptyEnumerable(); - } - - return session.GetSpans(source); + return _sessionOpt?.GetSpans(source) ?? SpecializedCollections.EmptyEnumerable(); } - public void UpdateActiveStatementSpans(SourceText source, IEnumerable> spans) + public void UpdateActiveStatementSpans(SourceText source, IEnumerable<(ActiveStatementId, ActiveStatementTextSpan)> spans) { - TrackingSession session = _session; - if (session != null) - { - session.UpdateActiveStatementSpans(source, spans); - } + _sessionOpt?.UpdateActiveStatementSpans(source, spans); } private sealed class TrackingSession { + private struct ActiveStatementTrackingSpan + { + public readonly ITrackingSpan Span; + public readonly ActiveStatementFlags Flags; + + public ActiveStatementTrackingSpan(ITrackingSpan trackingSpan, ActiveStatementFlags flags) + { + Span = trackingSpan; + Flags = flags; + } + } + private readonly ActiveStatementTrackingService _service; private readonly EditSession _editSession; - #region lock(TrackingSpans) + #region lock(_trackingSpans) // Spans that are tracking active statements contained in the specified document, // or null if we lost track of them due to document being closed and reopened. - private readonly Dictionary _trackingSpans; + private readonly Dictionary _trackingSpans; #endregion @@ -108,12 +112,18 @@ public TrackingSession(ActiveStatementTrackingService service, EditSession editS _service = service; _editSession = editSession; - _trackingSpans = new Dictionary(); + _trackingSpans = new Dictionary(); editSession.BaseSolution.Workspace.DocumentOpened += DocumentOpened; - TrackActiveSpans(); - service.OnTrackingSpansChanged(leafChanged: true); + // fire and forget on a background thread: + try + { + Task.Run(TrackActiveSpansAsync, _editSession.Cancellation.Token); + } + catch (TaskCanceledException) + { + } } public void EndTracking() @@ -129,17 +139,33 @@ public void EndTracking() } private void DocumentOpened(object sender, DocumentEventArgs e) + => DocumentOpenedAsync(e.Document); + + private async void DocumentOpenedAsync(Document document) { - if (_editSession.BaseActiveStatements.TryGetValue(e.Document.Id, out var activeStatements) && - TryGetSnapshot(e.Document, out var snapshot)) + try { - lock (_trackingSpans) + var baseActiveStatements = await _editSession.BaseActiveStatements.GetValueAsync(_editSession.Cancellation.Token).ConfigureAwait(false); + + if (baseActiveStatements.DocumentMap.TryGetValue(document.Id, out var documentActiveStatements) && + TryGetSnapshot(document, out var snapshot)) { - TrackActiveSpansNoLock(e.Document, snapshot, activeStatements); - } + lock (_trackingSpans) + { + TrackActiveSpansNoLock(document, snapshot, documentActiveStatements); + } - bool leafChanged = activeStatements.Contains(a => (a.Flags & ActiveStatementFlags.LeafFrame) != 0); - _service.OnTrackingSpansChanged(leafChanged); + bool leafChanged = documentActiveStatements.Contains(s => s.IsLeaf); + _service.OnTrackingSpansChanged(leafChanged); + } + } + catch (OperationCanceledException) + { + // nop + } + catch (Exception e) when (FatalError.ReportWithoutCrash(e)) + { + // nop } } @@ -155,66 +181,88 @@ private static bool TryGetSnapshot(Document document, out ITextSnapshot snapshot return snapshot != null; } - private void TrackActiveSpans() + private async Task TrackActiveSpansAsync() { - lock (_trackingSpans) + try { - foreach (var entry in _editSession.BaseActiveStatements) + var baseActiveStatements = await _editSession.BaseActiveStatements.GetValueAsync(_editSession.Cancellation.Token).ConfigureAwait(false); + + lock (_trackingSpans) { - var documentId = entry.Key; - Document document = _editSession.BaseSolution.GetDocument(documentId); - if (TryGetSnapshot(document, out var snapshot)) + foreach (var (documentId, documentActiveStatements) in baseActiveStatements.DocumentMap) { - TrackActiveSpansNoLock(document, snapshot, entry.Value); + var document = _editSession.BaseSolution.GetDocument(documentId); + if (TryGetSnapshot(document, out var snapshot)) + { + TrackActiveSpansNoLock(document, snapshot, documentActiveStatements); + } } } + + _service.OnTrackingSpansChanged(leafChanged: true); + } + catch (OperationCanceledException) + { + // nop + } + catch (Exception e) when (FatalError.ReportWithoutCrash(e)) + { + // nop } } private void TrackActiveSpansNoLock( Document document, ITextSnapshot snapshot, - ImmutableArray documentActiveSpans) + ImmutableArray documentActiveStatements) { if (!_trackingSpans.TryGetValue(document.Id, out var documentTrackingSpans)) { - SetTrackingSpansNoLock(document.Id, CreateTrackingSpans(snapshot, documentActiveSpans)); + SetTrackingSpansNoLock(document.Id, CreateTrackingSpans(snapshot, documentActiveStatements)); } else if (documentTrackingSpans != null) { Debug.Assert(documentTrackingSpans.Length > 0); - if (documentTrackingSpans[0].TextBuffer != snapshot.TextBuffer) + if (documentTrackingSpans[0].Span.TextBuffer != snapshot.TextBuffer) { // The underlying text buffer has changed - this means that our tracking spans // are no longer useful, we need to refresh them. Refresh happens asynchronously // as we calculate document delta. SetTrackingSpansNoLock(document.Id, null); + + // fire and forget: RefreshTrackingSpansAsync(document, snapshot); } } } - private void RefreshTrackingSpansAsync(Document document, ITextSnapshot snapshot) + private async void RefreshTrackingSpansAsync(Document document, ITextSnapshot snapshot) { - _editSession.GetDocumentAnalysis(document).GetValueAsync(_editSession.Cancellation.Token).SafeContinueWith(task => + try { + var documentAnalysis = await _editSession.GetDocumentAnalysis(document).GetValueAsync(_editSession.Cancellation.Token).ConfigureAwait(false); + // Do nothing if the statements aren't available (in presence of compilation errors). - if (!task.Result.ActiveStatements.IsDefault) + if (!documentAnalysis.ActiveStatements.IsDefault) { - RefreshTrackingSpans(document.Id, snapshot, task.Result.ActiveStatements); + RefreshTrackingSpans(document.Id, snapshot, documentAnalysis.ActiveStatements); } - }, _editSession.Cancellation.Token, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Default); + } + catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceled(e)) + { + // nop + } } - private void RefreshTrackingSpans(DocumentId documentId, ITextSnapshot snapshot, ImmutableArray documentActiveSpans) + private void RefreshTrackingSpans(DocumentId documentId, ITextSnapshot snapshot, ImmutableArray documentActiveStatements) { bool updated = false; lock (_trackingSpans) { if (_trackingSpans.TryGetValue(documentId, out var documentTrackingSpans) && documentTrackingSpans == null) { - SetTrackingSpansNoLock(documentId, CreateTrackingSpans(snapshot, documentActiveSpans)); + SetTrackingSpansNoLock(documentId, CreateTrackingSpans(snapshot, documentActiveStatements)); updated = true; } } @@ -225,39 +273,26 @@ private void RefreshTrackingSpans(DocumentId documentId, ITextSnapshot snapshot, } } - private void SetTrackingSpansNoLock(DocumentId documentId, ITrackingSpan[] spans) + private void SetTrackingSpansNoLock(DocumentId documentId, ActiveStatementTrackingSpan[] spansOpt) { - Debug.Assert(spans == null || spans.Length == _editSession.BaseActiveStatements[documentId].Length); - _trackingSpans[documentId] = spans; + _trackingSpans[documentId] = spansOpt; } - private static ITrackingSpan[] CreateTrackingSpans(ITextSnapshot snapshot, ImmutableArray documentActiveSpans) + private static ActiveStatementTrackingSpan[] CreateTrackingSpans(ITextSnapshot snapshot, ImmutableArray documentActiveStatements) { - var result = new ITrackingSpan[documentActiveSpans.Length]; + var result = new ActiveStatementTrackingSpan[documentActiveStatements.Length]; for (int i = 0; i < result.Length; i++) { - var span = snapshot.GetTextSpan(documentActiveSpans[i].Span).ToSpan(); - result[i] = CreateTrackingSpan(snapshot, span); + var span = snapshot.GetTextSpan(documentActiveStatements[i].Span).ToSpan(); + result[i] = CreateTrackingSpan(snapshot, span, documentActiveStatements[i].Flags); } return result; } - private ITrackingSpan[] CreateTrackingSpans(ITextSnapshot snapshot, ImmutableArray documentActiveSpans) + private static ActiveStatementTrackingSpan CreateTrackingSpan(ITextSnapshot snapshot, Span span, ActiveStatementFlags flags) { - var result = new ITrackingSpan[documentActiveSpans.Length]; - for (int i = 0; i < result.Length; i++) - { - var span = snapshot.GetTextSpan(documentActiveSpans[i]).ToSpan(); - result[i] = CreateTrackingSpan(snapshot, span); - } - - return result; - } - - private static ITrackingSpan CreateTrackingSpan(ITextSnapshot snapshot, Span span) - { - return snapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeExclusive); + return new ActiveStatementTrackingSpan(snapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeExclusive), flags); } public bool TryGetSpan(ActiveStatementId id, SourceText source, out TextSpan span) @@ -266,7 +301,7 @@ public bool TryGetSpan(ActiveStatementId id, SourceText source, out TextSpan spa { if (_trackingSpans.TryGetValue(id.DocumentId, out var documentSpans) && documentSpans != null) { - var trackingSpan = documentSpans[id.Ordinal]; + var trackingSpan = documentSpans[id.Ordinal].Span; var snapshot = source.FindCorrespondingEditorTextSnapshot(); if (snapshot != null && snapshot.TextBuffer == trackingSpan.TextBuffer) @@ -296,7 +331,7 @@ public IEnumerable GetSpans(SourceText source) return SpecializedCollections.EmptyEnumerable(); } - ITrackingSpan[] documentTrackingSpans; + ActiveStatementTrackingSpan[] documentTrackingSpans; lock (_trackingSpans) { if (!_trackingSpans.TryGetValue(document.Id, out documentTrackingSpans) || documentTrackingSpans == null) @@ -310,51 +345,45 @@ public IEnumerable GetSpans(SourceText source) // The document might have been reopened with a new text buffer // and we haven't created tracking spans for the new text buffer yet. - if (snapshot == null || snapshot.TextBuffer != documentTrackingSpans[0].TextBuffer) + if (snapshot == null || snapshot.TextBuffer != documentTrackingSpans[0].Span.TextBuffer) { return SpecializedCollections.EmptyEnumerable(); } - var baseStatements = _editSession.BaseActiveStatements[document.Id]; - - Debug.Assert(documentTrackingSpans.Length == baseStatements.Length); - var result = new ActiveStatementTextSpan[documentTrackingSpans.Length]; for (int i = 0; i < documentTrackingSpans.Length; i++) { - Debug.Assert(documentTrackingSpans[i].TextBuffer == snapshot.TextBuffer); + Debug.Assert(documentTrackingSpans[i].Span.TextBuffer == snapshot.TextBuffer); result[i] = new ActiveStatementTextSpan( - baseStatements[i].Flags, - documentTrackingSpans[i].GetSpan(snapshot).Span.ToTextSpan()); + documentTrackingSpans[i].Flags, + documentTrackingSpans[i].Span.GetSpan(snapshot).Span.ToTextSpan()); } return result; } - public void UpdateActiveStatementSpans(SourceText source, IEnumerable> spans) + public void UpdateActiveStatementSpans(SourceText source, IEnumerable<(ActiveStatementId, ActiveStatementTextSpan)> spans) { bool leafUpdated = false; bool updated = false; lock (_trackingSpans) { - foreach (var span in spans) + foreach (var (id, span) in spans) { - ActiveStatementId id = span.Key; if (_trackingSpans.TryGetValue(id.DocumentId, out var documentSpans) && documentSpans != null) { var snapshot = source.FindCorrespondingEditorTextSnapshot(); // Avoid updating spans if the buffer has changed. // Buffer change is handled by DocumentOpened event. - if (snapshot != null && snapshot.TextBuffer == documentSpans[id.Ordinal].TextBuffer) + if (snapshot != null && snapshot.TextBuffer == documentSpans[id.Ordinal].Span.TextBuffer) { - documentSpans[id.Ordinal] = snapshot.CreateTrackingSpan(span.Value.ToSpan(), SpanTrackingMode.EdgeExclusive); + documentSpans[id.Ordinal] = new ActiveStatementTrackingSpan(snapshot.CreateTrackingSpan(span.Span.ToSpan(), SpanTrackingMode.EdgeExclusive), span.Flags); if (!leafUpdated) { - var baseStatements = _editSession.BaseActiveStatements[id.DocumentId]; - leafUpdated = (baseStatements[id.Ordinal].Flags & ActiveStatementFlags.LeafFrame) != 0; + leafUpdated = span.IsLeaf; } updated = true; diff --git a/src/EditorFeatures/Core/Implementation/EditAndContinue/EditAndContinueDiagnosticUpdateSource.cs b/src/EditorFeatures/Core/Implementation/EditAndContinue/EditAndContinueDiagnosticUpdateSource.cs index 63c34c91c2768..c6ba95855dbfd 100644 --- a/src/EditorFeatures/Core/Implementation/EditAndContinue/EditAndContinueDiagnosticUpdateSource.cs +++ b/src/EditorFeatures/Core/Implementation/EditAndContinue/EditAndContinueDiagnosticUpdateSource.cs @@ -28,7 +28,7 @@ public EncErrorId(DebuggingSession session, object errorId) [Shared] internal sealed class EditAndContinueDiagnosticUpdateSource : IDiagnosticUpdateSource { - internal static readonly object DebuggerErrorId = new object(); + internal static readonly object InternalErrorId = new object(); internal static readonly object EmitErrorId = new object(); [ImportingConstructor] diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementDescription.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementsDescription.cs similarity index 69% rename from src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementDescription.cs rename to src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementsDescription.cs index 38d0c48031073..ea2c047b91f7a 100644 --- a/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementDescription.cs +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementsDescription.cs @@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests { internal class ActiveStatementsDescription { - public readonly ActiveStatementSpan[] OldSpans; + public readonly ActiveStatement[] OldStatements; public readonly TextSpan[] NewSpans; public readonly ImmutableArray[] OldRegions; public readonly ImmutableArray[] NewRegions; @@ -21,33 +21,44 @@ internal class ActiveStatementsDescription private ActiveStatementsDescription() { - OldSpans = Array.Empty(); + OldStatements = Array.Empty(); NewSpans = Array.Empty(); OldRegions = Array.Empty>(); NewRegions = Array.Empty>(); OldTrackingSpans = null; } + private static readonly DocumentId s_dummyDocumentId = DocumentId.CreateNewId(ProjectId.CreateNewId()); + public ActiveStatementsDescription(string oldSource, string newSource) { - OldSpans = GetActiveStatements(oldSource); - NewSpans = GetActiveSpans(newSource); - OldRegions = GetExceptionRegions(oldSource, OldSpans.Length); + var oldText = SourceText.From(oldSource); + + OldStatements = GetActiveSpans(oldSource).Aggregate( + new List(), + (list, s) => SetListItem(list, s.Id, CreateActiveStatement(s.Span, s.Id, oldText, s_dummyDocumentId))).ToArray(); + + NewSpans = GetActiveSpans(newSource).Aggregate( + new List(), + (list, s) => SetListItem(list, s.Id, s.Span)).ToArray(); + + OldRegions = GetExceptionRegions(oldSource, OldStatements.Length); NewRegions = GetExceptionRegions(newSource, NewSpans.Length); // Tracking spans are marked in the new source since the editor moves them around as the user // edits the source and we get their positions when analyzing the new source. // The EnC analyzer uses old trackign spans as hints to find matching nodes. // After an edit the tracking spans are updated to match new active statements. - OldTrackingSpans = GetTrackingSpans(newSource, OldSpans.Length); + OldTrackingSpans = GetTrackingSpans(newSource, OldStatements.Length); } internal static readonly ActiveStatementsDescription Empty = new ActiveStatementsDescription(); internal static string ClearTags(string source) - { - return s_tags.Replace(source, m => new string(' ', m.Length)); - } + => s_tags.Replace(source, m => new string(' ', m.Length)); + + internal static string[] ClearTags(string[] sources) + => sources.Select(ClearTags).ToArray(); private static readonly Regex s_tags = new Regex( @"[<][/]?(AS|ER|N|TS)[:][.0-9,]+[>]", @@ -71,24 +82,6 @@ internal static string ClearTags(string source) [<][/]TS[:] (\k) [>]", RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline); - internal static ActiveStatementSpan[] GetActiveStatements(string src) - { - var text = SourceText.From(src); - var result = new List(); - - int i = 0; - foreach (var span in GetActiveSpans(src)) - { - result.Add(new ActiveStatementSpan( - (i == 0) ? ActiveStatementFlags.LeafFrame : ActiveStatementFlags.None, - text.Lines.GetLinePositionSpan(span))); - - i++; - } - - return result.ToArray(); - } - internal static IEnumerable GetIds(Match match) { return match.Groups["Id"].Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse); @@ -106,7 +99,7 @@ internal static IEnumerable> GetDottedIds(Match match) select ValueTuple.Create(int.Parse(parts[0]), int.Parse(parts[1])); } - private static IEnumerable> GetSpansRecursive(Regex regex, string contentGroupName, string markedSource, int offset) + private static IEnumerable<(TextSpan Span, int[] Ids)> GetSpansRecursive(Regex regex, string contentGroupName, string markedSource, int offset) { foreach (var match in regex.Matches(markedSource).ToEnumerable()) { @@ -115,7 +108,7 @@ private static IEnumerable> GetSpansRecursive(Regex int absoluteOffset = offset + markedSyntax.Index; var span = markedSyntax.Length != 0 ? new TextSpan(absoluteOffset, markedSyntax.Length) : new TextSpan(); - yield return ValueTuple.Create(span, ids); + yield return (span, ids); foreach (var nestedSpan in GetSpansRecursive(regex, contentGroupName, markedSyntax.Value, absoluteOffset)) { @@ -124,22 +117,35 @@ private static IEnumerable> GetSpansRecursive(Regex } } - internal static TextSpan[] GetActiveSpans(string src) + internal static IEnumerable<(TextSpan Span, int Id)> GetActiveSpans(string markedSource) { - List result = new List(); - - foreach (var spanAndIds in GetSpansRecursive(s_activeStatementPattern, "ActiveStatement", src, 0)) + foreach (var (span, ids) in GetSpansRecursive(s_activeStatementPattern, "ActiveStatement", markedSource, offset: 0)) { - foreach (int id in spanAndIds.Item2) + foreach (int id in ids) { - EnsureSlot(result, id); - result[id] = spanAndIds.Item1; + yield return (span, id); } } - - return result.ToArray(); } + private static readonly ImmutableArray s_dummyThreadIds = ImmutableArray.Create(default(Guid)); + + internal static ActiveStatement CreateActiveStatement(ActiveStatementFlags flags, LinePositionSpan span, DocumentId documentId) + => new ActiveStatement( + ordinal: 0, + primaryDocumentOrdinal: 0, + ImmutableArray.Create(documentId), + flags, + span, + instructionId: default, + s_dummyThreadIds); + + internal static ActiveStatement CreateActiveStatement(TextSpan span, int id, SourceText text, DocumentId documentId) + => CreateActiveStatement( + (id == 0) ? ActiveStatementFlags.IsLeafFrame : ActiveStatementFlags.IsNonLeafFrame, + text.Lines.GetLinePositionSpan(span), + documentId); + internal static TextSpan?[] GetTrackingSpans(string src, int count) { var matches = s_trackingStatementPattern.Matches(src); @@ -189,7 +195,14 @@ internal static ImmutableArray[] GetExceptionRegions(string src, int a return result.Select(r => r.AsImmutableOrEmpty()).ToArray(); } - private static void EnsureSlot(List list, int i) + public static List SetListItem(List list, int i, T item) + { + EnsureSlot(list, i); + list[i] = item; + return list; + } + + public static void EnsureSlot(List list, int i) { while (i >= list.Count) { diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs index b5e0cfd18f08b..4016c6e20a14c 100644 --- a/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs @@ -26,7 +26,7 @@ internal abstract class EditAndContinueTestHelpers internal void VerifyUnchangedDocument( string source, - ActiveStatementSpan[] oldActiveStatements, + ActiveStatement[] oldActiveStatements, TextSpan?[] trackingSpansOpt, TextSpan[] expectedNewActiveStatements, ImmutableArray[] expectedOldExceptionRegions, @@ -50,7 +50,7 @@ internal void VerifyUnchangedDocument( trackingService = null; } - var actualNewActiveStatements = new LinePositionSpan[oldActiveStatements.Length]; + var actualNewActiveStatements = new ActiveStatement[oldActiveStatements.Length]; var actualNewExceptionRegions = new ImmutableArray[oldActiveStatements.Length]; Analyzer.AnalyzeUnchangedDocument( @@ -63,7 +63,7 @@ internal void VerifyUnchangedDocument( actualNewExceptionRegions); // check active statements: - AssertSpansEqual(expectedNewActiveStatements, actualNewActiveStatements, source, text); + AssertSpansEqual(expectedNewActiveStatements, actualNewActiveStatements.Select(s => s.Span), source, text); // check new exception regions: Assert.Equal(expectedNewExceptionRegions.Length, actualNewExceptionRegions.Length); @@ -78,7 +78,7 @@ internal void VerifyRudeDiagnostics( ActiveStatementsDescription description, RudeEditDiagnosticDescription[] expectedDiagnostics) { - var oldActiveStatements = description.OldSpans; + var oldActiveStatements = description.OldStatements; if (description.OldTrackingSpans != null) { @@ -92,7 +92,7 @@ internal void VerifyRudeDiagnostics( var newText = SourceText.From(newSource); var diagnostics = new List(); - var actualNewActiveStatements = new LinePositionSpan[oldActiveStatements.Length]; + var actualNewActiveStatements = new ActiveStatement[oldActiveStatements.Length]; var actualNewExceptionRegions = new ImmutableArray[oldActiveStatements.Length]; var updatedActiveMethodMatches = new List(); var editMap = Analyzer.BuildEditMap(editScript); @@ -125,7 +125,7 @@ internal void VerifyRudeDiagnostics( diagnostics.Verify(newSource, expectedDiagnostics); // check active statements: - AssertSpansEqual(description.NewSpans, actualNewActiveStatements, newSource, newText); + AssertSpansEqual(description.NewSpans, actualNewActiveStatements.Select(s => s.Span), newSource, newText); if (diagnostics.Count == 0) { @@ -136,7 +136,8 @@ internal void VerifyRudeDiagnostics( oldText, editScript.Match.OldRoot, oldActiveStatements[i].Span, - isLeaf: (oldActiveStatements[i].Flags & ActiveStatementFlags.LeafFrame) != 0); + isNonLeaf: oldActiveStatements[i].IsNonLeaf, + out _); AssertSpansEqual(description.OldRegions[i], actualOldExceptionRegions, oldSource, oldText); } @@ -238,15 +239,15 @@ internal void VerifySemantics( var oldModel = oldCompilation.GetSemanticModel(oldRoot.SyntaxTree); var newModel = newCompilation.GetSemanticModel(newRoot.SyntaxTree); - var oldActiveStatements = activeStatements.OldSpans.AsImmutable(); + var oldActiveStatements = activeStatements.OldStatements.AsImmutable(); var updatedActiveMethodMatches = new List(); var triviaEdits = new List>(); var actualLineEdits = new List(); var actualSemanticEdits = new List(); var diagnostics = new List(); - var actualNewActiveStatements = new LinePositionSpan[activeStatements.OldSpans.Length]; - var actualNewExceptionRegions = new ImmutableArray[activeStatements.OldSpans.Length]; + var actualNewActiveStatements = new ActiveStatement[activeStatements.OldStatements.Length]; + var actualNewExceptionRegions = new ImmutableArray[activeStatements.OldStatements.Length]; Analyzer.AnalyzeSyntax( editScript, @@ -271,7 +272,7 @@ internal void VerifySemantics( triviaEdits, actualLineEdits, diagnostics, - default(CancellationToken)); + CancellationToken.None); diagnostics.Verify(newSource); @@ -287,7 +288,7 @@ internal void VerifySemantics( actualSemanticEdits, diagnostics, out var firstDeclarationErrorOpt, - default(CancellationToken)); + CancellationToken.None); var actualDeclarationErrors = (firstDeclarationErrorOpt != null) ? new[] { firstDeclarationErrorOpt } : Array.Empty(); var expectedDeclarationErrors = (expectedDeclarationError != null) ? new[] { expectedDeclarationError } : Array.Empty(); @@ -346,7 +347,7 @@ internal void VerifySemantics( } } - private static void AssertSpansEqual(IList expected, IList actual, string newSource, SourceText newText) + private static void AssertSpansEqual(IEnumerable expected, IEnumerable actual, string newSource, SourceText newText) { AssertEx.Equal( expected, diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/TestActiveStatementTrackingService.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/TestActiveStatementTrackingService.cs index 8e4a2ecfdc51f..96f89cf911c45 100644 --- a/src/EditorFeatures/TestUtilities/EditAndContinue/TestActiveStatementTrackingService.cs +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/TestActiveStatementTrackingService.cs @@ -14,7 +14,7 @@ internal class TestActiveStatementTrackingService : IActiveStatementTrackingServ public TestActiveStatementTrackingService(DocumentId documentId, TextSpan?[] trackingSpans) { - this.TrackingSpans = trackingSpans; + TrackingSpans = trackingSpans; _documentId = documentId; } @@ -29,15 +29,15 @@ public bool TryGetSpan(ActiveStatementId id, SourceText source, out TextSpan spa return true; } - span = default(TextSpan); + span = default; return false; } - public void UpdateActiveStatementSpans(SourceText source, IEnumerable> spans) + public void UpdateActiveStatementSpans(SourceText source, IEnumerable<(ActiveStatementId, ActiveStatementTextSpan)> spans) { - foreach (var span in spans) + foreach (var (id, span) in spans) { - TrackingSpans[span.Key.Ordinal] = span.Value.Length > 0 ? span.Value : (TextSpan?)null; + TrackingSpans[id.Ordinal] = span.Span.Length > 0 ? span.Span : (TextSpan?)null; } } @@ -47,20 +47,9 @@ public void UpdateActiveStatementSpans(SourceText source, IEnumerable TrackingSpansChanged; #pragma warning restore 67 - public void StartTracking(EditSession editSession) - { - throw new NotImplementedException(); - } - - public void EndTracking() - { - throw new NotImplementedException(); - } - - public IEnumerable GetSpans(SourceText source) - { - throw new NotImplementedException(); - } + public void StartTracking(EditSession editSession) => throw new NotImplementedException(); + public void EndTracking() => throw new NotImplementedException(); + public IEnumerable GetSpans(SourceText source) => throw new NotImplementedException(); #endregion } diff --git a/src/EditorFeatures/TestUtilities/Workspaces/CSharpTestWorkspaceFixture.cs b/src/EditorFeatures/TestUtilities/Workspaces/CSharpTestWorkspaceFixture.cs index 8c0ce247537a5..12a9ac018c933 100644 --- a/src/EditorFeatures/TestUtilities/Workspaces/CSharpTestWorkspaceFixture.cs +++ b/src/EditorFeatures/TestUtilities/Workspaces/CSharpTestWorkspaceFixture.cs @@ -9,7 +9,7 @@ public class CSharpTestWorkspaceFixture : TestWorkspaceFixture { protected override TestWorkspace CreateWorkspace() { - return TestWorkspace.CreateCSharp( + return TestWorkspace.CreateCSharp2( new string[] { string.Empty, }, new CSharpParseOptions[] { new CSharpParseOptions(kind: SourceCodeKind.Regular), }); } diff --git a/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace_Create.cs b/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace_Create.cs index 330e7aa147e7c..69cdce4e9e5af 100644 --- a/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace_Create.cs +++ b/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace_Create.cs @@ -122,6 +122,9 @@ internal static TestWorkspace Create( return Create(language, compilationOptions, parseOptions, files, exportProvider: null, workspaceKind: workspaceKind); } + internal static string GetDefaultTestSourceDocumentName(int index, string extension) + => "test" + (index + 1) + extension; + internal static TestWorkspace Create( string language, CompilationOptions compilationOptions, @@ -135,7 +138,7 @@ internal static TestWorkspace Create( bool openDocuments = true) { var documentElements = new List(); - var index = 1; + var index = 0; if (extension == null) { @@ -146,7 +149,7 @@ internal static TestWorkspace Create( foreach (var file in files) { - documentElements.Add(CreateDocumentElement(file, "test" + index++ + extension, parseOptions)); + documentElements.Add(CreateDocumentElement(file, GetDefaultTestSourceDocumentName(index++, extension), parseOptions)); } metadataReferences = metadataReferences ?? Array.Empty(); @@ -171,7 +174,7 @@ internal static TestWorkspace Create( Contract.Requires(parseOptions == null || (files.Length == parseOptions.Length), "Please specify a parse option for each file."); var documentElements = new List(); - var index = 1; + var index = 0; var extension = ""; for (int i = 0; i < files.Length; i++) @@ -193,7 +196,7 @@ internal static TestWorkspace Create( extension = language; } - documentElements.Add(CreateDocumentElement(files[i], "test" + index++ + extension, parseOptions == null ? null : parseOptions[i])); + documentElements.Add(CreateDocumentElement(files[i], GetDefaultTestSourceDocumentName(index++, extension), parseOptions == null ? null : parseOptions[i])); } var workspaceElement = CreateWorkspaceElement( @@ -226,7 +229,7 @@ public static TestWorkspace CreateCSharp( return Create(LanguageNames.CSharp, compilationOptions, parseOptions, files, exportProvider, metadataReferences, openDocuments: openDocuments); } - public static TestWorkspace CreateCSharp( + public static TestWorkspace CreateCSharp2( string[] files, ParseOptions[] parseOptions = null, CompilationOptions compilationOptions = null, diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb index bc81fdb76a337..1533f71652096 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb @@ -5450,6 +5450,7 @@ Class C Console.WriteLine(2) Console.WriteLine(3) Console.WriteLine(4) + Console.WriteLine(5) End Sub End Class " @@ -5460,25 +5461,28 @@ Class C Console.WriteLine(20) Console.WriteLine(30) Console.WriteLine(40) + Console.WriteLine(50) End Sub End Class " Dim edits = GetTopEdits(src1, src2) Dim active = GetActiveStatements(src1, src2) - active.OldSpans(0) = New ActiveStatementSpan(ActiveStatementFlags.PartiallyExecuted Or ActiveStatementFlags.LeafFrame, active.OldSpans(0).Span) - active.OldSpans(1) = New ActiveStatementSpan(ActiveStatementFlags.PartiallyExecuted, active.OldSpans(1).Span) - active.OldSpans(2) = New ActiveStatementSpan(ActiveStatementFlags.LeafFrame, active.OldSpans(2).Span) - active.OldSpans(3) = New ActiveStatementSpan(ActiveStatementFlags.None, active.OldSpans(3).Span) + active.OldStatements(0) = active.OldStatements(0).WithFlags(ActiveStatementFlags.PartiallyExecuted Or ActiveStatementFlags.IsLeafFrame) + active.OldStatements(1) = active.OldStatements(1).WithFlags(ActiveStatementFlags.PartiallyExecuted Or ActiveStatementFlags.IsNonLeafFrame) + active.OldStatements(2) = active.OldStatements(2).WithFlags(ActiveStatementFlags.IsLeafFrame) + active.OldStatements(3) = active.OldStatements(3).WithFlags(ActiveStatementFlags.IsNonLeafFrame) + active.OldStatements(4) = active.OldStatements(4).WithFlags(ActiveStatementFlags.IsNonLeafFrame Or ActiveStatementFlags.IsLeafFrame) edits.VerifyRudeDiagnostics(active, Diagnostic(RudeEditKind.PartiallyExecutedActiveStatementUpdate, "Console.WriteLine(10)"), Diagnostic(RudeEditKind.ActiveStatementUpdate, "Console.WriteLine(20)"), - Diagnostic(RudeEditKind.ActiveStatementUpdate, "Console.WriteLine(40)")) + Diagnostic(RudeEditKind.ActiveStatementUpdate, "Console.WriteLine(40)"), + Diagnostic(RudeEditKind.ActiveStatementUpdate, "Console.WriteLine(50)")) End Sub - Public Sub PartiallyExecutedActiveStatement_Delete() + Public Sub PartiallyExecutedActiveStatement_Delete1() Dim src1 As String = " Class C Sub F() @@ -5495,10 +5499,34 @@ End Class Dim edits = GetTopEdits(src1, src2) Dim active = GetActiveStatements(src1, src2) - active.OldSpans(0) = New ActiveStatementSpan(ActiveStatementFlags.PartiallyExecuted Or ActiveStatementFlags.LeafFrame, active.OldSpans(0).Span) + active.OldStatements(0) = active.OldStatements(0).WithFlags(ActiveStatementFlags.PartiallyExecuted Or ActiveStatementFlags.IsLeafFrame) edits.VerifyRudeDiagnostics(active, Diagnostic(RudeEditKind.PartiallyExecutedActiveStatementDelete, "Sub F()")) End Sub + + + Public Sub PartiallyExecutedActiveStatement_Delete2() + Dim src1 As String = " +Class C + Sub F() + Console.WriteLine(1) + End Sub +End Class +" + Dim src2 As String = " +Class C + Sub F() + End Sub +End Class +" + Dim edits = GetTopEdits(src1, src2) + Dim active = GetActiveStatements(src1, src2) + + active.OldStatements(0) = active.OldStatements(0).WithFlags(ActiveStatementFlags.IsNonLeafFrame Or ActiveStatementFlags.IsLeafFrame) + + edits.VerifyRudeDiagnostics(active, + Diagnostic(RudeEditKind.DeleteActiveStatement, "Sub F()")) + End Sub End Class End Namespace diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/Extensions.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/Extensions.vb index 413174d2d90b2..e8b9eae553a1a 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/Extensions.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/Extensions.vb @@ -17,7 +17,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue.UnitTests VisualBasicEditAndContinueTestHelpers.Instance.VerifyUnchangedDocument( ActiveStatementsDescription.ClearTags(source), - description.OldSpans, + description.OldStatements, description.OldTrackingSpans, description.NewSpans, description.OldRegions, diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/VisualBasicEditAndContinueAnalyzerTests.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/VisualBasicEditAndContinueAnalyzerTests.vb index c0cfc60b3c5ca..acfc4a257196d 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/VisualBasicEditAndContinueAnalyzerTests.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/VisualBasicEditAndContinueAnalyzerTests.vb @@ -3,6 +3,7 @@ Imports System.Collections.Immutable Imports Microsoft.CodeAnalysis.Differencing Imports Microsoft.CodeAnalysis.EditAndContinue +Imports Microsoft.CodeAnalysis.EditAndContinue.UnitTests Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.Text @@ -450,14 +451,14 @@ End Class Dim oldStatementSpan = oldText.Lines.GetLinePositionSpan(oldStatementTextSpan) Dim oldStatementSyntax = oldSyntaxRoot.FindNode(oldStatementTextSpan) - Dim baseActiveStatements = ImmutableArray.Create(New ActiveStatementSpan(ActiveStatementFlags.LeafFrame, oldStatementSpan)) + Dim baseActiveStatements = ImmutableArray.Create(ActiveStatementsDescription.CreateActiveStatement(ActiveStatementFlags.IsLeafFrame, oldStatementSpan, DocumentId.CreateNewId(ProjectId.CreateNewId()))) Dim result = Await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newDocument, Nothing) Assert.True(result.HasChanges) Assert.True(result.SemanticEdits(0).PreserveLocalVariables) Dim syntaxMap = result.SemanticEdits(0).SyntaxMap - Dim newStatementSpan = result.ActiveStatements(0) + Dim newStatementSpan = result.ActiveStatements(0).Span Dim newStatementTextSpan = newText.Lines.GetTextSpan(newStatementSpan) Dim newStatementSyntax = newSyntaxRoot.FindNode(newStatementTextSpan) @@ -467,7 +468,7 @@ End Class End Function - Public Async Function AnalyzeDocumentAsync_SyntaxError_NoChange1() As Threading.Tasks.Task + Public Async Function AnalyzeDocumentAsync_SyntaxError_NoChange1() As Task Dim source = " Class C Public Shared Sub Main() @@ -479,7 +480,7 @@ End Class Dim analyzer = New VisualBasicEditAndContinueAnalyzer() Using workspace = TestWorkspace.CreateVisualBasic(source) Dim document = workspace.CurrentSolution.Projects.First().Documents.First() - Dim baseActiveStatements = ImmutableArray.Create(Of ActiveStatementSpan)() + Dim baseActiveStatements = ImmutableArray.Create(Of ActiveStatement)() Dim result = Await analyzer.AnalyzeDocumentAsync(workspace.CurrentSolution, baseActiveStatements, document, Nothing) Assert.False(result.HasChanges) @@ -511,7 +512,7 @@ End Class Dim oldSolution = workspace.CurrentSolution Dim newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2)) - Dim baseActiveStatements = ImmutableArray.Create(Of ActiveStatementSpan)() + Dim baseActiveStatements = ImmutableArray.Create(Of ActiveStatement)() Dim result = Await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newSolution.GetDocument(documentId), Nothing) Assert.False(result.HasChanges) @@ -534,7 +535,7 @@ End Class Dim analyzer = New VisualBasicEditAndContinueAnalyzer() Using workspace = TestWorkspace.CreateVisualBasic(source) Dim document = workspace.CurrentSolution.Projects.First().Documents.First() - Dim baseActiveStatements = ImmutableArray.Create(Of ActiveStatementSpan)() + Dim baseActiveStatements = ImmutableArray.Create(Of ActiveStatement)() Dim result = Await analyzer.AnalyzeDocumentAsync(workspace.CurrentSolution, baseActiveStatements, document, Nothing) Assert.False(result.HasChanges) @@ -568,7 +569,7 @@ End Class Dim oldSolution = workspace.CurrentSolution Dim newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2)) - Dim baseActiveStatements = ImmutableArray.Create(Of ActiveStatementSpan)() + Dim baseActiveStatements = ImmutableArray.Create(Of ActiveStatement)() Dim result = Await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newSolution.GetDocument(documentId), Nothing) ' no declaration errors (error in method body is only reported when emitting) @@ -600,7 +601,7 @@ End Class Dim oldSolution = workspace.CurrentSolution Dim newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2)) - Dim baseActiveStatements = ImmutableArray.Create(Of ActiveStatementSpan)() + Dim baseActiveStatements = ImmutableArray.Create(Of ActiveStatement)() Dim result = Await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newSolution.GetDocument(documentId), Nothing) Assert.True(result.HasChanges) @@ -665,7 +666,7 @@ End Class Dim changedDocuments = changes.GetChangedDocuments().Concat(changes.GetAddedDocuments()) Dim result = New List(Of DocumentAnalysisResults)() - Dim baseActiveStatements = ImmutableArray.Create(Of ActiveStatementSpan)() + Dim baseActiveStatements = ImmutableArray.Create(Of ActiveStatement)() For Each changedDocumentId In changedDocuments result.Add(Await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newProject.GetDocument(changedDocumentId), Nothing)) Next diff --git a/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs b/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs index c859e3955c84a..72bc6642b1a52 100644 --- a/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs +++ b/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs @@ -2930,7 +2930,7 @@ internal override void ReportInsertedMemberSymbolRudeEdits(List GetExceptionHandlingAncestors(SyntaxNode node, bool isLeaf) + protected override List GetExceptionHandlingAncestors(SyntaxNode node, bool isNonLeaf) { var result = new List(); @@ -2941,7 +2941,7 @@ protected override List GetExceptionHandlingAncestors(SyntaxNode nod switch (kind) { case SyntaxKind.TryStatement: - if (!isLeaf) + if (isNonLeaf) { result.Add(node); } @@ -3214,20 +3214,20 @@ internal override void ReportOtherRudeEditsAroundActiveStatement( Match match, SyntaxNode oldActiveStatement, SyntaxNode newActiveStatement, - bool isLeaf) + bool isNonLeaf) { - ReportRudeEditsForAncestorsDeclaringInterStatementTemps(diagnostics, match, oldActiveStatement, newActiveStatement, isLeaf); - ReportRudeEditsForCheckedStatements(diagnostics, oldActiveStatement, newActiveStatement, isLeaf); + ReportRudeEditsForAncestorsDeclaringInterStatementTemps(diagnostics, match, oldActiveStatement, newActiveStatement); + ReportRudeEditsForCheckedStatements(diagnostics, oldActiveStatement, newActiveStatement, isNonLeaf); } private void ReportRudeEditsForCheckedStatements( List diagnostics, SyntaxNode oldActiveStatement, SyntaxNode newActiveStatement, - bool isLeaf) + bool isNonLeaf) { - // checked context can be changed around leaf active statement: - if (isLeaf) + // checked context can't be changed around non-leaf active statement: + if (!isNonLeaf) { return; } @@ -3279,8 +3279,7 @@ private void ReportRudeEditsForAncestorsDeclaringInterStatementTemps( List diagnostics, Match match, SyntaxNode oldActiveStatement, - SyntaxNode newActiveStatement, - bool isLeaf) + SyntaxNode newActiveStatement) { // Rude Edits for fixed/using/lock/foreach statements that are added/updated around an active statement. // Although such changes are technically possible, they might lead to confusion since diff --git a/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs b/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs index ccb0e10bdf288..19835b9de5d54 100644 --- a/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs +++ b/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs @@ -232,13 +232,13 @@ protected abstract bool TryMatchActiveStatement( protected abstract string GetStatementDisplayName(SyntaxNode node, EditKind editKind); protected abstract string GetLambdaDisplayName(SyntaxNode lambda); protected abstract SymbolDisplayFormat ErrorDisplayFormat { get; } - protected abstract List GetExceptionHandlingAncestors(SyntaxNode node, bool isLeaf); + protected abstract List GetExceptionHandlingAncestors(SyntaxNode node, bool isNonLeaf); protected abstract void GetStateMachineInfo(SyntaxNode body, out ImmutableArray suspensionPoints, out StateMachineKind kind); protected abstract TextSpan GetExceptionHandlingRegion(SyntaxNode node, out bool coversAllChildren); internal abstract void ReportSyntacticRudeEdits(List diagnostics, Match match, Edit edit, Dictionary editMap); internal abstract void ReportEnclosingExceptionHandlingRudeEdits(List diagnostics, IEnumerable> exceptionHandlingEdits, SyntaxNode oldStatement, TextSpan newStatementSpan); - internal abstract void ReportOtherRudeEditsAroundActiveStatement(List diagnostics, Match match, SyntaxNode oldStatement, SyntaxNode newStatement, bool isLeaf); + internal abstract void ReportOtherRudeEditsAroundActiveStatement(List diagnostics, Match match, SyntaxNode oldStatement, SyntaxNode newStatement, bool isNonLeaf); internal abstract void ReportMemberUpdateRudeEdits(List diagnostics, SyntaxNode newMember, TextSpan? span); internal abstract void ReportInsertedMemberSymbolRudeEdits(List diagnostics, ISymbol newSymbol); internal abstract void ReportStateMachineSuspensionPointRudeEdits(List diagnostics, SyntaxNode oldNode, SyntaxNode newNode); @@ -295,7 +295,7 @@ protected abstract bool TryMatchActiveStatement( public async Task AnalyzeDocumentAsync( Solution baseSolution, - ImmutableArray baseActiveStatements, + ImmutableArray baseActiveStatements, Document document, CancellationToken cancellationToken) { @@ -341,7 +341,7 @@ public async Task AnalyzeDocumentAsync( var syntaxDiagnostics = newRoot.GetDiagnostics(); var syntaxErrorCount = syntaxDiagnostics.Count(d => d.Severity == DiagnosticSeverity.Error); - var newActiveStatements = new LinePositionSpan[baseActiveStatements.Length]; + var newActiveStatements = new ActiveStatement[baseActiveStatements.Length]; var newExceptionRegions = (syntaxErrorCount == 0) ? new ImmutableArray[baseActiveStatements.Length] : null; if (oldText.ContentEquals(newText)) @@ -514,9 +514,9 @@ public async Task AnalyzeDocumentAsync( // Active statements spans are usually unavailable in crash dumps due to a bug in the debugger (DevDiv #150901), // so we stash them here in plain array (can't use immutable, see the bug) just before we report NFW. - private static ActiveStatementSpan[] s_fatalErrorBaseActiveStatements; + private static ActiveStatement[] s_fatalErrorBaseActiveStatements; - private static bool ReportFatalErrorAnalyzeDocumentAsync(ImmutableArray baseActiveStatements, Exception e) + private static bool ReportFatalErrorAnalyzeDocumentAsync(ImmutableArray baseActiveStatements, Exception e) { if (!(e is OperationCanceledException)) { @@ -559,8 +559,8 @@ internal void AnalyzeSyntax( SourceText newText, DocumentId documentId, IActiveStatementTrackingService trackingService, - ImmutableArray oldActiveStatements, - [Out]LinePositionSpan[] newActiveStatements, + ImmutableArray oldActiveStatements, + [Out]ActiveStatement[] newActiveStatements, [Out]ImmutableArray[] newExceptionRegions, [Out]List updatedMethods, [Out]List diagnostics) @@ -570,23 +570,26 @@ internal void AnalyzeSyntax( Debug.Assert(updatedMethods != null); Debug.Assert(updatedMethods.Count == 0); - var updatedTrackingSpans = new List>(); - BitVector editedActiveStatements = BitVector.Create(newActiveStatements.Length); + var updatedTrackingSpans = ArrayBuilder<(ActiveStatementId, ActiveStatementTextSpan)>.GetInstance(); for (int i = 0; i < script.Edits.Length; i++) { var edit = script.Edits[i]; - AnalyzeUpdatedActiveMethodBodies(script, i, editMap, oldText, newText, documentId, trackingService, oldActiveStatements, ref editedActiveStatements, newActiveStatements, newExceptionRegions, updatedMethods, updatedTrackingSpans, diagnostics); + AnalyzeUpdatedActiveMethodBodies(script, i, editMap, oldText, newText, documentId, trackingService, oldActiveStatements,newActiveStatements, newExceptionRegions, updatedMethods, updatedTrackingSpans, diagnostics); ReportSyntacticRudeEdits(diagnostics, script.Match, edit, editMap); } - UpdateUneditedSpans(diagnostics, script.Match, oldText, newText, documentId, trackingService, oldActiveStatements, editedActiveStatements, newActiveStatements, newExceptionRegions, updatedTrackingSpans); + UpdateUneditedSpans(diagnostics, script.Match, oldText, newText, documentId, trackingService, oldActiveStatements, newActiveStatements, newExceptionRegions, updatedTrackingSpans); + + Debug.Assert(newActiveStatements.All(a => a != null)); if (updatedTrackingSpans.Count > 0) { trackingService.UpdateActiveStatementSpans(newText, updatedTrackingSpans); } + + updatedTrackingSpans.Free(); } private void UpdateUneditedSpans( @@ -596,11 +599,10 @@ private void UpdateUneditedSpans( SourceText newText, DocumentId documentId, IActiveStatementTrackingService trackingService, - ImmutableArray oldActiveStatements, - BitVector editedActiveStatements, - [In, Out]LinePositionSpan[] newActiveStatements, + ImmutableArray oldActiveStatements, + [In, Out]ActiveStatement[] newActiveStatements, [In, Out]ImmutableArray[] newExceptionRegions, - [In, Out]List> updatedTrackingSpans) + [In, Out]ArrayBuilder<(ActiveStatementId, ActiveStatementTextSpan)> updatedTrackingSpans) { Debug.Assert(oldActiveStatements.Length == newActiveStatements.Length); Debug.Assert(oldActiveStatements.Length == newExceptionRegions.Length); @@ -610,7 +612,7 @@ private void UpdateUneditedSpans( for (int i = 0; i < newActiveStatements.Length; i++) { - if (!editedActiveStatements[i]) + if (newActiveStatements[i] == null) { Contract.ThrowIfFalse(newExceptionRegions[i].IsDefault); TextSpan trackedSpan = default; @@ -619,6 +621,7 @@ private void UpdateUneditedSpans( if (!TryGetTextSpan(oldText.Lines, oldActiveStatements[i].Span, out var oldStatementSpan)) { DocumentAnalysisResults.Log.Write("Invalid active statement span: [{0}..{1})", oldStatementSpan.Start, oldStatementSpan.End); + newActiveStatements[i] = oldActiveStatements[i].WithSpan(default); newExceptionRegions[i] = ImmutableArray.Create(); continue; } @@ -629,6 +632,7 @@ private void UpdateUneditedSpans( if (oldMember == null) { DocumentAnalysisResults.Log.Write("Invalid active statement span: [{0}..{1})", oldStatementSpan.Start, oldStatementSpan.End); + newActiveStatements[i] = oldActiveStatements[i].WithSpan(default); newExceptionRegions[i] = ImmutableArray.Create(); continue; } @@ -643,6 +647,7 @@ private void UpdateUneditedSpans( if (oldBody == null || newBody == null) { DocumentAnalysisResults.Log.Write("Invalid active statement span: [{0}..{1})", oldStatementSpan.Start, oldStatementSpan.End); + newActiveStatements[i] = oldActiveStatements[i].WithSpan(default); newExceptionRegions[i] = ImmutableArray.Create(); continue; } @@ -682,7 +687,7 @@ private void UpdateUneditedSpans( if (diagnostics.Count == 0) { - List ancestors = GetExceptionHandlingAncestors(newStatement, oldActiveStatements[i].IsLeaf); + List ancestors = GetExceptionHandlingAncestors(newStatement, oldActiveStatements[i].IsNonLeaf); newExceptionRegions[i] = GetExceptionRegions(ancestors, newText); } @@ -691,12 +696,12 @@ private void UpdateUneditedSpans( // (e.g. In C# "const" was added to modifiers of a field with an initializer). TextSpan newStatementSpan = FindClosestActiveSpan(newStatement, statementPart); - newActiveStatements[i] = newText.Lines.GetLinePositionSpan(newStatementSpan); + newActiveStatements[i] = oldActiveStatements[i].WithSpan(newText.Lines.GetLinePositionSpan(newStatementSpan)); // Update tracking span if we found a matching active statement whose span is different. if (isTracked && newStatementSpan != trackedSpan) { - updatedTrackingSpans.Add(KeyValuePair.Create(new ActiveStatementId(documentId, i), newStatementSpan)); + updatedTrackingSpans.Add((new ActiveStatementId(documentId, i), new ActiveStatementTextSpan(oldActiveStatements[i].Flags, newStatementSpan))); } } } @@ -704,18 +709,18 @@ private void UpdateUneditedSpans( // internal for testing internal void AnalyzeUnchangedDocument( - ImmutableArray oldActiveStatements, + ImmutableArray oldActiveStatements, SourceText newText, SyntaxNode newRoot, DocumentId documentId, IActiveStatementTrackingService trackingService, - [In, Out]LinePositionSpan[] newActiveStatements, + [In, Out]ActiveStatement[] newActiveStatements, [In, Out]ImmutableArray[] newExceptionRegionsOpt) { Debug.Assert(oldActiveStatements.Length == newActiveStatements.Length); Debug.Assert(newExceptionRegionsOpt == null || oldActiveStatements.Length == newExceptionRegionsOpt.Length); - var updatedTrackingSpans = new List>(); + var updatedTrackingSpans = ArrayBuilder<(ActiveStatementId, ActiveStatementTextSpan)>.GetInstance(); // Active statements in methods that were not updated // are not changed but their spans might have been. @@ -725,6 +730,7 @@ internal void AnalyzeUnchangedDocument( if (!TryGetTextSpan(newText.Lines, oldActiveStatements[i].Span, out var oldStatementSpan) || !TryGetEnclosingBreakpointSpan(newRoot, oldStatementSpan.Start, out var newStatementSpan)) { + newActiveStatements[i] = oldActiveStatements[i].WithSpan(default); newExceptionRegionsOpt[i] = ImmutableArray.Empty; continue; } @@ -734,11 +740,12 @@ internal void AnalyzeUnchangedDocument( if (newExceptionRegionsOpt != null) { - List ancestors = GetExceptionHandlingAncestors(newNode, oldActiveStatements[i].IsLeaf); + List ancestors = GetExceptionHandlingAncestors(newNode, oldActiveStatements[i].IsNonLeaf); newExceptionRegionsOpt[i] = GetExceptionRegions(ancestors, newText); } - newActiveStatements[i] = newText.Lines.GetLinePositionSpan(newStatementSpan); + newActiveStatements[i] = oldActiveStatements[i].WithSpan(newText.Lines.GetLinePositionSpan(newStatementSpan)); + // Update tracking span if we found a matching active statement whose span is different. TextSpan trackedSpan = default; bool isTracked = trackingService != null && @@ -746,7 +753,7 @@ internal void AnalyzeUnchangedDocument( if (isTracked && newStatementSpan != trackedSpan) { - updatedTrackingSpans.Add(KeyValuePair.Create(new ActiveStatementId(documentId, i), newStatementSpan)); + updatedTrackingSpans.Add((new ActiveStatementId(documentId, i), new ActiveStatementTextSpan(oldActiveStatements[i].Flags, newStatementSpan))); } } @@ -754,6 +761,8 @@ internal void AnalyzeUnchangedDocument( { trackingService.UpdateActiveStatementSpans(newText, updatedTrackingSpans); } + + updatedTrackingSpans.Free(); } // internal for testing @@ -864,12 +873,11 @@ private void AnalyzeUpdatedActiveMethodBodies( SourceText newText, DocumentId documentId, IActiveStatementTrackingService trackingService, - ImmutableArray oldActiveStatements, - ref BitVector editedActiveStatements, - [Out]LinePositionSpan[] newActiveStatements, + ImmutableArray oldActiveStatements, + [Out]ActiveStatement[] newActiveStatements, [Out]ImmutableArray[] newExceptionRegions, [Out]List updatedMembers, - [Out]List> updatedTrackingSpans, + [Out]ArrayBuilder<(ActiveStatementId, ActiveStatementTextSpan)> updatedTrackingSpans, [Out]List diagnostics) { Debug.Assert(oldActiveStatements.Length == newActiveStatements.Length); @@ -907,8 +915,7 @@ private void AnalyzeUpdatedActiveMethodBodies( // TODO: VB field multi-initializers break this // Debug.Assert(newActiveStatements[i] == default(LinePositionSpan)); - newActiveStatements[i] = newText.Lines.GetLinePositionSpan(newSpan); - editedActiveStatements[i] = true; + newActiveStatements[i] = oldActiveStatements[i].WithSpan(newText.Lines.GetLinePositionSpan(newSpan)); newExceptionRegions[i] = ImmutableArray.Create(); } } @@ -925,9 +932,8 @@ private void AnalyzeUpdatedActiveMethodBodies( var newSpan = FindClosestActiveSpan(edit.NewNode, 0); for (int i = start; i < end; i++) { - Debug.Assert(newActiveStatements[i] == default && newSpan != default); - newActiveStatements[i] = newText.Lines.GetLinePositionSpan(newSpan); - editedActiveStatements[i] = true; + Debug.Assert(newActiveStatements[i] == null && newSpan != default); + newActiveStatements[i] = oldActiveStatements[i].WithSpan(newText.Lines.GetLinePositionSpan(newSpan)); newExceptionRegions[i] = ImmutableArray.Create(); } } @@ -946,7 +952,7 @@ private void AnalyzeUpdatedActiveMethodBodies( for (int i = 0; i < activeNodes.Length; i++) { int ordinal = start + i; - var oldStatementStart = oldText.Lines.GetTextSpan(oldActiveStatements[ordinal].Span).Start; + var oldStatementStart = oldText.Lines.GetTextSpanSafe(oldActiveStatements[ordinal].Span).Start; var oldStatementSyntax = FindStatement(oldBody, oldStatementStart, out var statementPart); Contract.ThrowIfNull(oldStatementSyntax); @@ -1012,7 +1018,7 @@ private void AnalyzeUpdatedActiveMethodBodies( { int ordinal = start + i; bool hasMatching = false; - bool isLeaf = (oldActiveStatements[ordinal].Flags & ActiveStatementFlags.LeafFrame) != 0; + bool isNonLeaf = oldActiveStatements[ordinal].IsNonLeaf; bool isPartiallyExecuted = (oldActiveStatements[ordinal].Flags & ActiveStatementFlags.PartiallyExecuted) != 0; int statementPart = activeNodes[i].StatementPart; var oldStatementSyntax = activeNodes[i].OldNode; @@ -1059,14 +1065,14 @@ private void AnalyzeUpdatedActiveMethodBodies( // E.g. "const" keyword is inserted into a local variable declaration with an initializer. newSpan = FindClosestActiveSpan(newStatementSyntaxOpt, statementPart); - if ((!isLeaf || isPartiallyExecuted) && !AreEquivalentActiveStatements(oldStatementSyntax, newStatementSyntaxOpt, statementPart)) + if ((isNonLeaf || isPartiallyExecuted) && !AreEquivalentActiveStatements(oldStatementSyntax, newStatementSyntaxOpt, statementPart)) { - // rude edit: internal active statement changed - diagnostics.Add(new RudeEditDiagnostic(isLeaf ? RudeEditKind.PartiallyExecutedActiveStatementUpdate : RudeEditKind.ActiveStatementUpdate, newSpan)); + // rude edit: non-leaf active statement changed + diagnostics.Add(new RudeEditDiagnostic(isNonLeaf ? RudeEditKind.ActiveStatementUpdate : RudeEditKind.PartiallyExecutedActiveStatementUpdate, newSpan)); } // other statements around active statement: - ReportOtherRudeEditsAroundActiveStatement(diagnostics, match, oldStatementSyntax, newStatementSyntaxOpt, isLeaf); + ReportOtherRudeEditsAroundActiveStatement(diagnostics, match, oldStatementSyntax, newStatementSyntaxOpt, isNonLeaf); } else if (match == null) { @@ -1083,11 +1089,11 @@ private void AnalyzeUpdatedActiveMethodBodies( { newSpan = GetDeletedNodeActiveSpan(match.Matches, oldStatementSyntax); - if (!isLeaf || isPartiallyExecuted) + if (isNonLeaf || isPartiallyExecuted) { // rude edit: internal active statement deleted diagnostics.Add( - new RudeEditDiagnostic(isLeaf ? RudeEditKind.PartiallyExecutedActiveStatementDelete : RudeEditKind.DeleteActiveStatement, + new RudeEditDiagnostic(isNonLeaf ? RudeEditKind.DeleteActiveStatement : RudeEditKind.PartiallyExecutedActiveStatementDelete, GetDeletedNodeDiagnosticSpan(match.Matches, oldStatementSyntax))); } } @@ -1100,19 +1106,19 @@ private void AnalyzeUpdatedActiveMethodBodies( newSpan, ordinal, newText, - isLeaf, + isNonLeaf, newExceptionRegions, diagnostics); - Debug.Assert(newActiveStatements[ordinal] == default && newSpan != default); - newActiveStatements[ordinal] = newText.Lines.GetLinePositionSpan(newSpan); - editedActiveStatements[ordinal] = true; + Debug.Assert(newActiveStatements[ordinal] == null && newSpan != default); + + newActiveStatements[ordinal] = oldActiveStatements[ordinal].WithSpan(newText.Lines.GetLinePositionSpan(newSpan)); // Update tracking span if we found a matching active statement whose span is different. // It could have been deleted or moved out of the method/lambda body, in which case we set it to empty. if (activeNodes[i].TrackedSpanOpt.HasValue && activeNodes[i].TrackedSpanOpt.Value != newSpan) { - updatedTrackingSpans.Add(KeyValuePair.Create(new ActiveStatementId(documentId, ordinal), newSpan)); + updatedTrackingSpans.Add((new ActiveStatementId(documentId, ordinal), new ActiveStatementTextSpan(oldActiveStatements[ordinal].Flags, newSpan))); } } } @@ -1124,7 +1130,7 @@ private void CalculateExceptionRegionsAroundActiveStatement( TextSpan newStatementSyntaxSpan, int ordinal, SourceText newText, - bool isLeaf, + bool isNonLeaf, ImmutableArray[] newExceptionRegions, List diagnostics) { @@ -1138,8 +1144,8 @@ private void CalculateExceptionRegionsAroundActiveStatement( return; } - var oldAncestors = GetExceptionHandlingAncestors(oldStatementSyntax, isLeaf); - var newAncestors = GetExceptionHandlingAncestors(newStatementSyntaxOpt, isLeaf); + var oldAncestors = GetExceptionHandlingAncestors(oldStatementSyntax, isNonLeaf); + var newAncestors = GetExceptionHandlingAncestors(newStatementSyntaxOpt, isNonLeaf); if (oldAncestors.Count > 0 || newAncestors.Count > 0) { @@ -1446,27 +1452,27 @@ private void AddMatchingStateMachineSuspensionPoints( } } - ImmutableArray IEditAndContinueAnalyzer.GetExceptionRegions(SourceText text, SyntaxNode syntaxRoot, LinePositionSpan activeStatementSpan, bool isLeaf) + public ImmutableArray GetExceptionRegions(SourceText text, SyntaxNode syntaxRoot, LinePositionSpan activeStatementSpan, bool isNonLeaf, out bool isCovered) { - return GetExceptionRegions(text, syntaxRoot, activeStatementSpan, isLeaf); - } - - internal ImmutableArray GetExceptionRegions(SourceText text, SyntaxNode syntaxRoot, LinePositionSpan activeStatementSpan, bool isLeaf) - { - var textSpan = text.Lines.GetTextSpan(activeStatementSpan); + var textSpan = text.Lines.GetTextSpanSafe(activeStatementSpan); var token = syntaxRoot.FindToken(textSpan.Start); - var ancestors = GetExceptionHandlingAncestors(token.Parent, isLeaf); - return GetExceptionRegions(ancestors, text); + var ancestors = GetExceptionHandlingAncestors(token.Parent, isNonLeaf); + return GetExceptionRegions(ancestors, text, out isCovered); } private ImmutableArray GetExceptionRegions(List exceptionHandlingAncestors, SourceText text) + => GetExceptionRegions(exceptionHandlingAncestors, text, out _); + + private ImmutableArray GetExceptionRegions(List exceptionHandlingAncestors, SourceText text, out bool isCovered) { + isCovered = false; + if (exceptionHandlingAncestors.Count == 0) { return ImmutableArray.Create(); } - var result = new List(); + var result = ArrayBuilder.GetInstance(); for (int i = exceptionHandlingAncestors.Count - 1; i >= 0; i--) { @@ -1475,14 +1481,15 @@ private ImmutableArray GetExceptionRegions(List ex result.Add(text.Lines.GetLinePositionSpan(span)); // Exception regions describe regions of code that can't be edited. - // If the span covers all of the nodes children we don't need to descend further. + // If the span covers all the children nodes we don't need to descend further. if (coversAllChildren) { + isCovered = true; break; } } - return result.AsImmutable(); + return result.ToImmutableAndFree(); } private TextSpan GetDeletedNodeDiagnosticSpan(SyntaxNode deletedLambdaBody, Match match, Dictionary lambdaInfos) @@ -1586,7 +1593,7 @@ private static bool TryGetMatchingAncestor(IReadOnlyDictionary statements, + ImmutableArray statements, out int start, out int end) { @@ -1595,7 +1602,7 @@ protected virtual bool TryGetOverlappingActiveStatements( // TODO (tomat): use BinarySearch int i = 0; - while (i < statements.Length && !declarationSpan.OverlapsWith(lines.GetTextSpan(statements[i].Span))) + while (i < statements.Length && !declarationSpan.OverlapsWith(lines.GetTextSpanSafe(statements[i].Span))) { i++; } @@ -1609,7 +1616,7 @@ protected virtual bool TryGetOverlappingActiveStatements( start = i; i++; - while (i < statements.Length && declarationSpan.OverlapsWith(lines.GetTextSpan(statements[i].Span))) + while (i < statements.Length && declarationSpan.OverlapsWith(lines.GetTextSpanSafe(statements[i].Span))) { i++; } @@ -2085,7 +2092,7 @@ internal void AnalyzeSemantics( EditScript editScript, Dictionary editMap, SourceText oldText, - ImmutableArray oldActiveStatements, + ImmutableArray oldActiveStatements, List> triviaEdits, List updatedMembers, SemanticModel oldModel, @@ -2481,7 +2488,6 @@ internal void AnalyzeSemantics( editScript.Match, oldText, oldModel, - oldActiveStatements, newSymbolsWithEdit, isStatic: false, semanticEdits: semanticEdits, @@ -2496,7 +2502,6 @@ internal void AnalyzeSemantics( editScript.Match, oldText, oldModel, - oldActiveStatements, newSymbolsWithEdit, isStatic: true, semanticEdits: semanticEdits, @@ -2810,7 +2815,6 @@ private void AddConstructorEdits( Match topMatch, SourceText oldText, SemanticModel oldModel, - ImmutableArray oldActiveStatements, HashSet newSymbolsWithEdit, bool isStatic, [Out]List semanticEdits, diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveInstructionId.cs b/src/Features/Core/Portable/EditAndContinue/ActiveInstructionId.cs new file mode 100644 index 0000000000000..816483c8f4f13 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/ActiveInstructionId.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.EditAndContinue +{ + [DebuggerDisplay("{GetDebuggerDisplay(),nq}")] + internal readonly struct ActiveInstructionId : IEquatable + { + public readonly ActiveMethodId MethodId; + public readonly int ILOffset; + + public ActiveInstructionId(Guid moduleId, int methodToken, int methodVersion, int ilOffset) + { + MethodId = new ActiveMethodId(moduleId, methodToken, methodVersion); + ILOffset = ilOffset; + } + + public override bool Equals(object obj) + => obj is ActiveInstructionId && Equals((ActiveInstructionId)obj); + + public bool Equals(ActiveInstructionId other) + => ILOffset == other.ILOffset && + MethodId == other.MethodId; + + public override int GetHashCode() + => Hash.Combine(MethodId.GetHashCode(), ILOffset); + + public static bool operator ==(ActiveInstructionId left, ActiveInstructionId right) => left.Equals(right); + public static bool operator !=(ActiveInstructionId left, ActiveInstructionId right) => !left.Equals(right); + + internal string GetDebuggerDisplay() + => $"{MethodId.GetDebuggerDisplay()} IL_{ILOffset:X4}"; + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveMethodId.cs b/src/Features/Core/Portable/EditAndContinue/ActiveMethodId.cs new file mode 100644 index 0000000000000..45cf5faaf8f87 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/ActiveMethodId.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.EditAndContinue +{ + [DebuggerDisplay("{GetDebuggerDisplay(),nq}")] + internal struct ActiveMethodId : IEquatable + { + public readonly Guid ModuleId; + public readonly int Token; + public readonly int Version; + + public ActiveMethodId(Guid moduleId, int token, int version) + { + ModuleId = moduleId; + Token = token; + Version = version; + } + + public override bool Equals(object obj) + => obj is ActiveMethodId && Equals((ActiveMethodId)obj); + + public bool Equals(ActiveMethodId other) + => Token == other.Token && + Version == other.Version && + ModuleId.Equals(other.ModuleId); + + public override int GetHashCode() + => Hash.Combine(ModuleId.GetHashCode(), Hash.Combine(Token, Version)); + + public static bool operator ==(ActiveMethodId left, ActiveMethodId right) => left.Equals(right); + public static bool operator !=(ActiveMethodId left, ActiveMethodId right) => !left.Equals(right); + + internal string GetDebuggerDisplay() + => $"mvid={ModuleId} 0x{Token:X8} v{Version}"; + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveStatement.cs b/src/Features/Core/Portable/EditAndContinue/ActiveStatement.cs new file mode 100644 index 0000000000000..06e705708b09c --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/ActiveStatement.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Immutable; +using System.Diagnostics; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.EditAndContinue +{ + /// + /// Represents an instruction range in the code that contains an active instruction of at least one thread and that is delimited by consecutive sequence points. + /// More than one thread can share the same instance of . + /// + internal sealed class ActiveStatement + { + /// + /// Ordinal of the active statement within the set of all active statements. + /// + public readonly int Ordinal; + + /// + /// Ordinal of the active statement within the primary containing document (). + /// + public readonly int PrimaryDocumentOrdinal; + + /// + /// The instruction of the active statement that is being executed. + /// The executing version of the method might be several generations old. + /// E.g. when the thread is executing an exception handling region and hasn't been remapped yet. + /// + public readonly ActiveInstructionId InstructionId; + + /// + /// The current source span. + /// + public readonly LinePositionSpan Span; + + /// + /// Document ids - multiple if the physical file is linked. + /// TODO: currently we associate all linked documents to the regardless of whether they belong to a project that matches the AS module. + /// https://github.com/dotnet/roslyn/issues/24320 + /// + public readonly ImmutableArray DocumentIds; + + /// + /// Threads that share the instruction. May contain duplicates in case a thread is executing a function recursively. + /// + public readonly ImmutableArray ThreadIds; + + /// + /// Aggregated across . + /// + public readonly ActiveStatementFlags Flags; + + public ActiveStatement(int ordinal, int primaryDocumentOrdinal, ImmutableArray documentIds, ActiveStatementFlags flags, LinePositionSpan span, ActiveInstructionId instructionId, ImmutableArray threadIds) + { + Debug.Assert(ordinal >= 0); + Debug.Assert(primaryDocumentOrdinal >= 0); + Debug.Assert(!documentIds.IsDefaultOrEmpty); + + Ordinal = ordinal; + PrimaryDocumentOrdinal = primaryDocumentOrdinal; + DocumentIds = documentIds; + Flags = flags; + Span = span; + ThreadIds = threadIds; + InstructionId = instructionId; + } + + /// + /// True if at least one of the threads whom this active statement belongs to is in a leaf frame. + /// + public bool IsLeaf => (Flags & ActiveStatementFlags.IsLeafFrame) != 0; + + /// + /// True if at least one of the threads whom this active statement belongs to is in a non-leaf frame. + /// + public bool IsNonLeaf => (Flags & ActiveStatementFlags.IsNonLeafFrame) != 0; + + public bool IsMethodUpToDate => (Flags & ActiveStatementFlags.MethodUpToDate) != 0; + + public DocumentId PrimaryDocumentId => DocumentIds[0]; + + internal ActiveStatement WithSpan(LinePositionSpan span) + => new ActiveStatement(Ordinal, PrimaryDocumentOrdinal, DocumentIds, Flags, span, InstructionId, ThreadIds); + + internal ActiveStatement WithFlags(ActiveStatementFlags flags) + => new ActiveStatement(Ordinal, PrimaryDocumentOrdinal, DocumentIds, flags, Span, InstructionId, ThreadIds); + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveStatementDebugInfo.cs b/src/Features/Core/Portable/EditAndContinue/ActiveStatementDebugInfo.cs new file mode 100644 index 0000000000000..7817af827a293 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/ActiveStatementDebugInfo.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Immutable; +using System.Diagnostics; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.EditAndContinue +{ + /// + /// Active statement debug information retrieved from the runtime and the PDB. + /// + internal readonly struct ActiveStatementDebugInfo + { + /// + /// The instruction of the active statement that is being executed. + /// + public readonly ActiveInstructionId InstructionId; + + /// + /// Document name as found in the PDB, or null if the debugger can't determine the location of the active statement. + /// + public readonly string DocumentNameOpt; + + /// + /// Location of the closest non-hidden sequence point retrieved from the PDB, + /// or default() if the debugger can't determine the location of the active statement. + /// + public readonly LinePositionSpan LinePositionSpan; + + /// + /// Aggregated across . + /// + public readonly ActiveStatementFlags Flags; + + /// + /// Threads that share the instruction. May contain duplicates in case a thread is executing a function recursively. + /// + public readonly ImmutableArray ThreadIds; + + public ActiveStatementDebugInfo( + ActiveInstructionId instructionId, + string documentNameOpt, + LinePositionSpan linePositionSpan, + ImmutableArray threadIds, + ActiveStatementFlags flags) + { + Debug.Assert(!threadIds.IsDefaultOrEmpty); + + ThreadIds = threadIds; + InstructionId = instructionId; + Flags = flags; + DocumentNameOpt = documentNameOpt; + LinePositionSpan = linePositionSpan; + } + + public bool HasSourceLocation => DocumentNameOpt != null; + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveStatementExceptionRegions.cs b/src/Features/Core/Portable/EditAndContinue/ActiveStatementExceptionRegions.cs new file mode 100644 index 0000000000000..548e87252effe --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/ActiveStatementExceptionRegions.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.EditAndContinue +{ + internal struct ActiveStatementExceptionRegions + { + /// + /// Exception region spans corresponding to an active statement. + /// + public readonly ImmutableArray Spans; + + /// + /// True if the active statement is covered by any of the exception region spans. + /// + public readonly bool IsActiveStatementCovered; + + public ActiveStatementExceptionRegions(ImmutableArray spans, bool isActiveStatementCovered) + { + Spans = spans; + IsActiveStatementCovered = isActiveStatementCovered; + } + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveStatementFlags.cs b/src/Features/Core/Portable/EditAndContinue/ActiveStatementFlags.cs index a16fe2732004c..f2eae6012d120 100644 --- a/src/Features/Core/Portable/EditAndContinue/ActiveStatementFlags.cs +++ b/src/Features/Core/Portable/EditAndContinue/ActiveStatementFlags.cs @@ -10,9 +10,9 @@ internal enum ActiveStatementFlags None = 0, /// - /// The statement is in a leaf frame. + /// At least one of the threads whom this active statement belongs to is in a leaf frame. /// - LeafFrame = 1, + IsLeafFrame = 1, /// /// The statement is partially executed. @@ -30,5 +30,21 @@ internal enum ActiveStatementFlags /// The statement IL is not in user code. /// NonUserCode = 4, + + /// + /// Indicates that the active statement instruction belongs to the latest version of the containing method. + /// If not set, the containing method was updated but the active statement was not remapped yet because the thread + /// has not returned to that instruction yet and was not remapped to the new version. + /// + /// + /// When the debugger asks the CLR for the active statement information it compares ICorDebugFunction.GetVersionNumber() + /// and ICorDebugFunction.GetCurrentVersionNumber() to determine the value of this flag. + /// + MethodUpToDate = 8, + + /// + /// At least one of the threads whom this active statement belongs to is in a non-leaf frame. + /// + IsNonLeafFrame = 16, } } diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveStatementId.cs b/src/Features/Core/Portable/EditAndContinue/ActiveStatementId.cs index a93add75a6068..6d7835577783c 100644 --- a/src/Features/Core/Portable/EditAndContinue/ActiveStatementId.cs +++ b/src/Features/Core/Portable/EditAndContinue/ActiveStatementId.cs @@ -2,15 +2,15 @@ namespace Microsoft.CodeAnalysis.EditAndContinue { - internal struct ActiveStatementId + internal readonly struct ActiveStatementId { public readonly DocumentId DocumentId; public readonly int Ordinal; public ActiveStatementId(DocumentId documentId, int ordinal) { - this.DocumentId = documentId; - this.Ordinal = ordinal; + DocumentId = documentId; + Ordinal = ordinal; } } } diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveStatementSpan.cs b/src/Features/Core/Portable/EditAndContinue/ActiveStatementSpan.cs deleted file mode 100644 index 238bc9ec635e9..0000000000000 --- a/src/Features/Core/Portable/EditAndContinue/ActiveStatementSpan.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.Text; - -namespace Microsoft.CodeAnalysis.EditAndContinue -{ - internal struct ActiveStatementSpan - { - public readonly ActiveStatementFlags Flags; - public readonly LinePositionSpan Span; - - public ActiveStatementSpan(ActiveStatementFlags flags, LinePositionSpan span) - { - this.Flags = flags; - this.Span = span; - } - - public bool IsLeaf - { - get - { - return (Flags & ActiveStatementFlags.LeafFrame) != 0; - } - } - } -} diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveStatementTextSpan.cs b/src/Features/Core/Portable/EditAndContinue/ActiveStatementTextSpan.cs index 44ac956e361a1..2a79040e6c95e 100644 --- a/src/Features/Core/Portable/EditAndContinue/ActiveStatementTextSpan.cs +++ b/src/Features/Core/Portable/EditAndContinue/ActiveStatementTextSpan.cs @@ -11,8 +11,18 @@ internal struct ActiveStatementTextSpan public ActiveStatementTextSpan(ActiveStatementFlags flags, TextSpan span) { - this.Flags = flags; - this.Span = span; + Flags = flags; + Span = span; } + + /// + /// True if at least one of the threads whom this active statement belongs to is in a leaf frame. + /// + public bool IsLeaf => (Flags & ActiveStatementFlags.IsLeafFrame) != 0; + + /// + /// True if at least one of the threads whom this active statement belongs to is in a non-leaf frame. + /// + public bool IsNonLeaf => (Flags & ActiveStatementFlags.IsNonLeafFrame) != 0; } } diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveStatementsMap.cs b/src/Features/Core/Portable/EditAndContinue/ActiveStatementsMap.cs new file mode 100644 index 0000000000000..84ebab6a74e51 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/ActiveStatementsMap.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; + +namespace Microsoft.CodeAnalysis.EditAndContinue +{ + internal readonly struct ActiveStatementsMap + { + /// + /// Groups active statements by document. + /// Multiple documents point to the same set of active statements if they are linked to the same underlying source file. + /// + public readonly IReadOnlyDictionary> DocumentMap; + + /// + /// Active statements by instruction id. + /// + public readonly IReadOnlyDictionary InstructionMap; + + public ActiveStatementsMap( + IReadOnlyDictionary> documentMap, + IReadOnlyDictionary instructionMap) + { + Debug.Assert(documentMap != null); + Debug.Assert(instructionMap != null); + + DocumentMap = documentMap; + InstructionMap = instructionMap; + } + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs b/src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs index 498efe76caf90..50a175a8260cb 100644 --- a/src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs +++ b/src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs @@ -9,15 +9,12 @@ namespace Microsoft.CodeAnalysis.EditAndContinue /// internal sealed class DebuggingSession { - private readonly Solution _initialSolution; + public readonly Solution InitialSolution; internal DebuggingSession(Solution initialSolution) { Debug.Assert(initialSolution != null); - - _initialSolution = initialSolution; + InitialSolution = initialSolution; } - - internal Solution InitialSolution => _initialSolution; } } diff --git a/src/Features/Core/Portable/EditAndContinue/Deltas.cs b/src/Features/Core/Portable/EditAndContinue/Deltas.cs index a6d34d508d3af..31b322155865e 100644 --- a/src/Features/Core/Portable/EditAndContinue/Deltas.cs +++ b/src/Features/Core/Portable/EditAndContinue/Deltas.cs @@ -1,9 +1,10 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Collections.Generic; +using System; using System.Collections.Immutable; using System.IO; using Microsoft.CodeAnalysis.Emit; +using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.EditAndContinue { @@ -12,23 +13,29 @@ internal sealed class Deltas public readonly ILDelta IL; public readonly MetadataDelta Metadata; - public readonly List>> LineEdits; + public readonly ImmutableArray<(DocumentId, ImmutableArray)> LineEdits; public readonly PdbDelta Pdb; public readonly EmitDifferenceResult EmitResult; + public readonly ImmutableArray<(ActiveMethodId Method, NonRemappableRegion Region)> NonRemappableRegions; + public readonly ImmutableArray<(Guid ThreadId, ActiveInstructionId OldInstructionId, LinePositionSpan NewSpan)> ActiveStatementsInUpdatedMethods; public Deltas( byte[] il, byte[] metadata, - int[] updatedMethods, MemoryStream pdb, - List>> lineEdits, + int[] updatedMethods, + ImmutableArray<(DocumentId, ImmutableArray)> lineEdits, + ImmutableArray<(ActiveMethodId, NonRemappableRegion)> nonRemappableRegions, + ImmutableArray<(Guid ThreadId, ActiveInstructionId OldInstructionId, LinePositionSpan NewSpan)> activeStatementsInUpdatedMethods, EmitDifferenceResult emitResult) { - this.IL = new ILDelta(il); - this.Metadata = new MetadataDelta(metadata); - this.Pdb = new PdbDelta(pdb, updatedMethods); - this.EmitResult = emitResult; - this.LineEdits = lineEdits; + IL = new ILDelta(il); + Metadata = new MetadataDelta(metadata); + Pdb = new PdbDelta(pdb, updatedMethods); + NonRemappableRegions = nonRemappableRegions; + ActiveStatementsInUpdatedMethods = activeStatementsInUpdatedMethods; + EmitResult = emitResult; + LineEdits = lineEdits; } } } diff --git a/src/Features/Core/Portable/EditAndContinue/DocumentAnalysisResults.cs b/src/Features/Core/Portable/EditAndContinue/DocumentAnalysisResults.cs index 92272498934dc..74226fbf00d34 100644 --- a/src/Features/Core/Portable/EditAndContinue/DocumentAnalysisResults.cs +++ b/src/Features/Core/Portable/EditAndContinue/DocumentAnalysisResults.cs @@ -2,6 +2,7 @@ using System.Collections.Immutable; using System.Diagnostics; +using System.Linq; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Text; @@ -12,7 +13,7 @@ internal sealed class DocumentAnalysisResults /// /// Spans of active statements in the document, or null if the document has syntax errors. /// - public readonly ImmutableArray ActiveStatements; + public readonly ImmutableArray ActiveStatements; /// /// Diagnostics for rude edits in the document, or null if the document is unchanged or has syntax errors. @@ -45,6 +46,7 @@ internal sealed class DocumentAnalysisResults /// For example: /// try { } |finally { try { ... AS ... } catch { } }| /// try { } |finally { try { } catch { ... AS ... } }| + /// try { try { } |finally { ... AS ... }| } |catch { } catch { } finally { }| /// public readonly ImmutableArray> ExceptionRegions; @@ -71,7 +73,7 @@ private DocumentAnalysisResults(ImmutableArray rudeEdits) } public DocumentAnalysisResults( - ImmutableArray activeStatements, + ImmutableArray activeStatements, ImmutableArray rudeEdits, ImmutableArray semanticEditsOpt, ImmutableArray> exceptionRegionsOpt, @@ -79,6 +81,7 @@ public DocumentAnalysisResults( bool? hasSemanticErrors) { Debug.Assert(!activeStatements.IsDefault); + Debug.Assert(activeStatements.All(a => a != null)); if (hasSemanticErrors.HasValue) { @@ -147,7 +150,7 @@ public static DocumentAnalysisResults SyntaxErrors(ImmutableArray activeStatements, + ImmutableArray activeStatements, ImmutableArray> exceptionRegionsOpt) { return new DocumentAnalysisResults( @@ -160,7 +163,7 @@ public static DocumentAnalysisResults Unchanged( } public static DocumentAnalysisResults Errors( - ImmutableArray activeStatements, + ImmutableArray activeStatements, ImmutableArray rudeEdits, bool hasSemanticErrors = false) { diff --git a/src/Features/Core/Portable/EditAndContinue/EditAndContinueService.cs b/src/Features/Core/Portable/EditAndContinue/EditAndContinueService.cs index e7552cfc120e4..acfbda413e6a8 100644 --- a/src/Features/Core/Portable/EditAndContinue/EditAndContinueService.cs +++ b/src/Features/Core/Portable/EditAndContinue/EditAndContinueService.cs @@ -1,10 +1,16 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; +using System.Linq; using System.Threading; +using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.ErrorReporting; +using Microsoft.CodeAnalysis.Text; +using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.EditAndContinue { @@ -18,14 +24,49 @@ namespace Microsoft.CodeAnalysis.EditAndContinue /// internal class EditAndContinueService : IEditAndContinueService { + private readonly IActiveStatementProvider _activeStatementProvider; private readonly IDiagnosticAnalyzerService _diagnosticService; private DebuggingSession _debuggingSession; private EditSession _editSession; - public EditAndContinueService(IDiagnosticAnalyzerService diagnosticService) + // TODO: + // Maps active statement instructions to their latest spans. + // + // Consider a function F containing a call to function G that is updated a couple of times + // before the thread returns from G and is remapped to the latest version of F. + // '>' indicates an active statement instruction. + // + // F v1: F v2: F v3: + // 0: nop 0: nop 0: nop + // 1> G() 1: nop 1: nop + // 2: nop 2: G() 2: nop + // 3: nop 3: nop 3> G() + // + // When entering a break state we query the debugger for current active statements. + // The returned statements reflect the current state of the threads in the runtime. + // When a change is successfully applied we remember changes in active statement spans. + // These changes are passed to the next edit session. + // We use them to map the spans for active statements returned by the debugger. + // + // In the above case the sequence of events is + // 1st break: get active statements returns (F, v=1, il=1, span1) the active statement is up-to-date + // 1st apply: detected span change for active statement (F, v=1, il=1): span1->span2 + // 2nd break: previously updated statements contains (F, v=1, il=1)->span2 + // get active statements returns (F, v=1, il=1, span1) which is mapped to (F, v=1, il=1, span2) using previously updated statements + // 2nd apply: detected span change for active statement (F, v=1, il=1): span2->span3 + // 3rd break: previously updated statements contains (F, v=1, il=1)->span3 + // get active statements returns (F, v=3, il=3, span3) the active statement is up-to-date + // + private ImmutableDictionary> _nonRemappableRegions; + + internal EditAndContinueService(IDiagnosticAnalyzerService diagnosticService, IActiveStatementProvider activeStatementProvider) { Debug.Assert(diagnosticService != null); + Debug.Assert(activeStatementProvider != null); + _diagnosticService = diagnosticService; + _activeStatementProvider = activeStatementProvider; + _nonRemappableRegions = ImmutableDictionary>.Empty; } public DebuggingSession DebuggingSession => _debuggingSession; @@ -34,37 +75,41 @@ public EditAndContinueService(IDiagnosticAnalyzerService diagnosticService) public void StartDebuggingSession(Solution currentSolution) { - Debug.Assert(_debuggingSession == null && _editSession == null); + Contract.ThrowIfNull(currentSolution); - Interlocked.CompareExchange(ref _debuggingSession, new DebuggingSession(currentSolution), null); + var previousSession = Interlocked.CompareExchange(ref _debuggingSession, new DebuggingSession(currentSolution), null); + Contract.ThrowIfFalse(previousSession == null, "New debugging session can't be started until the existing one has ended."); // TODO(tomat): allow changing documents } public void StartEditSession( Solution currentSolution, - IReadOnlyDictionary> activeStatements, ImmutableDictionary projects, bool stoppedAtException) { - Debug.Assert(_debuggingSession != null && _editSession == null); + Contract.ThrowIfNull(currentSolution); - var newSession = new EditSession(currentSolution, activeStatements, _debuggingSession, projects, stoppedAtException); + var newSession = new EditSession( + currentSolution, + _debuggingSession, + _activeStatementProvider, + projects, + _nonRemappableRegions, + stoppedAtException); - Interlocked.CompareExchange(ref _editSession, newSession, null); + var previousSession = Interlocked.CompareExchange(ref _editSession, newSession, null); + Contract.ThrowIfFalse(previousSession == null, "New edit session can't be started until the existing one has ended."); // TODO(tomat): allow changing documents // TODO(tomat): document added } - public void EndEditSession() + public void EndEditSession(ImmutableDictionary> newRemappableRegionsOpt) { - Debug.Assert(_debuggingSession != null && _editSession != null); - - var session = _editSession; - // first, publish null session: - _editSession = null; + var session = Interlocked.Exchange(ref _editSession, null); + Contract.ThrowIfNull(session, "Edit session has not started."); // then cancel all ongoing work bound to the session: session.Cancellation.Cancel(); @@ -72,13 +117,20 @@ public void EndEditSession() // then clear all reported rude edits: _diagnosticService.Reanalyze(_debuggingSession.InitialSolution.Workspace, documentIds: session.GetDocumentsWithReportedRudeEdits()); + // Save new non-remappable regions for the next edit session. + // If no edits were made keep the previous regions. + if (newRemappableRegionsOpt != null) + { + _nonRemappableRegions = newRemappableRegionsOpt; + } + // TODO(tomat): allow changing documents } public void EndDebuggingSession() { - Debug.Assert(_debuggingSession != null && _editSession == null); - _debuggingSession = null; + var session = Interlocked.Exchange(ref _debuggingSession, null); + Contract.ThrowIfNull(session, "Debugging session has not started."); } public bool IsProjectReadOnly(ProjectId id, out SessionReadOnlyReason sessionReason, out ProjectReadOnlyReason projectReason) @@ -118,5 +170,75 @@ public bool IsProjectReadOnly(ProjectId id, out SessionReadOnlyReason sessionRea projectReason = ProjectReadOnlyReason.MetadataNotAvailable; return true; } + + public async Task GetCurrentActiveStatementPositionAsync(ActiveInstructionId instructionId, CancellationToken cancellationToken) + { + try + { + // It is allowed to call this method before entering or after exiting break mode. In fact, the VS debugger does so. + // We return null since there the concept of active statement only makes sense during break mode. + if (_editSession == null) + { + return null; + } + + Debug.Assert(_debuggingSession != null); + + // TODO: Avoid enumerating active statements for unchanged documents. + // We would need to add a document path parameter to be able to find the document we need to check for changes. + // https://github.com/dotnet/roslyn/issues/24324 + var baseActiveStatements = await _editSession.BaseActiveStatements.GetValueAsync(cancellationToken).ConfigureAwait(false); + if (!baseActiveStatements.InstructionMap.TryGetValue(instructionId, out var baseActiveStatement)) + { + return null; + } + + Document primaryDocument = _debuggingSession.InitialSolution.Workspace.CurrentSolution.GetDocument(baseActiveStatement.PrimaryDocumentId); + var documentAnalysis = await _editSession.GetDocumentAnalysis(primaryDocument).GetValueAsync(cancellationToken).ConfigureAwait(false); + var currentActiveStatements = documentAnalysis.ActiveStatements; + if (currentActiveStatements.IsDefault) + { + // The document has syntax errors. + return null; + } + + return currentActiveStatements[baseActiveStatement.PrimaryDocumentOrdinal].Span; + } + catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceled(e)) + { + return null; + } + } + + public async Task IsActiveStatementInExceptionRegionAsync(ActiveInstructionId instructionId, CancellationToken cancellationToken) + { + try + { + if (_editSession == null) + { + return null; + } + + Debug.Assert(_debuggingSession != null); + + // TODO: Avoid enumerating active statements for unchanged documents. + // We would need to add a document path parameter to be able to find the document we need to check for changes. + // https://github.com/dotnet/roslyn/issues/24324 + var baseActiveStatements = await _editSession.BaseActiveStatements.GetValueAsync(cancellationToken).ConfigureAwait(false); + if (!baseActiveStatements.InstructionMap.TryGetValue(instructionId, out var baseActiveStatement)) + { + return null; + } + + // TODO: avoid waiting for ERs of all active statements to be calculated and just calculate the one we are interested in at this moment: + // https://github.com/dotnet/roslyn/issues/24324 + var baseExceptionRegions = await _editSession.BaseActiveExceptionRegions.GetValueAsync(cancellationToken).ConfigureAwait(false); + return baseExceptionRegions[baseActiveStatement.Ordinal].IsActiveStatementCovered; + } + catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceled(e)) + { + return null; + } + } } } diff --git a/src/Features/Core/Portable/EditAndContinue/EditSession.cs b/src/Features/Core/Portable/EditAndContinue/EditSession.cs index d7048712b94ce..1777a85ee2208 100644 --- a/src/Features/Core/Portable/EditAndContinue/EditSession.cs +++ b/src/Features/Core/Portable/EditAndContinue/EditSession.cs @@ -13,32 +13,23 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.ErrorReporting; +using Microsoft.CodeAnalysis.PooledObjects; +using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.EditAndContinue { - internal sealed class EditSession + internal sealed partial class EditSession { - [SuppressMessage("Performance", "CA1067", Justification = "Equality not actually implemented")] - private struct Analysis + private readonly struct Analysis { public readonly Document Document; public readonly AsyncLazy Results; public Analysis(Document document, AsyncLazy results) { - this.Document = document; - this.Results = results; - } - - public override bool Equals(object obj) - { - throw ExceptionUtilities.Unreachable; - } - - public override int GetHashCode() - { - throw ExceptionUtilities.Unreachable; + Document = document; + Results = results; } } @@ -47,10 +38,15 @@ public override int GetHashCode() // signaled when the session is terminated: private readonly CancellationTokenSource _cancellation; - // document id -> [active statements ordered by position] - private readonly IReadOnlyDictionary> _baseActiveStatements; + internal readonly AsyncLazy BaseActiveStatements; + + /// + /// For each base active statement the exception regions around that statement. + /// + internal readonly AsyncLazy> BaseActiveExceptionRegions; private readonly DebuggingSession _debuggingSession; + private readonly IActiveStatementProvider _activeStatementProvider; /// /// Stopped at exception, an unwind is required before EnC is allowed. All edits are rude. @@ -78,36 +74,185 @@ public override int GetHashCode() private readonly object _encEditSessionInfoGuard = new object(); private EncEditSessionInfo _encEditSessionInfo = new EncEditSessionInfo(); + private readonly ImmutableDictionary> _nonRemappableRegions; + internal EditSession( Solution baseSolution, - IReadOnlyDictionary> baseActiveStatements, DebuggingSession debuggingSession, + IActiveStatementProvider activeStatementProvider, ImmutableDictionary projects, + ImmutableDictionary> nonRemappableRegions, bool stoppedAtException) { Debug.Assert(baseSolution != null); Debug.Assert(debuggingSession != null); + Debug.Assert(activeStatementProvider != null); + Debug.Assert(nonRemappableRegions != null); _baseSolution = baseSolution; _debuggingSession = debuggingSession; + _activeStatementProvider = activeStatementProvider; _stoppedAtException = stoppedAtException; _projects = projects; _cancellation = new CancellationTokenSource(); // TODO: small dict, pool? _analyses = new Dictionary(); - _baseActiveStatements = baseActiveStatements; // TODO: small dict, pool? _documentsWithReportedRudeEdits = new HashSet(); + + _nonRemappableRegions = nonRemappableRegions; + + BaseActiveStatements = new AsyncLazy(GetBaseActiveStatementsAsync, cacheResult: true); + BaseActiveExceptionRegions = new AsyncLazy>(GetBaseActiveExceptionRegionsAsync, cacheResult: true); + } + + private async Task GetBaseActiveStatementsAsync(CancellationToken cancellationToken) + { + try + { + return CreateActiveStatementsMap(_baseSolution, await _activeStatementProvider.GetActiveStatementsAsync(cancellationToken).ConfigureAwait(false)); + } + catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceled(e)) + { + return new ActiveStatementsMap( + SpecializedCollections.EmptyReadOnlyDictionary>(), + SpecializedCollections.EmptyReadOnlyDictionary()); + } + } + + private ActiveStatementsMap CreateActiveStatementsMap(Solution solution, ImmutableArray debugInfos) + { + var byDocument = PooledDictionary>.GetInstance(); + var byInstruction = PooledDictionary.GetInstance(); + + bool SupportsEditAndContinue(DocumentId documentId) + => solution.GetProject(documentId.ProjectId).LanguageServices.GetService() != null; + + foreach (var debugInfo in debugInfos) + { + string documentName = debugInfo.DocumentNameOpt; + if (documentName == null) + { + // Ignore active statements that do not have a source location. + continue; + } + + var documentIds = solution.GetDocumentIdsWithFilePath(documentName); + var firstDocumentId = documentIds.FirstOrDefault(SupportsEditAndContinue); + if (firstDocumentId == null) + { + // Ignore active statements that don't belong to the solution or language that supports EnC service. + continue; + } + + if (!byDocument.TryGetValue(firstDocumentId, out var primaryDocumentActiveStatements)) + { + byDocument.Add(firstDocumentId, primaryDocumentActiveStatements = ArrayBuilder.GetInstance()); + } + + var activeStatement = new ActiveStatement( + ordinal: byInstruction.Count, + primaryDocumentOrdinal: primaryDocumentActiveStatements.Count, + documentIds: documentIds, + flags: debugInfo.Flags, + span: GetUpToDateSpan(debugInfo), + instructionId: debugInfo.InstructionId, + threadIds: debugInfo.ThreadIds); + + primaryDocumentActiveStatements.Add(activeStatement); + + // TODO: associate only those documents that are from a project with the right module id + // https://github.com/dotnet/roslyn/issues/24320 + for (int i = 1; i < documentIds.Length; i++) + { + var documentId = documentIds[i]; + if (!SupportsEditAndContinue(documentId)) + { + continue; + } + + if (!byDocument.TryGetValue(documentId, out var linkedDocumentActiveStatements)) + { + byDocument.Add(documentId, linkedDocumentActiveStatements = ArrayBuilder.GetInstance()); + } + + linkedDocumentActiveStatements.Add(activeStatement); + } + + try + { + byInstruction.Add(debugInfo.InstructionId, activeStatement); + } + catch (ArgumentException) + { + throw new InvalidOperationException($"Multiple active statements with the same instruction id returned by " + + $"{_activeStatementProvider.GetType()}.{nameof(IActiveStatementProvider.GetActiveStatementsAsync)}"); + } + } + + return new ActiveStatementsMap(byDocument.ToDictionaryAndFree(), byInstruction.ToDictionaryAndFree()); + } + + private LinePositionSpan GetUpToDateSpan(ActiveStatementDebugInfo activeStatementInfo) + { + if ((activeStatementInfo.Flags & ActiveStatementFlags.MethodUpToDate) != 0) + { + return activeStatementInfo.LinePositionSpan; + } + + // Map active statement spans in non-remappable regions to the latest source locations. + if (_nonRemappableRegions.TryGetValue(activeStatementInfo.InstructionId.MethodId, out var regionsInMethod)) + { + foreach (var region in regionsInMethod) + { + if (region.Span.Contains(activeStatementInfo.LinePositionSpan)) + { + return activeStatementInfo.LinePositionSpan.AddLineDelta(region.LineDelta); + } + } + } + + // The active statement is in a method that's not up-to-date but the active span have not changed. + // We only add changed spans to non-remappable regions map, so we won't find unchanged span there. + // Return the original span. + return activeStatementInfo.LinePositionSpan; + } + + private async Task> GetBaseActiveExceptionRegionsAsync(CancellationToken cancellationToken) + { + try + { + var baseActiveStatements = await BaseActiveStatements.GetValueAsync(cancellationToken).ConfigureAwait(false); + var instructionMap = baseActiveStatements.InstructionMap; + var builder = ArrayBuilder.GetInstance(instructionMap.Count); + builder.Count = instructionMap.Count; + + foreach (var activeStatement in instructionMap.Values) + { + var document = _baseSolution.GetDocument(activeStatement.PrimaryDocumentId); + var sourceText = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); + var syntaxRoot = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); + + var analyzer = document.Project.LanguageServices.GetService(); + var exceptionRegions = analyzer.GetExceptionRegions(sourceText, syntaxRoot, activeStatement.Span, activeStatement.IsNonLeaf, out bool isCovered); + + builder[activeStatement.Ordinal] = new ActiveStatementExceptionRegions(exceptionRegions, isCovered); + } + + return builder.ToImmutableAndFree(); + } + catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceled(e)) + { + return ImmutableArray.Empty; + } } internal CancellationTokenSource Cancellation => _cancellation; internal Solution BaseSolution => _baseSolution; - internal IReadOnlyDictionary> BaseActiveStatements => _baseActiveStatements; - private Solution CurrentSolution => _baseSolution.Workspace.CurrentSolution; public bool StoppedAtException => _stoppedAtException; @@ -119,17 +264,17 @@ internal bool HasProject(ProjectId id) return Projects.TryGetValue(id, out var reason); } - private List>> GetChangedDocumentsAnalyses(Project baseProject, Project project) + private List<(DocumentId, AsyncLazy)> GetChangedDocumentsAnalyses(Project baseProject, Project project) { var changes = project.GetChanges(baseProject); var changedDocuments = changes.GetChangedDocuments().Concat(changes.GetAddedDocuments()); - var result = new List>>(); + var result = new List<(DocumentId, AsyncLazy)>(); lock (_analysesGuard) { foreach (var changedDocumentId in changedDocuments) { - result.Add(ValueTuple.Create(changedDocumentId, GetDocumentAnalysisNoLock(project.GetDocument(changedDocumentId)))); + result.Add((changedDocumentId, GetDocumentAnalysisNoLock(project.GetDocument(changedDocumentId)))); } } @@ -180,18 +325,20 @@ private AsyncLazy GetDocumentAnalysisNoLock(Document do return analysis.Results; } - var analyzer = document.Project.LanguageServices.GetService(); - if (!_baseActiveStatements.TryGetValue(document.Id, out var activeStatements)) - { - activeStatements = ImmutableArray.Create(); - } + var analyzer = document.Project.LanguageServices.GetRequiredService(); var lazyResults = new AsyncLazy( asynchronousComputeFunction: async cancellationToken => { try { - var result = await analyzer.AnalyzeDocumentAsync(_baseSolution, activeStatements, document, cancellationToken).ConfigureAwait(false); + var baseActiveStatements = await BaseActiveStatements.GetValueAsync(cancellationToken).ConfigureAwait(false); + if (!baseActiveStatements.DocumentMap.TryGetValue(document.Id, out var documentBaseActiveStatements)) + { + documentBaseActiveStatements = ImmutableArray.Empty; + } + + var result = await analyzer.AnalyzeDocumentAsync(_baseSolution, documentBaseActiveStatements, document, cancellationToken).ConfigureAwait(false); if (!result.RudeEditErrors.IsDefault) { @@ -296,13 +443,13 @@ private async Task GetProjectChangesAsync(Project project, Cance try { var baseProject = _baseSolution.GetProject(project.Id); - var allEdits = new List(); - var allLineEdits = new List>>(); + var allEdits = ArrayBuilder.GetInstance(); + var allLineEdits = ArrayBuilder<(DocumentId, ImmutableArray)>.GetInstance(); + var allActiveStatements = ArrayBuilder<(DocumentId, ImmutableArray, ImmutableArray>)>.GetInstance(); - foreach (var analysis in GetChangedDocumentsAnalyses(baseProject, project)) + foreach (var (documentId, asyncResult) in GetChangedDocumentsAnalyses(baseProject, project)) { - var documentId = analysis.Item1; - var result = await analysis.Item2.GetValueAsync(cancellationToken).ConfigureAwait(false); + var result = await asyncResult.GetValueAsync(cancellationToken).ConfigureAwait(false); // we shouldn't be asking for deltas in presence of errors: Debug.Assert(!result.HasChangesAndErrors); @@ -310,7 +457,12 @@ private async Task GetProjectChangesAsync(Project project, Cance allEdits.AddRange(result.SemanticEdits); if (result.LineEdits.Length > 0) { - allLineEdits.Add(KeyValuePair.Create(documentId, result.LineEdits)); + allLineEdits.Add((documentId, result.LineEdits)); + } + + if (result.ActiveStatements.Length > 0) + { + allActiveStatements.Add((documentId, result.ActiveStatements, result.ExceptionRegions)); } } @@ -319,7 +471,7 @@ private async Task GetProjectChangesAsync(Project project, Cance // to the source are not significant. So we emit an empty delta. // Debug.Assert(allEdits.Count > 0 || allLineEdits.Count > 0); - return new ProjectChanges(allEdits, allLineEdits); + return new ProjectChanges(allEdits.ToImmutableAndFree(), allLineEdits.ToImmutableAndFree(), allActiveStatements.ToImmutableAndFree()); } catch (Exception e) when (FatalError.ReportUnlessCanceled(e)) { @@ -333,9 +485,11 @@ public async Task EmitProjectDeltaAsync(Project project, EmitBaseline ba { Debug.Assert(!_stoppedAtException); - var changes = await GetProjectChangesAsync(project, cancellationToken).ConfigureAwait(false); + var projectChanges = await GetProjectChangesAsync(project, cancellationToken).ConfigureAwait(false); var currentCompilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); var allAddedSymbols = await GetAllAddedSymbols(cancellationToken).ConfigureAwait(false); + var baseActiveStatements = await BaseActiveStatements.GetValueAsync(cancellationToken).ConfigureAwait(false); + var baseActiveExceptionRegions = await BaseActiveExceptionRegions.GetValueAsync(cancellationToken).ConfigureAwait(false); var pdbStream = new MemoryStream(); var updatedMethods = new List(); @@ -345,23 +499,168 @@ public async Task EmitProjectDeltaAsync(Project project, EmitBaseline ba { EmitDifferenceResult result = currentCompilation.EmitDifference( baseline, - changes.SemanticEdits, + projectChanges.SemanticEdits, s => allAddedSymbols?.Contains(s) ?? false, metadataStream, ilStream, pdbStream, updatedMethods, cancellationToken); + + int[] updatedMethodTokens = updatedMethods.Select(h => MetadataTokens.GetToken(h)).ToArray(); + + // Determine all active statements whose span changed and exception region span deltas. + + GetActiveStatementAndExceptionRegionSpans( + baseline.OriginalMetadata.GetModuleVersionId(), + baseActiveStatements, + baseActiveExceptionRegions, + updatedMethodTokens, + _nonRemappableRegions, + projectChanges.NewActiveStatements, + out var activeStatementsInUpdatedMethods, + out var nonRemappableRegions); + + return new Deltas( + ilStream.ToArray(), + metadataStream.ToArray(), + pdbStream, + updatedMethodTokens, + projectChanges.LineChanges, + nonRemappableRegions, + activeStatementsInUpdatedMethods, + result); + } + } + catch (Exception e) when (FatalError.ReportWithoutCrashAndPropagate(e)) + { + throw ExceptionUtilities.Unreachable; + } + } + + // internal for testing + internal static void GetActiveStatementAndExceptionRegionSpans( + Guid moduleId, + ActiveStatementsMap baseActiveStatements, + ImmutableArray baseActiveExceptionRegions, + int[] updatedMethodTokens, + ImmutableDictionary> previousNonRemappableRegions, + ImmutableArray<(DocumentId DocumentId, ImmutableArray ActiveStatements, ImmutableArray> ExceptionRegions)> newActiveStatementsInChangedDocuments, + out ImmutableArray<(Guid ThreadId, ActiveInstructionId OldInstructionId, LinePositionSpan NewSpan)> activeStatementsInUpdatedMethods, + out ImmutableArray<(ActiveMethodId Method, NonRemappableRegion Region)> nonRemappableRegions) + { + var changedNonRemappableSpans = PooledDictionary<(int MethodToken, int MethodVersion, LinePositionSpan BaseSpan), LinePositionSpan>.GetInstance(); + var activeStatementsInUpdatedMethodsBuilder = ArrayBuilder<(Guid, ActiveInstructionId, LinePositionSpan)>.GetInstance(); + var nonRemappableRegionsBuilder = ArrayBuilder<(ActiveMethodId Method, NonRemappableRegion Region)>.GetInstance(); - int[] updateMethodTokens = updatedMethods.Select(h => MetadataTokens.GetToken(h)).ToArray(); - return new Deltas(ilStream.ToArray(), metadataStream.ToArray(), updateMethodTokens, pdbStream, changes.LineChanges, result); + // Process active statements and their exception regions in changed documents of this project/module: + foreach (var (documentId, newActiveStatements, newExceptionRegions) in newActiveStatementsInChangedDocuments) + { + var oldActiveStatements = baseActiveStatements.DocumentMap[documentId]; + Debug.Assert(oldActiveStatements.Length == newActiveStatements.Length); + Debug.Assert(newActiveStatements.Length == newExceptionRegions.Length); + + for (int i = 0; i < newActiveStatements.Length; i++) + { + var oldActiveStatement = oldActiveStatements[i]; + var newActiveStatement = newActiveStatements[i]; + var oldInstructionId = oldActiveStatement.InstructionId; + var methodToken = oldInstructionId.MethodId.Token; + var methodVersion = oldInstructionId.MethodId.Version; + + bool isMethodUpdated = updatedMethodTokens.Contains(methodToken); + if (isMethodUpdated) + { + foreach (var threadId in oldActiveStatement.ThreadIds) + { + activeStatementsInUpdatedMethodsBuilder.Add((threadId, oldInstructionId, newActiveStatement.Span)); + } + } + + void AddNonRemappableRegion(LinePositionSpan oldSpan, LinePositionSpan newSpan, bool isExceptionRegion) + { + if (oldActiveStatement.IsMethodUpToDate) + { + // Start tracking non-remappable regions for active statements in methods that were up-to-date + // when break state was entered and now being updated (regardless of whether the active span changed or not). + if (isMethodUpdated) + { + int lineDelta = oldSpan.GetLineDelta(newSpan: newSpan); + nonRemappableRegionsBuilder.Add((oldInstructionId.MethodId, new NonRemappableRegion(oldSpan, lineDelta, isExceptionRegion))); + } + + // If the method has been up-to-date and it is not updated now then either the active statement span has not changed, + // or the entire method containing it moved. In neither case do we need to start tracking non-remapable region + // for the active statement since movement of whole method bodies (if any) is handled only on PDB level without + // triggering any remapping on the IL level. + } + else if (oldSpan != newSpan) + { + // The method is not up-to-date hence we maintain non-remapable span map for it that needs to be updated. + changedNonRemappableSpans[(methodToken, methodVersion, oldSpan)] = newSpan; + } + } + + AddNonRemappableRegion(oldActiveStatement.Span, newActiveStatement.Span, isExceptionRegion: false); + + int j = 0; + foreach (var oldSpan in baseActiveExceptionRegions[oldActiveStatement.Ordinal].Spans) + { + AddNonRemappableRegion(oldSpan, newExceptionRegions[oldActiveStatement.PrimaryDocumentOrdinal][j++], isExceptionRegion: true); + } } } - catch (Exception e) when (FatalError.ReportWithoutCrash(e)) + + activeStatementsInUpdatedMethods = activeStatementsInUpdatedMethodsBuilder.ToImmutableAndFree(); + + // Gather all active method instances contained in this project/module that are not up-to-date: + var unremappedActiveMethods = PooledHashSet.GetInstance(); + foreach (var (instruction, baseActiveStatement) in baseActiveStatements.InstructionMap) { - // recover (cancel EnC) - return null; + if (moduleId == instruction.MethodId.ModuleId && !baseActiveStatement.IsMethodUpToDate) + { + unremappedActiveMethods.Add(instruction.MethodId); + } } + + if (unremappedActiveMethods.Count > 0) + { + foreach (var (methodInstance, regionsInMethod) in previousNonRemappableRegions) + { + // Skip non-remappable regions that belong to method instances that are from a different module + // or no longer active (all active statements in these method instances have been remapped to newer versions). + if (!unremappedActiveMethods.Contains(methodInstance)) + { + continue; + } + + foreach (var region in regionsInMethod) + { + // We have calculated changes against a base snapshot (last break state): + var baseSpan = region.Span.AddLineDelta(region.LineDelta); + + NonRemappableRegion newRegion; + if (changedNonRemappableSpans.TryGetValue((methodInstance.Token, methodInstance.Version, baseSpan), out var newSpan)) + { + // all spans must be of the same size: + Debug.Assert(newSpan.End.Line - newSpan.Start.Line == baseSpan.End.Line - baseSpan.Start.Line); + Debug.Assert(region.Span.End.Line - region.Span.Start.Line == baseSpan.End.Line - baseSpan.Start.Line); + + newRegion = region.WithLineDelta(region.Span.GetLineDelta(newSpan: newSpan)); + } + else + { + newRegion = region; + } + + nonRemappableRegionsBuilder.Add((methodInstance, newRegion)); + } + } + } + + nonRemappableRegions = nonRemappableRegionsBuilder.ToImmutableAndFree(); + changedNonRemappableSpans.Free(); + unremappedActiveMethods.Free(); } internal void LogRudeEditErrors(ImmutableArray rudeEditErrors) diff --git a/src/Features/Core/Portable/EditAndContinue/IActiveStatementProvider.cs b/src/Features/Core/Portable/EditAndContinue/IActiveStatementProvider.cs new file mode 100644 index 0000000000000..2f4f28315a25c --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/IActiveStatementProvider.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.CodeAnalysis.EditAndContinue +{ + /// + /// Provides current active statements. + /// + internal interface IActiveStatementProvider + { + /// + /// Retrieves active statements from the debuggee process. + /// Shall only be called while in debug mode. + /// Can be invoked on any thread. + /// + Task> GetActiveStatementsAsync(CancellationToken cancellationToken); + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/IActiveStatementTrackingService.cs b/src/Features/Core/Portable/EditAndContinue/IActiveStatementTrackingService.cs index 92a5355d0b9a6..e3bd4b9604818 100644 --- a/src/Features/Core/Portable/EditAndContinue/IActiveStatementTrackingService.cs +++ b/src/Features/Core/Portable/EditAndContinue/IActiveStatementTrackingService.cs @@ -27,6 +27,6 @@ internal interface IActiveStatementTrackingService : IWorkspaceService /// /// Replaces the existing tracking spans with specified active statement spans. /// - void UpdateActiveStatementSpans(SourceText source, IEnumerable> spans); + void UpdateActiveStatementSpans(SourceText source, IEnumerable<(ActiveStatementId, ActiveStatementTextSpan)> spans); } } diff --git a/src/Features/Core/Portable/EditAndContinue/IEditAndContinueAnalyzer.cs b/src/Features/Core/Portable/EditAndContinue/IEditAndContinueAnalyzer.cs index 29fc2cdf5e002..e0a9b3bb03504 100644 --- a/src/Features/Core/Portable/EditAndContinue/IEditAndContinueAnalyzer.cs +++ b/src/Features/Core/Portable/EditAndContinue/IEditAndContinueAnalyzer.cs @@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.EditAndContinue { internal interface IEditAndContinueAnalyzer : ILanguageService { - Task AnalyzeDocumentAsync(Solution baseSolution, ImmutableArray activeStatements, Document document, CancellationToken cancellationToken); - ImmutableArray GetExceptionRegions(SourceText text, SyntaxNode syntaxRoot, LinePositionSpan activeStatementSpan, bool isLeaf); + Task AnalyzeDocumentAsync(Solution baseSolution, ImmutableArray activeStatements, Document document, CancellationToken cancellationToken); + ImmutableArray GetExceptionRegions(SourceText text, SyntaxNode syntaxRoot, LinePositionSpan activeStatementSpan, bool isLeaf, out bool isCovered); } } diff --git a/src/Features/Core/Portable/EditAndContinue/IEditAndContinueService.cs b/src/Features/Core/Portable/EditAndContinue/IEditAndContinueService.cs index 7fdb7f39de278..56c8dbc4274b0 100644 --- a/src/Features/Core/Portable/EditAndContinue/IEditAndContinueService.cs +++ b/src/Features/Core/Portable/EditAndContinue/IEditAndContinueService.cs @@ -1,8 +1,10 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.EditAndContinue { @@ -15,13 +17,16 @@ internal interface IEditAndContinueService void StartEditSession( Solution currentSolution, - IReadOnlyDictionary> activeStatements, ImmutableDictionary projects, bool stoppedAtException); - void EndEditSession(); + void EndEditSession(ImmutableDictionary> newNonRemappableRegionsOpt); + void EndDebuggingSession(); bool IsProjectReadOnly(ProjectId id, out SessionReadOnlyReason sessionReason, out ProjectReadOnlyReason projectReason); + + Task IsActiveStatementInExceptionRegionAsync(ActiveInstructionId instructionId, CancellationToken cancellationToken); + Task GetCurrentActiveStatementPositionAsync(ActiveInstructionId instructionId, CancellationToken cancellationToken); } } diff --git a/src/Features/Core/Portable/EditAndContinue/LinePositionSpanExtensions.cs b/src/Features/Core/Portable/EditAndContinue/LinePositionSpanExtensions.cs new file mode 100644 index 0000000000000..65c4113778cd4 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/LinePositionSpanExtensions.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Immutable; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.EditAndContinue +{ + internal static class LinePositionSpanExtensions + { + internal static LinePositionSpan AddLineDelta(this LinePositionSpan span, int lineDelta) + => new LinePositionSpan(new LinePosition(span.Start.Line + lineDelta, span.Start.Character), new LinePosition(span.End.Line + lineDelta, span.End.Character)); + + internal static int GetLineDelta(this LinePositionSpan oldSpan, LinePositionSpan newSpan) + => newSpan.Start.Line - oldSpan.Start.Line; + + internal static bool Contains(this LinePositionSpan container, LinePositionSpan span) + => span.Start >= container.Start && span.End <= container.End; + + // TODO: Remove. Workaround for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/554205 + internal static TextSpan GetTextSpanSafe(this TextLineCollection lines, LinePositionSpan span) + { + if (lines.Count == 0) + { + return default; + } + + try + { + return lines.GetTextSpan(span); + } + catch + { + return new TextSpan(lines[0].Text.Length - 1, 0); + } + } + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/NonRemappableRegion.cs b/src/Features/Core/Portable/EditAndContinue/NonRemappableRegion.cs new file mode 100644 index 0000000000000..0ee441d9fca78 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/NonRemappableRegion.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Diagnostics; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.EditAndContinue +{ + [DebuggerDisplay("{GetDebuggerDisplay(),nq}")] + internal struct NonRemappableRegion + { + /// + /// Pre-remap span. + /// + public readonly LinePositionSpan Span; + + /// + /// Difference between new span and pre-remap span (new = old + delta). + /// + public readonly int LineDelta; + + /// + /// True if the region represents an exception region, false if it represents an active statement. + /// + public readonly bool IsExceptionRegion; + + public NonRemappableRegion(LinePositionSpan span, int lineDelta, bool isExceptionRegion) + { + Span = span; + LineDelta = lineDelta; + IsExceptionRegion = isExceptionRegion; + } + + public NonRemappableRegion WithLineDelta(int value) + => new NonRemappableRegion(Span, value, IsExceptionRegion); + + internal string GetDebuggerDisplay() + => $"{(IsExceptionRegion ? "ER" : "AS")} {Span} δ={LineDelta}"; + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/ProjectChanges.cs b/src/Features/Core/Portable/EditAndContinue/ProjectChanges.cs index 211b4abb292d2..bd0724f42b76b 100644 --- a/src/Features/Core/Portable/EditAndContinue/ProjectChanges.cs +++ b/src/Features/Core/Portable/EditAndContinue/ProjectChanges.cs @@ -1,22 +1,36 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Collections.Generic; using System.Collections.Immutable; using Microsoft.CodeAnalysis.Emit; +using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.EditAndContinue { - internal struct ProjectChanges + internal readonly struct ProjectChanges { - public readonly List SemanticEdits; - public readonly List>> LineChanges; + /// + /// All semantic changes made in changed documents. + /// + public readonly ImmutableArray SemanticEdits; + + /// + /// All line changes made in changed documents. + /// + public readonly ImmutableArray<(DocumentId, ImmutableArray)> LineChanges; + + /// + /// All active statements and the corresponding exception regions in changed documents. + /// + public readonly ImmutableArray<(DocumentId DocumentId, ImmutableArray ActiveStatements, ImmutableArray> ExceptionRegions)> NewActiveStatements; public ProjectChanges( - List semanticEdits, - List>> lineChanges) + ImmutableArray semanticEdits, + ImmutableArray<(DocumentId, ImmutableArray)> lineChanges, + ImmutableArray<(DocumentId, ImmutableArray, ImmutableArray>)> newActiveStatements) { - this.SemanticEdits = semanticEdits; - this.LineChanges = lineChanges; + SemanticEdits = semanticEdits; + LineChanges = lineChanges; + NewActiveStatements = newActiveStatements; } } } diff --git a/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb b/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb index fce3617b7a1e8..1ec71e5671d56 100644 --- a/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb +++ b/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb @@ -2878,7 +2878,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue #Region "Exception Handling Rude Edits" - Protected Overrides Function GetExceptionHandlingAncestors(node As SyntaxNode, isLeaf As Boolean) As List(Of SyntaxNode) + Protected Overrides Function GetExceptionHandlingAncestors(node As SyntaxNode, isNonLeaf As Boolean) As List(Of SyntaxNode) Dim result = New List(Of SyntaxNode)() Dim initialNode = node @@ -2887,7 +2887,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue Select Case kind Case SyntaxKind.TryBlock - If Not isLeaf Then + If isNonLeaf Then result.Add(node) End If @@ -3113,14 +3113,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue match As Match(Of SyntaxNode), oldActiveStatement As SyntaxNode, newActiveStatement As SyntaxNode, - isLeaf As Boolean) + isNonLeaf As Boolean) Dim onErrorOrResumeStatement = FindOnErrorOrResumeStatement(match.NewRoot) If onErrorOrResumeStatement IsNot Nothing Then AddRudeDiagnostic(diagnostics, oldActiveStatement, onErrorOrResumeStatement, newActiveStatement.Span) End If - ReportRudeEditsForAncestorsDeclaringInterStatementTemps(diagnostics, match, oldActiveStatement, newActiveStatement, isLeaf) + ReportRudeEditsForAncestorsDeclaringInterStatementTemps(diagnostics, match, oldActiveStatement, newActiveStatement) End Sub Private Shared Function FindOnErrorOrResumeStatement(newDeclarationOrBody As SyntaxNode) As SyntaxNode @@ -3143,8 +3143,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue Private Sub ReportRudeEditsForAncestorsDeclaringInterStatementTemps(diagnostics As List(Of RudeEditDiagnostic), match As Match(Of SyntaxNode), oldActiveStatement As SyntaxNode, - newActiveStatement As SyntaxNode, - isLeaf As Boolean) + newActiveStatement As SyntaxNode) ' Rude Edits for Using/SyncLock/With/ForEach statements that are added/updated around an active statement. ' Although such changes are technically possible, they might lead to confusion since diff --git a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/DebuggeeModuleMetadataProvider.cs b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/DebuggeeModuleMetadataProvider.cs index 6c7ead6f60529..fae0bcbc2263d 100644 --- a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/DebuggeeModuleMetadataProvider.cs +++ b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/DebuggeeModuleMetadataProvider.cs @@ -19,11 +19,6 @@ internal sealed class DebuggeeModuleMetadataProvider : IDebuggeeModuleMetadataPr /// private sealed class DebuggerService : IDkmCustomMessageForwardReceiver { - /// - /// Component id as specified in ManagedEditAndContinueService.vsdconfigxml. - /// - public static readonly Guid ComponentId = new Guid("A96BBE03-0408-41E3-8613-6086FD494B43"); - /// /// Message source id as specified in ManagedEditAndContinueService.vsdconfigxml. /// @@ -73,9 +68,7 @@ public ModuleMetadata TryGetBaselineMetadata(Guid mvid) { return _baselineMetadata.GetOrAdd(mvid, m => { - DkmComponentManager.InitializeThread(DebuggerService.ComponentId); - - try + using (DebuggerComponent.ManagedEditAndContinueService()) { var clrModuleInstance = FindClrModuleInstance(m); if (clrModuleInstance == null) @@ -100,10 +93,6 @@ public ModuleMetadata TryGetBaselineMetadata(Guid mvid) return metadata; } - finally - { - DkmComponentManager.UninitializeThread(DebuggerService.ComponentId); - } }); } diff --git a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/DebuggerComponent.cs b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/DebuggerComponent.cs new file mode 100644 index 0000000000000..e4d9002e648f7 --- /dev/null +++ b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/DebuggerComponent.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.VisualStudio.Debugger; + +namespace Microsoft.VisualStudio.LanguageServices.EditAndContinue +{ + internal static class DebuggerComponent + { + /// + /// Component id as specified in ManagedEditAndContinueService.vsdconfigxml. + /// + private static readonly Guid ManagedEditAndContinueServiceId = new Guid("A96BBE03-0408-41E3-8613-6086FD494B43"); + + public static ThreadInitializer ManagedEditAndContinueService() + => new ThreadInitializer(ManagedEditAndContinueServiceId); + + public struct ThreadInitializer : IDisposable + { + private readonly Guid _id; + private readonly bool _alreadyInitialized; + + public ThreadInitializer(Guid id) + { + DkmComponentManager.InitializeThread(id, out _alreadyInitialized); + _id = id; + } + + public void Dispose() + { + if (!_alreadyInitialized) + { + // Since we don't own this thread we need to uninitialize the dispatcher. Otherwise if the thread is reused by another bit of code + // trying to call into the Concord API than its InitializeThread will fail. + // The work items we queued to the work list above will be run on a dedicated thread maintained by the Concord dispatcher. + DkmComponentManager.UninitializeThread(_id); + } + } + } + } +} diff --git a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/Interop/ENCPROG_ACTIVE_STATEMENT_REMAP.cs b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/Interop/ENCPROG_ACTIVE_STATEMENT_REMAP.cs new file mode 100644 index 0000000000000..1974240348674 --- /dev/null +++ b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/Interop/ENCPROG_ACTIVE_STATEMENT_REMAP.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.VisualStudio.LanguageServices.Implementation.EditAndContinue.Interop +{ + [StructLayout(LayoutKind.Sequential)] + internal struct ENCPROG_ACTIVE_STATEMENT_REMAP + { + public Guid ThreadId; + public int MethodToken; + public int OldMethodVersion; + public int OldILOffset; + public int NewStartLine; + public int NewStartCol; + public int NewEndLine; + public int NewEndCol; + } +} diff --git a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/Interop/ENCPROG_EXCEPTION_RANGE.cs b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/Interop/ENCPROG_EXCEPTION_RANGE.cs new file mode 100644 index 0000000000000..e0b06e959f38d --- /dev/null +++ b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/Interop/ENCPROG_EXCEPTION_RANGE.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Runtime.InteropServices; + +namespace Microsoft.VisualStudio.LanguageServices.Implementation.EditAndContinue.Interop +{ + [StructLayout(LayoutKind.Sequential)] + internal struct ENCPROG_EXCEPTION_RANGE + { + public int MethodToken; + public int MethodVersion; + public int StartLine; + public int StartCol; + public int EndLine; + public int EndCol; + public int Delta; + } +} diff --git a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/Interop/IDebugUpdateInMemoryPE.cs b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/Interop/IDebugUpdateInMemoryPE.cs index cede44013294b..f66a1832c9651 100644 --- a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/Interop/IDebugUpdateInMemoryPE.cs +++ b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/Interop/IDebugUpdateInMemoryPE.cs @@ -90,4 +90,16 @@ internal interface IDebugUpdateInMemoryPE2 : IDebugUpdateInMemoryPE void SetDeltaMetadata([In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]byte[] pbMetadata, uint cbMetadata); } + + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("AE2FF3A4-2FA6-487C-AE74-9FB3D9276742")] + internal interface IDebugUpdateInMemoryPE3 : IDebugUpdateInMemoryPE2 + { + // leave a vtable gap for IDebugUpdateInMemoryPE2 methods + void _VtblGap0_10(); + + void SetExceptionRanges([In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]ENCPROG_EXCEPTION_RANGE[] pRanges, int cRanges); + void SetRemapActiveStatements([In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]ENCPROG_ACTIVE_STATEMENT_REMAP[] pRemapActiveStatements, int cRemapActiveStatements); + } } diff --git a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.Utilities.cs b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.Utilities.cs new file mode 100644 index 0000000000000..31fa436115892 --- /dev/null +++ b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.Utilities.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.PooledObjects; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.Debugger.Clr; +using Microsoft.VisualStudio.Debugger.Symbols; +using Roslyn.Utilities; + +#if TESTS +namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue +#else +namespace Microsoft.VisualStudio.LanguageServices.EditAndContinue +#endif +{ + // Utilities that are testable. Linked to test project to allow mocking. + partial class VisualStudioActiveStatementProvider + { + // internal for testing + internal static void GroupActiveStatementsByInstructionId( + Dictionary Threads, int Index, ActiveStatementFlags Flags)> instructionMap, + IEnumerable dkmStatements) + { + foreach (var dkmStatement in dkmStatements) + { + // flags whose value only depends on the active instruction: + const DkmActiveStatementFlags instructionFlagsMask = DkmActiveStatementFlags.MethodUpToDate | DkmActiveStatementFlags.NonUser; + var instructionFlags = (ActiveStatementFlags)(dkmStatement.Flags & instructionFlagsMask); + + bool isLeaf = (dkmStatement.Flags & DkmActiveStatementFlags.Leaf) != 0; + + // MidStatement is set differently for leaf frames and non-leaf frames. + // We aggregate it so that if any frame has MidStatement the ActiveStatement is considered partially executed. + var frameFlags = + (isLeaf ? ActiveStatementFlags.IsLeafFrame : ActiveStatementFlags.IsNonLeafFrame) | + (ActiveStatementFlags)(dkmStatement.Flags & DkmActiveStatementFlags.MidStatement); + + var instruction = dkmStatement.InstructionAddress; + + var instructionId = new ActiveInstructionId( + instruction.ModuleInstance.Mvid, + instruction.MethodId.Token, + unchecked((int)instruction.MethodId.Version), + unchecked((int)instruction.ILOffset)); + + if (instructionMap.TryGetValue(instructionId, out var entry)) + { + // all flags, except for LeafFrame should be the same for active statements whose instruction ids are the same: + Contract.ThrowIfFalse(instructionFlags == (entry.Flags & (ActiveStatementFlags)instructionFlagsMask), "Inconsistent active statement flags"); + + entry.Flags |= frameFlags; + } + else + { + entry = (dkmStatement.InstructionSymbol, ArrayBuilder.GetInstance(1), instructionMap.Count, instructionFlags | frameFlags); + } + + instructionMap[instructionId] = entry; + entry.Threads.Add(dkmStatement.Thread.UniqueId); + } + } + + private static LinePositionSpan ToLinePositionSpan(DkmTextSpan span) + => new LinePositionSpan(new LinePosition(span.StartLine - 1, span.StartColumn - 1), new LinePosition(span.EndLine - 1, span.EndColumn - 1)); + } +} diff --git a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.cs b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.cs new file mode 100644 index 0000000000000..0ec06d353e7d4 --- /dev/null +++ b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Immutable; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.PooledObjects; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.Debugger; +using Microsoft.VisualStudio.Debugger.Clr; +using Microsoft.VisualStudio.Debugger.Symbols; +using Roslyn.Utilities; + +namespace Microsoft.VisualStudio.LanguageServices.EditAndContinue +{ + [Export(typeof(IActiveStatementProvider)), Shared] + internal sealed partial class VisualStudioActiveStatementProvider : IActiveStatementProvider + { + /// + /// Retrieves active statements from the debuggee process. + /// Shall only be called while in debug mode. + /// Can be invoked on any thread. + /// + public Task> GetActiveStatementsAsync(CancellationToken cancellationToken) + { + using (DebuggerComponent.ManagedEditAndContinueService()) + { + // TODO: return empty outside of debug session. + // https://github.com/dotnet/roslyn/issues/24325 + + var workList = DkmWorkList.Create(CompletionRoutine: null); + var completion = new TaskCompletionSource>(); + var builders = default(ArrayBuilder>); + int pendingRuntimes = 0; + int runtimeCount = 0; + + void CancelWork() + { + if (builders != null) + { + FreeBuilders(builders); + builders = null; + + // TODO: DkmWorkList.Cancel doesn't currently work when invoked on the completion callback. + // We continue execute all the queued callbacks -- they will be no-ops. + // See https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems/edit/562781. + // + // workList.Cancel(); + + // make sure we cancel with the token we received from the caller: + completion.TrySetCanceled(cancellationToken); + } + } + + foreach (var process in DkmProcess.GetProcesses()) + { + foreach (var runtimeInstance in process.GetRuntimeInstances()) + { + if (runtimeInstance.TagValue == DkmRuntimeInstance.Tag.ClrRuntimeInstance) + { + var clrRuntimeInstance = (DkmClrRuntimeInstance)runtimeInstance; + + int runtimeIndex = runtimeCount; + runtimeCount++; + + clrRuntimeInstance.GetActiveStatements(workList, activeStatementsResult => + { + if (cancellationToken.IsCancellationRequested) + { + CancelWork(); + return; + } + + // group active statement by instruction and aggregate flags and threads: + var instructionMap = PooledDictionary Threads, int Index, ActiveStatementFlags Flags)>.GetInstance(); + GroupActiveStatementsByInstructionId(instructionMap, activeStatementsResult.ActiveStatements); + + int pendingStatements = instructionMap.Count; + builders[runtimeIndex] = ArrayBuilder.GetInstance(pendingStatements); + builders[runtimeIndex].Count = pendingStatements; + + foreach (var (instructionId, (symbol, threads, index, flags)) in instructionMap) + { + var immutableThreads = threads.ToImmutableAndFree(); + + symbol.GetSourcePosition(workList, DkmSourcePositionFlags.None, InspectionSession: null, sourcePositionResult => + { + if (cancellationToken.IsCancellationRequested) + { + CancelWork(); + return; + } + + var position = sourcePositionResult.SourcePosition; + string documentNameOpt; + LinePositionSpan span; + if (sourcePositionResult.ErrorCode == 0 && position != null) + { + documentNameOpt = position.DocumentName; + span = ToLinePositionSpan(position.TextSpan); + } + else + { + // The debugger can't determine source location for the active statement. + // The PDB might not be available or the statement is in a method that doesn't have debug information. + documentNameOpt = null; + span = default; + } + + builders[runtimeIndex][index] = new ActiveStatementDebugInfo( + instructionId, + documentNameOpt, + span, + immutableThreads, + flags); + + // the last active statement of the current runtime has been processed: + if (Interlocked.Decrement(ref pendingStatements) == 0) + { + // the last active statement of the last runtime has been processed: + if (Interlocked.Decrement(ref pendingRuntimes) == 0) + { + completion.SetResult(builders.ToFlattenedImmutableArrayAndFree()); + } + } + }); + } + + instructionMap.Free(); + }); + } + } + } + + pendingRuntimes = runtimeCount; + builders = ArrayBuilder>.GetInstance(runtimeCount); + builders.Count = runtimeCount; + + // Start execution of the Concord work items. + workList.BeginExecution(); + + return completion.Task; + } + } + + private static void FreeBuilders(ArrayBuilder> builders) + { + foreach (var builderArray in builders) + { + builderArray?.Free(); + } + + builders.Free(); + } + } +} diff --git a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementTracker.cs b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementTracker.cs new file mode 100644 index 0000000000000..5b94d6c1bfca7 --- /dev/null +++ b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementTracker.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.VisualStudio.Debugger.UI.Interfaces; +using Microsoft.VisualStudio.LanguageServices.Utilities; +using VsTextSpan = Microsoft.VisualStudio.TextManager.Interop.TextSpan; + +namespace Microsoft.VisualStudio.LanguageServices.EditAndContinue +{ + [Export(typeof(IManagedActiveStatementTracker)), Shared] + internal sealed class VisualStudioActiveStatementTracker : IManagedActiveStatementTracker + { + private readonly IEditAndContinueService _editAndContinueService; + + [ImportingConstructor] + public VisualStudioActiveStatementTracker(IEditAndContinueService editAndContinueService) + { + _editAndContinueService = editAndContinueService; + } + + public async Task GetCurrentActiveStatementPositionAsync(Guid moduleId, int methodToken, int methodVersion, int ilOffset, CancellationToken cancellationToken) + => (await _editAndContinueService.GetCurrentActiveStatementPositionAsync(new ActiveInstructionId(moduleId, methodToken, methodVersion, ilOffset), cancellationToken).ConfigureAwait(false))?.ToVsTextSpan(); + + public Task IsActiveStatementInExceptionRegionAsync(Guid moduleId, int methodToken, int methodVersion, int ilOffset, CancellationToken cancellationToken) + => _editAndContinueService.IsActiveStatementInExceptionRegionAsync(new ActiveInstructionId(moduleId, methodToken, methodVersion, ilOffset), cancellationToken); + } +} diff --git a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioEditAndContinueService.cs b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioEditAndContinueService.cs index ea8c5b58b45b7..98b9caa7aefd6 100644 --- a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioEditAndContinueService.cs +++ b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioEditAndContinueService.cs @@ -10,8 +10,8 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.EditAndContinue internal sealed class VisualStudioEditAndContinueService : EditAndContinueService { [ImportingConstructor] - public VisualStudioEditAndContinueService(IDiagnosticAnalyzerService diagnosticService) - : base(diagnosticService) + public VisualStudioEditAndContinueService(IDiagnosticAnalyzerService diagnosticService, IActiveStatementProvider activeStatementProvider) + : base(diagnosticService, activeStatementProvider) { } } diff --git a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VsENCRebuildableProjectImpl.cs b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VsENCRebuildableProjectImpl.cs index 4d69651c141a4..b9b0ea7fe24b6 100644 --- a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VsENCRebuildableProjectImpl.cs +++ b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VsENCRebuildableProjectImpl.cs @@ -35,6 +35,7 @@ using Microsoft.VisualStudio.Shell.Interop; using System.Reflection.PortableExecutable; using Microsoft.VisualStudio.LanguageServices.EditAndContinue; +using Microsoft.CodeAnalysis.PooledObjects; namespace Microsoft.VisualStudio.LanguageServices.Implementation.EditAndContinue { @@ -50,9 +51,7 @@ internal sealed class VsENCRebuildableProjectImpl // projects that entered the break state: private static readonly List> s_breakStateEnteredProjects = new List>(); - - // active statements of projects that entered the break state: - private static readonly List s_pendingActiveStatements = new List(); + private static readonly List> s_pendingNonRemappableRegions = new List>(); private static VsReadOnlyDocumentTracker s_readOnlyDocumentTracker; @@ -75,15 +74,11 @@ internal sealed class VsENCRebuildableProjectImpl private bool _changesApplied; - // maps VS Active Statement Id, which is unique within this project, to our id - private Dictionary _activeStatementIds; - private ProjectAnalysisSummary _lastEditSessionSummary = ProjectAnalysisSummary.NoChanges; - private HashSet _activeMethods; - private List _exceptionRegions; private EmitBaseline _committedBaseline; private EmitBaseline _pendingBaseline; private Project _projectBeingEmitted; + private ImmutableArray<(ActiveMethodId Method, NonRemappableRegion Region)> _pendingNonRemappableRegions; private ImmutableArray _documentsWithEmitError = ImmutableArray.Empty; @@ -230,6 +225,7 @@ public int StartDebuggingPE() Debug.Assert(s_debugStateProjectCount == 0); Debug.Assert(s_breakStateProjectCount == 0); Debug.Assert(s_breakStateEnteredProjects.Count == 0); + Debug.Assert(s_pendingNonRemappableRegions.Count == 0); _debuggingService.OnBeforeDebuggingStateChanged(DebuggingState.Design, DebuggingState.Run); @@ -261,21 +257,7 @@ public int StartDebuggingPE() { log.Write("StartDebuggingPE: error reading MVID of '{0}' ('{1}'): {2}", _vsProject.DisplayName, outputPath, e.Message); _mvid = Guid.Empty; - - var descriptor = new DiagnosticDescriptor( - "ENC0002", - new LocalizableResourceString(nameof(ServicesVSResources.ErrorReadingFile), ServicesVSResources.ResourceManager, typeof(ServicesVSResources)), - ServicesVSResources.Error_while_reading_0_colon_1, - DiagnosticCategory.EditAndContinue, - DiagnosticSeverity.Error, - isEnabledByDefault: true, - customTags: DiagnosticCustomTags.EditAndContinue); - - _diagnosticProvider.ReportDiagnostics( - new EncErrorId(_encService.DebuggingSession, EditAndContinueDiagnosticUpdateSource.DebuggerErrorId), - _encService.DebuggingSession.InitialSolution, - _vsProject.Id, - new[] { Diagnostic.Create(descriptor, Location.None, outputPath, e.Message) }); + ReportInternalError(InternalErrorCode.ErrorReadingFile, new[] { outputPath, e.Message }); } } else @@ -292,10 +274,6 @@ public int StartDebuggingPE() s_debugStateProjectCount++; } - _activeMethods = new HashSet(); - _exceptionRegions = new List(); - _activeStatementIds = new Dictionary(); - // The HResult is ignored by the debugger. return VSConstants.S_OK; } @@ -332,6 +310,7 @@ public int StopDebuggingPE() { log.Write("Exit Debug Mode: project '{0}'", _vsProject.DisplayName); Debug.Assert(s_breakStateEnteredProjects.Count == 0); + Debug.Assert(s_pendingNonRemappableRegions.Count == 0); // Clear the solution stored while projects were entering break mode. // It should be cleared as soon as all tracked projects enter the break mode @@ -361,25 +340,14 @@ public int StopDebuggingPE() else { // an error might have been reported: - var errorId = new EncErrorId(_encService.DebuggingSession, EditAndContinueDiagnosticUpdateSource.DebuggerErrorId); + var errorId = new EncErrorId(_encService.DebuggingSession, EditAndContinueDiagnosticUpdateSource.InternalErrorId); _diagnosticProvider.ClearDiagnostics(errorId, _vsProject.Workspace.CurrentSolution, _vsProject.Id, documentIdOpt: null); } - _activeMethods = null; - _exceptionRegions = null; _committedBaseline = null; - _activeStatementIds = null; _projectBeingEmitted = null; - var pdbReader = Interlocked.Exchange(ref _pdbReader, null); - if (pdbReader?.IsValueCreated == true) - { - var symReader = pdbReader.Value; - if (Marshal.IsComObject(symReader)) - { - Marshal.ReleaseComObject(symReader); - } - } + ReleasePdbReader(Interlocked.Exchange(ref _pdbReader, null)); // The HResult is ignored by the debugger. return VSConstants.S_OK; @@ -390,6 +358,18 @@ public int StopDebuggingPE() } } + private static void ReleasePdbReader(Lazy pdbReader) + { + if (pdbReader?.IsValueCreated == true) + { + var symReader = pdbReader.Value; + if (Marshal.IsComObject(symReader)) + { + Marshal.ReleaseComObject(symReader); + } + } + } + private static void LogEncSession() { var sessionId = DebugLogMessage.GetNextId(); @@ -461,7 +441,7 @@ public int GetPEidentity(Guid[] pMVID, string[] pbstrPEName) /// Reason for transition to Break state. /// Statements active when the debuggee is stopped. /// Length of . - public int EnterBreakStateOnPE(Interop.ENC_BREAKSTATE_REASON encBreakReason, ShellInterop.ENC_ACTIVE_STATEMENT[] pActiveStatements, uint cActiveStatements) + public int EnterBreakStateOnPE(ENC_BREAKSTATE_REASON encBreakReason, ENC_ACTIVE_STATEMENT[] pActiveStatements, uint cActiveStatements) { try { @@ -471,8 +451,8 @@ public int EnterBreakStateOnPE(Interop.ENC_BREAKSTATE_REASON encBreakReason, She Debug.Assert(cActiveStatements == (pActiveStatements != null ? pActiveStatements.Length : 0)); Debug.Assert(s_breakStateProjectCount < s_debugStateProjectCount); - Debug.Assert(s_breakStateProjectCount > 0 || _exceptionRegions.Count == 0); Debug.Assert(s_breakStateProjectCount == s_breakStateEnteredProjects.Count); + Debug.Assert(s_pendingNonRemappableRegions.Count == 0); Debug.Assert(IsDebuggable); if (s_breakStateEntrySolution == null) @@ -489,7 +469,6 @@ public int EnterBreakStateOnPE(Interop.ENC_BREAKSTATE_REASON encBreakReason, She ProjectReadOnlyReason state; if (pActiveStatements != null) { - AddActiveStatements(s_breakStateEntrySolution, pActiveStatements); state = ProjectReadOnlyReason.None; } else @@ -508,12 +487,6 @@ public int EnterBreakStateOnPE(Interop.ENC_BREAKSTATE_REASON encBreakReason, She if (s_breakStateEnteredProjects.Count == s_debugStateProjectCount) { Debug.Assert(_encService.EditSession == null); - Debug.Assert(s_pendingActiveStatements.TrueForAll(s => s.Owner._activeStatementIds.Count == 0)); - - var byDocument = new Dictionary>(); - - // note: fills in activeStatementIds of projects that own the active statements: - GroupActiveStatements(s_pendingActiveStatements, byDocument); // When stopped at exception: All documents are read-only, but the files might be changed outside of VS. // So we start an edit session as usual and report a rude edit for all changes we see. @@ -521,7 +494,7 @@ public int EnterBreakStateOnPE(Interop.ENC_BREAKSTATE_REASON encBreakReason, She var projectStates = ImmutableDictionary.CreateRange(s_breakStateEnteredProjects); - _encService.StartEditSession(s_breakStateEntrySolution, byDocument, projectStates, stoppedAtException); + _encService.StartEditSession(s_breakStateEntrySolution, projectStates, stoppedAtException); _trackingService.StartTracking(_encService.EditSession); s_readOnlyDocumentTracker.UpdateWorkspaceDocuments(); @@ -547,7 +520,6 @@ public int EnterBreakStateOnPE(Interop.ENC_BREAKSTATE_REASON encBreakReason, She if (s_breakStateEnteredProjects.Count == s_debugStateProjectCount) { // we don't need these anymore: - s_pendingActiveStatements.Clear(); s_breakStateEnteredProjects.Clear(); s_breakStateEntrySolution = null; } @@ -570,252 +542,28 @@ private void TrackingSpansChanged(bool leafChanged) //} } - private struct VsActiveStatement - { - public readonly DocumentId DocumentId; - public readonly uint StatementId; - public readonly ActiveStatementSpan Span; - public readonly VsENCRebuildableProjectImpl Owner; - - public VsActiveStatement(VsENCRebuildableProjectImpl owner, uint statementId, DocumentId documentId, ActiveStatementSpan span) - { - this.Owner = owner; - this.StatementId = statementId; - this.DocumentId = documentId; - this.Span = span; - } - } - - private struct VsExceptionRegion - { - public readonly uint ActiveStatementId; - public readonly int Ordinal; - public readonly uint MethodToken; - public readonly LinePositionSpan Span; - - public VsExceptionRegion(uint activeStatementId, int ordinal, uint methodToken, LinePositionSpan span) - { - this.ActiveStatementId = activeStatementId; - this.Span = span; - this.MethodToken = methodToken; - this.Ordinal = ordinal; - } - } - - // See InternalApis\vsl\inc\encbuild.idl - private const int TEXT_POSITION_ACTIVE_STATEMENT = 1; - - private void AddActiveStatements(Solution solution, ShellInterop.ENC_ACTIVE_STATEMENT[] vsActiveStatements) - { - Debug.Assert(_activeMethods.Count == 0); - Debug.Assert(_exceptionRegions.Count == 0); - - foreach (var vsActiveStatement in vsActiveStatements) - { - log.DebugWrite("+AS[{0}]: {1} {2} {3} {4} '{5}'", - unchecked((int)vsActiveStatement.id), - vsActiveStatement.tsPosition.iStartLine, - vsActiveStatement.tsPosition.iStartIndex, - vsActiveStatement.tsPosition.iEndLine, - vsActiveStatement.tsPosition.iEndIndex, - vsActiveStatement.filename); - - // TODO (tomat): - // Active statement is in user hidden code. The only information that we have from the debugger - // is the method token. We don't need to track the statement (it's not in user code anyways), - // but we should probably track the list of such methods in order to preserve their local variables. - // Not sure what's exactly the scenario here, perhaps modifying async method/iterator? - // Dev12 just ignores these. - if (vsActiveStatement.posType != TEXT_POSITION_ACTIVE_STATEMENT) - { - continue; - } - - var flags = (ActiveStatementFlags)vsActiveStatement.ASINFO; - - // Finds a document id in the solution with the specified file path. - DocumentId documentId = solution.GetDocumentIdsWithFilePath(vsActiveStatement.filename) - .Where(dId => dId.ProjectId == _vsProject.Id).SingleOrDefault(); - - if (documentId != null) - { - var document = solution.GetDocument(documentId); - Debug.Assert(document != null); - - SourceText source = document.GetTextAsync(default).Result; - LinePositionSpan lineSpan = vsActiveStatement.tsPosition.ToLinePositionSpan(); - - // If the PDB is out of sync with the source we might get bad spans. - var sourceLines = source.Lines; - if (lineSpan.End.Line >= sourceLines.Count || sourceLines.GetPosition(lineSpan.End) > sourceLines[sourceLines.Count - 1].EndIncludingLineBreak) - { - log.Write("AS out of bounds (line count is {0})", source.Lines.Count); - continue; - } - - SyntaxNode syntaxRoot = document.GetSyntaxRootAsync(default).Result; - - var analyzer = document.Project.LanguageServices.GetService(); - - s_pendingActiveStatements.Add(new VsActiveStatement( - this, - vsActiveStatement.id, - document.Id, - new ActiveStatementSpan(flags, lineSpan))); - - bool isLeaf = (flags & ActiveStatementFlags.LeafFrame) != 0; - var ehRegions = analyzer.GetExceptionRegions(source, syntaxRoot, lineSpan, isLeaf); - - for (int i = 0; i < ehRegions.Length; i++) - { - _exceptionRegions.Add(new VsExceptionRegion( - vsActiveStatement.id, - i, - vsActiveStatement.methodToken, - ehRegions[i])); - } - } - - _activeMethods.Add(vsActiveStatement.methodToken); - } - } - - private static void GroupActiveStatements( - IEnumerable activeStatements, - Dictionary> byDocument) - { - var spans = new List(); - - foreach (var grouping in activeStatements.GroupBy(s => s.DocumentId)) - { - var documentId = grouping.Key; - - foreach (var activeStatement in grouping.OrderBy(s => s.Span.Span.Start)) - { - int ordinal = spans.Count; - - // register vsid with the project that owns the active statement: - activeStatement.Owner._activeStatementIds.Add(activeStatement.StatementId, new ActiveStatementId(documentId, ordinal)); - - spans.Add(activeStatement.Span); - } - - byDocument.Add(documentId, spans.AsImmutable()); - spans.Clear(); - } - } - - /// - /// Returns the number of exception regions around current active statements. - /// This is called when the project is entering a break right after - /// and prior to . - /// - /// - /// Called by EnC manager. - /// + // obsolete public int GetExceptionSpanCount(out uint pcExceptionSpan) - { - pcExceptionSpan = (uint)_exceptionRegions.Count; - return VSConstants.S_OK; - } - - /// - /// Returns information about exception handlers in the source. - /// - /// - /// Called by EnC manager. - /// - public int GetExceptionSpans(uint celt, ShellInterop.ENC_EXCEPTION_SPAN[] rgelt, ref uint pceltFetched) - { - Debug.Assert(celt == rgelt.Length); - Debug.Assert(celt == _exceptionRegions.Count); - - for (int i = 0; i < _exceptionRegions.Count; i++) - { - rgelt[i] = new ShellInterop.ENC_EXCEPTION_SPAN() - { - id = (uint)i, - methodToken = _exceptionRegions[i].MethodToken, - tsPosition = _exceptionRegions[i].Span.ToVsTextSpan() - }; - } + => throw ExceptionUtilities.Unreachable; - pceltFetched = celt; - return VSConstants.S_OK; - } + // obsolete + public int GetExceptionSpans(uint celt, ENC_EXCEPTION_SPAN[] rgelt, ref uint pceltFetched) + => throw ExceptionUtilities.Unreachable; - /// - /// Called by the debugger whenever it needs to determine a position of an active statement. - /// E.g. the user clicks on a frame in a call stack. - /// - /// - /// Called when applying change, when setting current IP, a notification is received from - /// , etc. - /// In addition this API is exposed on IDebugENC2 COM interface so it can be used anytime by other components. - /// + // obsolete public int GetCurrentActiveStatementPosition(uint vsId, VsTextSpan[] ptsNewPosition) - { - try - { - using (NonReentrantContext) - { - Debug.Assert(IsDebuggable); - - var session = _encService.EditSession; - var ids = _activeStatementIds; - // Can be called anytime, even outside of an edit/debug session. - // We might not have an active statement available if PDB got out of sync with the source. - if (session == null || ids == null || !ids.TryGetValue(vsId, out var id)) - { - log.Write("GetCurrentActiveStatementPosition failed for AS {0}.", unchecked((int)vsId)); - return VSConstants.E_FAIL; - } - - Document document = _vsProject.Workspace.CurrentSolution.GetDocument(id.DocumentId); - SourceText text = document.GetTextAsync(default).Result; - LinePositionSpan lineSpan; - // Try to get spans from the tracking service first. - // We might get an imprecise result if the document analysis hasn't been finished yet and - // the active statement has structurally changed, but that's ok. The user won't see an updated tag - // for the statement until the analysis finishes anyways. - if (_trackingService.TryGetSpan(id, text, out var span) && span.Length > 0) - { - lineSpan = text.Lines.GetLinePositionSpan(span); - } - else - { - var activeSpans = session.GetDocumentAnalysis(document).GetValue(default).ActiveStatements; - if (activeSpans.IsDefault) - { - // The document has syntax errors and the tracking span is gone. - log.Write("Position not available for AS {0} due to syntax errors", unchecked((int)vsId)); - return VSConstants.E_FAIL; - } + => throw ExceptionUtilities.Unreachable; - lineSpan = activeSpans[id.Ordinal]; - } - - ptsNewPosition[0] = lineSpan.ToVsTextSpan(); - log.DebugWrite("AS position: {0} ({1},{2})-({3},{4}) {5}", - unchecked((int)vsId), - lineSpan.Start.Line, lineSpan.Start.Character, lineSpan.End.Line, lineSpan.End.Character, - (int)session.BaseActiveStatements[id.DocumentId][id.Ordinal].Flags); - - return VSConstants.S_OK; - } - } - catch (Exception e) when (FatalError.ReportWithoutCrash(e)) - { - return VSConstants.E_FAIL; - } - } + // obsolete + public int GetCurrentExceptionSpanPosition(uint exceptionRegionId, VsTextSpan[] ptsNewPosition) + => throw ExceptionUtilities.Unreachable; /// /// Returns the state of the changes made to the source. /// The EnC manager calls this to determine whether there are any changes to the source /// and if so whether there are any rude edits. /// - public int GetENCBuildState(ShellInterop.ENC_BUILD_STATE[] pENCBuildState) + public int GetENCBuildState(ENC_BUILD_STATE[] pENCBuildState) { try { @@ -945,7 +693,18 @@ public int ExitBreakStateOnPE() _debuggingService.OnBeforeDebuggingStateChanged(DebuggingState.Break, DebuggingState.Run); _encService.EditSession.LogEditSession(s_encDebuggingSessionInfo); - _encService.EndEditSession(); + + // If no edits were made the pending list will be empty and we need to keep the previous regions. + var newNonRemappableRegions = (s_pendingNonRemappableRegions.Count == 0) ? null : + GroupToImmutable( + from regionsPerModule in s_pendingNonRemappableRegions + from region in regionsPerModule + group region.Region by region.Method); + + _encService.EndEditSession(newNonRemappableRegions); + + s_pendingNonRemappableRegions.Clear(); + _trackingService.EndTracking(); s_readOnlyDocumentTracker.UpdateWorkspaceDocuments(); @@ -953,10 +712,6 @@ public int ExitBreakStateOnPE() _trackingService.TrackingSpansChanged -= TrackingSpansChanged; } - _exceptionRegions.Clear(); - _activeMethods.Clear(); - _activeStatementIds.Clear(); - s_breakStateProjectCount--; Debug.Assert(s_breakStateProjectCount >= 0); @@ -980,6 +735,18 @@ public int ExitBreakStateOnPE() } } + private static ImmutableDictionary> GroupToImmutable(IEnumerable> items) + { + var builder = ImmutableDictionary.CreateBuilder>(); + + foreach (var item in items) + { + builder.Add(item.Key, item.ToImmutableArray()); + } + + return builder.ToImmutable(); + } + public unsafe int BuildForEnc(object pUpdatePE) { try @@ -1008,13 +775,14 @@ public unsafe int BuildForEnc(object pUpdatePE) Debug.Assert(_lastEditSessionSummary == ProjectAnalysisSummary.ValidInsignificantChanges || _lastEditSessionSummary == ProjectAnalysisSummary.ValidChanges); - var updater = (IDebugUpdateInMemoryPE2)pUpdatePE; + var updater = (IDebugUpdateInMemoryPE3)pUpdatePE; - if (_committedBaseline == null) + // Acquire PDB reader lazily. _pdbReader is cleared when the debugging session stops. + if (_pdbReader == null) { var previousPdbReader = Interlocked.Exchange(ref _pdbReader, MarshalPdbReader(updater)); - // PDB reader should have been nulled out when debugging stopped: + // This method should only be called on UI thread, thus the previous value should be null. Contract.ThrowIfFalse(previousPdbReader == null); } @@ -1029,7 +797,7 @@ public unsafe int BuildForEnc(object pUpdatePE) if (delta == null) { - // A diagnostic or non-fatal Watson has already been reported by the emit task + // A diagnostic has already been reported by the emit task return VSConstants.E_FAIL; } } @@ -1056,7 +824,14 @@ public unsafe int BuildForEnc(object pUpdatePE) updater.SetRemapMethods(delta.Pdb.UpdatedMethods, (uint)delta.Pdb.UpdatedMethods.Length); updater.SetDeltaMetadata(delta.Metadata.Bytes, (uint)delta.Metadata.Bytes.Length); + var ranges = GetExceptionRanges(delta.NonRemappableRegions); + updater.SetExceptionRanges(ranges, ranges.Length); + + var remapActiveStatements = GetRemapActiveStatements(delta.ActiveStatementsInUpdatedMethods); + updater.SetRemapActiveStatements(remapActiveStatements, remapActiveStatements.Length); + _pendingBaseline = delta.EmitResult.Baseline; + _pendingNonRemappableRegions = delta.NonRemappableRegions; #if DEBUG fixed (byte* deltaMetadataPtr = &delta.Metadata.Bytes[0]) @@ -1076,15 +851,74 @@ public unsafe int BuildForEnc(object pUpdatePE) } catch (Exception e) when (FatalError.ReportWithoutCrash(e)) { + ReportInternalError(InternalErrorCode.CantApplyChangesUnexpectedError, new[] { e.ToString() }); return VSConstants.E_FAIL; } } + internal static ENCPROG_ACTIVE_STATEMENT_REMAP[] GetRemapActiveStatements(ImmutableArray<(Guid ThreadId, ActiveInstructionId OldInstructionId, LinePositionSpan NewSpan)> remaps) + { + var result = new ENCPROG_ACTIVE_STATEMENT_REMAP[remaps.Length]; + for (int i = 0; i < remaps.Length; i++) + { + result[i] = new ENCPROG_ACTIVE_STATEMENT_REMAP + { + ThreadId = remaps[i].ThreadId, + MethodToken = remaps[i].OldInstructionId.MethodId.Token, + OldMethodVersion = remaps[i].OldInstructionId.MethodId.Version, + OldILOffset = remaps[i].OldInstructionId.ILOffset, + // the debugger expects these to be 0-based + NewStartLine = remaps[i].NewSpan.Start.Line, + NewStartCol = remaps[i].NewSpan.Start.Character, + NewEndLine = remaps[i].NewSpan.End.Line, + NewEndCol = remaps[i].NewSpan.End.Character, + }; + } + + return result; + } + + // internal for testing + internal static ENCPROG_EXCEPTION_RANGE[] GetExceptionRanges(ImmutableArray<(ActiveMethodId Method, NonRemappableRegion Region)> nonRemappableRegions) + { + var exceptionRegionCount = nonRemappableRegions.Count(d => d.Region.IsExceptionRegion); + + var result = new ENCPROG_EXCEPTION_RANGE[exceptionRegionCount]; + int i = 0; + foreach (var (method, region) in nonRemappableRegions) + { + if (region.IsExceptionRegion) + { + // Debugger line and column numbers are 1-based. + // + // The range span is the new span. Deltas are inverse. + // old = new + delta + // new = old – delta + + int delta = region.LineDelta; + + result[i++] = new ENCPROG_EXCEPTION_RANGE + { + MethodToken = method.Token, + MethodVersion = method.Version, + // the debugger expects these to be 0-based + StartLine = region.Span.Start.Line + delta, + StartCol = region.Span.Start.Character, + EndLine = region.Span.End.Line + delta, + EndCol = region.Span.End.Character, + Delta = -delta, + }; + } + } + + return result; + } + private unsafe void SetFileUpdates( IDebugUpdateInMemoryPE2 updater, - List>> edits) + ImmutableArray<(DocumentId DocumentId, ImmutableArray Deltas)> edits) { - int totalEditCount = edits.Sum(e => e.Value.Length); + int totalEditCount = edits.Sum(e => e.Deltas.Length); if (totalEditCount == 0) { return; @@ -1094,11 +928,10 @@ private unsafe void SetFileUpdates( fixed (LINEUPDATE* lineUpdatesPtr = lineUpdates) { int index = 0; - var fileUpdates = new FILEUPDATE[edits.Count]; + var fileUpdates = new FILEUPDATE[edits.Length]; for (int f = 0; f < fileUpdates.Length; f++) { - var documentId = edits[f].Key; - var deltas = edits[f].Value; + var (documentId, deltas) = edits[f]; fileUpdates[f].FileName = _vsProject.GetDocumentOrAdditionalDocument(documentId).FilePath; fileUpdates[f].LineUpdateCount = (uint)deltas.Length; @@ -1142,27 +975,19 @@ private Deltas EmitProjectDelta() // The metadata blob is guaranteed to not be disposed while BuildForEnc is being executed. // If it is disposed it means it had been disposed when entering BuildForEnc. - log.Write("Module has been unloaded: module '{0}', project '{1}', , MVID: {2}", moduleName, _vsProject.DisplayName, _mvid.ToString()); + log.Write("Module has been unloaded: module '{0}', project '{1}', MVID: {2}", moduleName, _vsProject.DisplayName, _mvid.ToString()); - var descriptor = new DiagnosticDescriptor( - "ENC0001", - new LocalizableResourceString(nameof(ServicesVSResources.ModuleHasBeenUnloaded), ServicesVSResources.ResourceManager, typeof(ServicesVSResources)), - ServicesVSResources.CantApplyChangesModuleHasBeenUnloaded, - DiagnosticCategory.EditAndContinue, - DiagnosticSeverity.Error, - isEnabledByDefault: true, - customTags: DiagnosticCustomTags.EditAndContinue); - - _diagnosticProvider.ReportDiagnostics( - new EncErrorId(_encService.DebuggingSession, EditAndContinueDiagnosticUpdateSource.DebuggerErrorId), - _encService.DebuggingSession.InitialSolution, - _vsProject.Id, - new[] { Diagnostic.Create(descriptor, Location.None, moduleName) }); + ReportInternalError(InternalErrorCode.CantApplyChangesModuleHasBeenUnloaded, new[] { moduleName }); + return null; + } + var emitTask = _encService.EditSession.EmitProjectDeltaAsync(_projectBeingEmitted, baseline, CancellationToken.None); + if (emitTask.Exception != null) + { + ReportInternalError(InternalErrorCode.CantApplyChangesUnexpectedError, new[] { emitTask.Exception.ToString() }); return null; } - var emitTask = _encService.EditSession.EmitProjectDeltaAsync(_projectBeingEmitted, baseline, default); return emitTask.Result; } @@ -1308,6 +1133,7 @@ public int EncApplySucceeded(int hrApplyResult) Debug.Assert(_encService.EditSession != null); Debug.Assert(!_encService.EditSession.StoppedAtException); Debug.Assert(_pendingBaseline != null); + Debug.Assert(!_pendingNonRemappableRegions.IsDefault); // Since now on until exiting the break state, we consider the changes applied and the project state should be NoChanges. _changesApplied = true; @@ -1315,50 +1141,8 @@ public int EncApplySucceeded(int hrApplyResult) _committedBaseline = _pendingBaseline; _pendingBaseline = null; - return VSConstants.S_OK; - } - catch (Exception e) when (FatalError.ReportWithoutCrash(e)) - { - return VSConstants.E_FAIL; - } - } - - /// - /// Called when changes are being applied. - /// - /// - /// The value of . - /// Set by to the index into . - /// - /// Output value holder. - public int GetCurrentExceptionSpanPosition(uint exceptionRegionId, VsTextSpan[] ptsNewPosition) - { - try - { - using (NonReentrantContext) - { - Debug.Assert(IsDebuggable); - Debug.Assert(_encService.EditSession != null); - Debug.Assert(!_encService.EditSession.StoppedAtException); - Debug.Assert(ptsNewPosition.Length == 1); - - var exceptionRegion = _exceptionRegions[(int)exceptionRegionId]; - - var session = _encService.EditSession; - var asid = _activeStatementIds[exceptionRegion.ActiveStatementId]; - - var document = _projectBeingEmitted.GetDocument(asid.DocumentId); - var analysis = session.GetDocumentAnalysis(document).GetValue(default); - var regions = analysis.ExceptionRegions; - - // the method shouldn't be called in presence of errors: - Debug.Assert(!analysis.HasChangesAndErrors); - Debug.Assert(!regions.IsDefault); - - // Absence of rude edits guarantees that the exception regions around AS haven't semantically changed. - // Only their spans might have changed. - ptsNewPosition[0] = regions[asid.Ordinal][exceptionRegion.Ordinal].ToVsTextSpan(); - } + s_pendingNonRemappableRegions.Add(_pendingNonRemappableRegions); + _pendingNonRemappableRegions = default; return VSConstants.S_OK; } @@ -1404,6 +1188,62 @@ private static Lazy MarshalPdbReader(IDebugUpdateInMemoryP } } + private enum InternalErrorCode + { + CantApplyChangesModuleHasBeenUnloaded = 1, + ErrorReadingFile = 2, + CantApplyChangesUnexpectedError = 3, + } + + private void ReportInternalError(InternalErrorCode errorId, object[] args) + { + try + { + string resourceName; + string resourceString; + + switch (errorId) + { + case InternalErrorCode.CantApplyChangesModuleHasBeenUnloaded: + resourceName = nameof(ServicesVSResources.CantApplyChangesModuleHasBeenUnloaded); + resourceString = ServicesVSResources.CantApplyChangesModuleHasBeenUnloaded; + break; + + case InternalErrorCode.CantApplyChangesUnexpectedError: + resourceName = nameof(ServicesVSResources.CantApplyChangesUnexpectedError); + resourceString = ServicesVSResources.CantApplyChangesUnexpectedError; + break; + + case InternalErrorCode.ErrorReadingFile: + resourceName = nameof(ServicesVSResources.ErrorReadingFile); + resourceString = ServicesVSResources.ErrorReadingFile; + break; + + default: + throw ExceptionUtilities.Unreachable; + } + + var descriptor = new DiagnosticDescriptor( + $"ENC{(int)errorId:D4}", + new LocalizableResourceString(resourceName, ServicesVSResources.ResourceManager, typeof(ServicesVSResources)), + resourceString, + DiagnosticCategory.EditAndContinue, + DiagnosticSeverity.Error, + isEnabledByDefault: true, + customTags: DiagnosticCustomTags.EditAndContinue); + + _diagnosticProvider.ReportDiagnostics( + new EncErrorId(_encService.DebuggingSession, EditAndContinueDiagnosticUpdateSource.InternalErrorId), + _encService.DebuggingSession.InitialSolution, + _vsProject.Id, + new[] { Diagnostic.Create(descriptor, Location.None, args) }); + } + catch (Exception e) when (FatalError.ReportWithoutCrash(e)) + { + // nop + } + } + #region Testing #if DEBUG diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs b/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs index 21b7ef33cc061..1f856e144d7c6 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs +++ b/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs @@ -397,6 +397,15 @@ internal static string CantApplyChangesModuleHasBeenUnloaded { } } + /// + /// Looks up a localized string similar to Can't apply changes -- unexpected error: '{0}'. + /// + internal static string CantApplyChangesUnexpectedError { + get { + return ResourceManager.GetString("CantApplyChangesUnexpectedError", resourceCulture); + } + } + /// /// Looks up a localized string similar to Capitalization:. /// @@ -818,16 +827,7 @@ internal static string Error_reading_ruleset_file_0_1 { } /// - /// Looks up a localized string similar to Error while reading '{0}': {1}. - /// - internal static string Error_while_reading_0_colon_1 { - get { - return ResourceManager.GetString("Error_while_reading_0_colon_1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Error while reading a file. + /// Looks up a localized string similar to Error while reading file '{0}': {1}. /// internal static string ErrorReadingFile { get { diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx index 74bcdeca15b32..c89922a310490 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.resx +++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx @@ -231,11 +231,8 @@ Could not find location of folder on disk - - Error while reading '{0}': {1} - - Error while reading a file + Error while reading file '{0}': {1} Assembly @@ -974,6 +971,9 @@ Additional information: {1} Can't apply changes -- module '{0}' has been unloaded. + + Can't apply changes -- unexpected error: '{0}' + Prefer deconstructed variable declaration diff --git a/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj b/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj index eda9c2f08891a..43f901ab962a0 100644 --- a/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj +++ b/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj @@ -161,6 +161,7 @@ + diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index 5d91ef12ab67f..e11b4e8dcd764 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -192,11 +192,6 @@ Nepovedlo se najít umístění složky na disku. - - Error while reading '{0}': {1} - Při čtení {0} došlo k chybě: {1} - - Assembly Sestavení @@ -1433,8 +1428,8 @@ Pro aktuální řešení je povolené zjednodušené načtení řešení. Jeho z - Error while reading a file - Chyba při čtení souboru + Error while reading file '{0}': {1} + Chyba při čtení souboru @@ -1503,6 +1498,11 @@ Souhlasím se všemi výše uvedenými podmínkami: Sync Class View + + Can't apply changes -- unexpected error: '{0}' + Can't apply changes -- unexpected error: '{0}' + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index 76b4cb0679d51..4b9e74ec3fc40 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -192,11 +192,6 @@ Speicherort des Ordners wurde nicht auf dem Datenträger gefunden. - - Error while reading '{0}': {1} - Fehler beim Lesen von "{0}": {1} - - Assembly Assembly @@ -1433,8 +1428,8 @@ Für die aktuelle Projektmappe ist die Option "Lightweight-Ladevorgang für Proj - Error while reading a file - Fehler beim Lesen einer Datei. + Error while reading file '{0}': {1} + Fehler beim Lesen einer Datei. @@ -1503,6 +1498,11 @@ Ich stimme allen vorstehenden Bedingungen zu: Sync Class View + + Can't apply changes -- unexpected error: '{0}' + Can't apply changes -- unexpected error: '{0}' + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index ec57f8aa39c91..8e6be107a1a93 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -192,11 +192,6 @@ No se pudo encontrar la ubicación de la carpeta en el disco - - Error while reading '{0}': {1} - Error al leer "{0}": {1} - - Assembly Ensamblado @@ -1433,8 +1428,8 @@ La opción "Carga de solución ligera" está habilitada para la solución actual - Error while reading a file - Error al leer un archivo. + Error while reading file '{0}': {1} + Error al leer un archivo. @@ -1503,6 +1498,11 @@ Estoy de acuerdo con todo lo anterior: Sync Class View + + Can't apply changes -- unexpected error: '{0}' + Can't apply changes -- unexpected error: '{0}' + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index 9447444a0fbeb..4a9085fffd781 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -192,11 +192,6 @@ Emplacement introuvable du dossier sur le disque - - Error while reading '{0}': {1} - Erreur de lecture de '{0}' : {1} - - Assembly Assembly @@ -1433,8 +1428,8 @@ Informations supplémentaires : {1} - Error while reading a file - Erreur durant la lecture d'un fichier + Error while reading file '{0}': {1} + Erreur durant la lecture d'un fichier @@ -1503,6 +1498,11 @@ Je suis d'accord avec tout ce qui précède : Sync Class View + + Can't apply changes -- unexpected error: '{0}' + Can't apply changes -- unexpected error: '{0}' + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index 449b8709a5de7..429ad9f4f3078 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -192,11 +192,6 @@ Il percorso della cartella nel disco non è stato trovato - - Error while reading '{0}': {1} - Si è verificato un errore durante la lettura di '{0}': {1} - - Assembly Assembly @@ -1433,8 +1428,8 @@ L'opzione 'Caricamento leggero soluzioni' è abilitata per la soluzione corrente - Error while reading a file - Si è verificato un errore durante la lettura di un file + Error while reading file '{0}': {1} + Si è verificato un errore durante la lettura di un file @@ -1503,6 +1498,11 @@ L'utente accetta le condizioni sopra riportate: Sync Class View + + Can't apply changes -- unexpected error: '{0}' + Can't apply changes -- unexpected error: '{0}' + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index c0c1cd301bbd1..7ec9b9bf231af 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -192,11 +192,6 @@ ディスクにフォルダーの場所が見つかりませんでした - - Error while reading '{0}': {1} - {0}' の読み取り中にエラーが発生しました: {1} - - Assembly アセンブリ @@ -1433,8 +1428,8 @@ Additional information: {1} - Error while reading a file - ファイルの読み取り中にエラーが発生しました + Error while reading file '{0}': {1} + ファイルの読み取り中にエラーが発生しました @@ -1503,6 +1498,11 @@ I agree to all of the foregoing: Sync Class View + + Can't apply changes -- unexpected error: '{0}' + Can't apply changes -- unexpected error: '{0}' + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index e28266b791e73..46c7d50f22357 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -192,11 +192,6 @@ 디스크에서 폴더의 위치를 찾을 수 없습니다. - - Error while reading '{0}': {1} - {0}'을(를) 읽는 동안 오류가 발생했습니다. {1} - - Assembly 어셈블리 @@ -1433,8 +1428,8 @@ Additional information: {1} - Error while reading a file - 파일을 읽는 동안 오류가 발생했습니다. + Error while reading file '{0}': {1} + 파일을 읽는 동안 오류가 발생했습니다. @@ -1503,6 +1498,11 @@ I agree to all of the foregoing: Sync Class View + + Can't apply changes -- unexpected error: '{0}' + Can't apply changes -- unexpected error: '{0}' + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index c10a1629d3ee6..c117883651bd2 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -192,11 +192,6 @@ Nie można odnaleźć lokalizacji folderu na dysku - - Error while reading '{0}': {1} - Błąd podczas odczytywania elementu „{0}”: {1} - - Assembly Zestaw @@ -1433,8 +1428,8 @@ Funkcja „Uproszczone ładowanie rozwiązania” jest włączona dla bieżąceg - Error while reading a file - Błąd podczas odczytu pliku + Error while reading file '{0}': {1} + Błąd podczas odczytu pliku @@ -1503,6 +1498,11 @@ Wyrażam zgodę na wszystkie następujące postanowienia: Sync Class View + + Can't apply changes -- unexpected error: '{0}' + Can't apply changes -- unexpected error: '{0}' + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index 12cc44860f60f..0b53d231bc6dd 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -192,11 +192,6 @@ Não foi possível encontrar o local da pasta no disco - - Error while reading '{0}': {1} - Erro ao ler '{0}': {1} - - Assembly Assembly @@ -1433,8 +1428,8 @@ O 'Carregamento da solução leve' está habilitado para a solução atual. Desa - Error while reading a file - Erro durante a leitura de um arquivo + Error while reading file '{0}': {1} + Erro durante a leitura de um arquivo @@ -1503,6 +1498,11 @@ Eu concordo com todo o conteúdo supracitado: Sync Class View + + Can't apply changes -- unexpected error: '{0}' + Can't apply changes -- unexpected error: '{0}' + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index 914ea15a72269..98cf5ecba375f 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -192,11 +192,6 @@ Не удалось найти путь к папке на диске. - - Error while reading '{0}': {1} - Ошибка при считывании "{0}": {1} - - Assembly Сборка @@ -1433,8 +1428,8 @@ Additional information: {1} - Error while reading a file - Ошибка при чтении файла + Error while reading file '{0}': {1} + Ошибка при чтении файла @@ -1503,6 +1498,11 @@ I agree to all of the foregoing: Sync Class View + + Can't apply changes -- unexpected error: '{0}' + Can't apply changes -- unexpected error: '{0}' + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index f712fd9678bff..1aa2ccb13f913 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -192,11 +192,6 @@ Diskte klasörün konumu bulunamadı - - Error while reading '{0}': {1} - {0}' okunurken hata: {1} - - Assembly Bütünleştirilmiş Kod @@ -1433,8 +1428,8 @@ Geçerli durum için 'basit çözüm yükü' etkin. Hata ayıklama başlatıldı - Error while reading a file - Dosya okunurken hata oluştu + Error while reading file '{0}': {1} + Dosya okunurken hata oluştu @@ -1503,6 +1498,11 @@ Aşağıdakilerin tümünü onaylıyorum: Sync Class View + + Can't apply changes -- unexpected error: '{0}' + Can't apply changes -- unexpected error: '{0}' + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index 4af2e6d155f49..50e5ed5c60578 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -192,11 +192,6 @@ 无法在磁盘上找到文件夹的位置 - - Error while reading '{0}': {1} - 读取“{0}”时出错: {1} - - Assembly 程序集 @@ -1433,8 +1428,8 @@ Additional information: {1} - Error while reading a file - 读取文件时出错 + Error while reading file '{0}': {1} + 读取文件时出错 @@ -1503,6 +1498,11 @@ I agree to all of the foregoing: Sync Class View + + Can't apply changes -- unexpected error: '{0}' + Can't apply changes -- unexpected error: '{0}' + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index de5650e769781..ffdd9c03a25d8 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -192,11 +192,6 @@ 在磁碟上找不到資料夾的位置 - - Error while reading '{0}': {1} - 讀取 '{0}' 時發生錯誤: {1} - - Assembly 組件 @@ -1433,8 +1428,8 @@ Additional information: {1} - Error while reading a file - 讀取檔案時發生錯誤 + Error while reading file '{0}': {1} + 讀取檔案時發生錯誤 @@ -1503,6 +1498,11 @@ I agree to all of the foregoing: Sync Class View + + Can't apply changes -- unexpected error: '{0}' + Can't apply changes -- unexpected error: '{0}' + + \ No newline at end of file diff --git a/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmActiveStatement.cs b/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmActiveStatement.cs new file mode 100644 index 0000000000000..1537da2349dc0 --- /dev/null +++ b/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmActiveStatement.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.VisualStudio.Debugger.Clr; +using Microsoft.VisualStudio.Debugger.Symbols; + +namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue +{ + internal sealed class DkmActiveStatement + { + public DkmActiveStatementFlags Flags { get; set; } + public DkmInstructionSymbol InstructionSymbol { get; set; } + public DkmClrInstructionAddress InstructionAddress { get; set; } + public DkmThread Thread { get; set; } + + public DkmActiveStatement( + Guid threadId, + Guid moduleId, + int methodToken, + uint methodVersion, + uint ilOffset, + DkmActiveStatementFlags flags) + { + Flags = flags; + InstructionAddress = new DkmClrInstructionAddress() + { + MethodId = new DkmClrMethodId(methodToken, methodVersion), + ILOffset = ilOffset, + ModuleInstance = new DkmClrModuleInstance() { Mvid = moduleId } + }; + Thread = new DkmThread() { UniqueId = threadId }; + } + } +} diff --git a/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmClrInstructionAddress.cs b/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmClrInstructionAddress.cs new file mode 100644 index 0000000000000..76648b9673e52 --- /dev/null +++ b/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmClrInstructionAddress.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.VisualStudio.Debugger.Clr; + +namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue +{ + public class DkmClrInstructionAddress + { + public DkmClrMethodId MethodId { get; set; } + public uint ILOffset { get; set; } + public DkmClrModuleInstance ModuleInstance { get; set; } + } +} diff --git a/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmClrModuleInstance.cs b/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmClrModuleInstance.cs new file mode 100644 index 0000000000000..b91ca2a8a26cb --- /dev/null +++ b/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmClrModuleInstance.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue +{ + public class DkmClrModuleInstance + { + public Guid Mvid { get; set; } + } +} diff --git a/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmModule.cs b/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmModule.cs new file mode 100644 index 0000000000000..c58c329d24664 --- /dev/null +++ b/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmModule.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.VisualStudio.Debugger.Symbols; + +namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue +{ + internal sealed class DkmModule + { + public DkmModuleId Id { get; set; } + } +} diff --git a/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmThread.cs b/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmThread.cs new file mode 100644 index 0000000000000..febfd532c4433 --- /dev/null +++ b/src/VisualStudio/Core/Test.Next/EditAndContiue/Mocks/DkmThread.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue +{ + public class DkmThread + { + public Guid UniqueId { get; set; } + } +} diff --git a/src/VisualStudio/Core/Test.Next/EditAndContiue/VisualStudioActiveStatementProviderTests.cs b/src/VisualStudio/Core/Test.Next/EditAndContiue/VisualStudioActiveStatementProviderTests.cs new file mode 100644 index 0000000000000..e682ca3829016 --- /dev/null +++ b/src/VisualStudio/Core/Test.Next/EditAndContiue/VisualStudioActiveStatementProviderTests.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.PooledObjects; +using Microsoft.VisualStudio.Debugger.Clr; +using Microsoft.VisualStudio.Debugger.Symbols; +using Roslyn.Test.Utilities; +using Xunit; + +namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue +{ + public class VisualStudioActiveStatementProviderTests + { + [Fact] + public void GroupActiveStatementsByInstructionId() + { + var module1 = new Guid("10000000-0000-0000-0000-000000000000"); + var module2 = new Guid("20000000-0000-0000-0000-000000000000"); + var thread1 = new Guid("01000000-0000-0000-0000-000000000000"); + var thread2 = new Guid("02000000-0000-0000-0000-000000000000"); + + var map = new Dictionary Threads, int Index, ActiveStatementFlags Flags)>(); + + VisualStudioActiveStatementProvider.GroupActiveStatementsByInstructionId(map, new[] + { + // thread #1: + new DkmActiveStatement( + thread1, + module1, + 0x06000001, + methodVersion: 1, + ilOffset: 0, + DkmActiveStatementFlags.None | DkmActiveStatementFlags.MethodUpToDate), + new DkmActiveStatement( + thread1, + module2, + 0x06000001, + methodVersion: 1, + ilOffset: 0, + DkmActiveStatementFlags.Leaf | DkmActiveStatementFlags.MethodUpToDate), + + // thread #2: + new DkmActiveStatement( + thread2, + module1, + 0x06000001, + methodVersion: 1, + ilOffset: 0, + DkmActiveStatementFlags.MethodUpToDate), + new DkmActiveStatement( + thread2, + module1, + 0x06000002, + methodVersion: 1, + ilOffset: 2, + DkmActiveStatementFlags.MidStatement), + new DkmActiveStatement( + thread2, + module1, + 0x06000003, + methodVersion: 1, + ilOffset: 4, + DkmActiveStatementFlags.NonUser | DkmActiveStatementFlags.MethodUpToDate), + new DkmActiveStatement( + thread2, + module1, + 0x06000001, + methodVersion: 1, + ilOffset: 0, + DkmActiveStatementFlags.Leaf | DkmActiveStatementFlags.MethodUpToDate) + }); + + AssertEx.Equal(new[] + { + "0: mvid=10000000-0000-0000-0000-000000000000 0x06000001 v1 IL_0000 threads=[01000000-0000-0000-0000-000000000000,02000000-0000-0000-0000-000000000000,02000000-0000-0000-0000-000000000000] [IsLeafFrame, MethodUpToDate, IsNonLeafFrame]", + "1: mvid=20000000-0000-0000-0000-000000000000 0x06000001 v1 IL_0000 threads=[01000000-0000-0000-0000-000000000000] [IsLeafFrame, MethodUpToDate]", + "2: mvid=10000000-0000-0000-0000-000000000000 0x06000002 v1 IL_0002 threads=[02000000-0000-0000-0000-000000000000] [PartiallyExecuted, IsNonLeafFrame]", + "3: mvid=10000000-0000-0000-0000-000000000000 0x06000003 v1 IL_0004 threads=[02000000-0000-0000-0000-000000000000] [NonUserCode, MethodUpToDate, IsNonLeafFrame]" + }, map.OrderBy(e => e.Value.Index).Select(e => $"{e.Value.Index}: {e.Key.GetDebuggerDisplay()} threads=[{string.Join(",", e.Value.Threads)}] [{e.Value.Flags}]")); + } + + [Fact] + public void GroupActiveStatementsByInstructionId_InconsistentFlags() + { + var module1 = new Guid("10000000-0000-0000-0000-000000000000"); + var thread1 = new Guid("01000000-0000-0000-0000-000000000000"); + + var map = new Dictionary Threads, int Index, ActiveStatementFlags Flags)>(); + + Assert.Throws(() => VisualStudioActiveStatementProvider.GroupActiveStatementsByInstructionId(map, new[] + { + // thread #1: + new DkmActiveStatement( + thread1, + module1, + 0x06000001, + methodVersion: 1, + ilOffset: 0, + DkmActiveStatementFlags.MethodUpToDate), + + // thread #2: + new DkmActiveStatement( + thread1, + module1, + 0x06000001, + methodVersion: 1, + ilOffset: 0, + DkmActiveStatementFlags.MidStatement) + })); + } + } +} diff --git a/src/VisualStudio/Core/Test.Next/VisualStudioTest.Next.csproj b/src/VisualStudio/Core/Test.Next/VisualStudioTest.Next.csproj index fbf60b5a5d953..613f674a9a802 100644 --- a/src/VisualStudio/Core/Test.Next/VisualStudioTest.Next.csproj +++ b/src/VisualStudio/Core/Test.Next/VisualStudioTest.Next.csproj @@ -12,6 +12,7 @@ $(RoslynDesktopRuntimeIdentifier) true UnitTest + $(DefineConstants);TESTS @@ -86,6 +87,9 @@ + + + diff --git a/src/VisualStudio/Core/Test/EditAndContinue/EditAndContinueWorkspaceServiceTests.vb b/src/VisualStudio/Core/Test/EditAndContinue/EditAndContinueWorkspaceServiceTests.vb index f401a2fb53ea9..47cde865f5007 100644 --- a/src/VisualStudio/Core/Test/EditAndContinue/EditAndContinueWorkspaceServiceTests.vb +++ b/src/VisualStudio/Core/Test/EditAndContinue/EditAndContinueWorkspaceServiceTests.vb @@ -10,7 +10,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue Public Sub ReadOnlyDocumentTest() Dim diagnosticService As IDiagnosticAnalyzerService = New EditAndContinueTestHelper.TestDiagnosticAnalyzerService() - Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService) + Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService, New TestActiveStatementProvider()) Dim workspace = EditAndContinueTestHelper.CreateTestWorkspace() Dim currentSolution = workspace.CurrentSolution Dim project = currentSolution.Projects(0) @@ -35,24 +35,23 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue Assert.Equal(True, isReadOnly) ' edit mode - Dim activeStatement = New Dictionary(Of DocumentId, ImmutableArray(Of ActiveStatementSpan))() Dim projectStates = ImmutableArray.Create(New KeyValuePair(Of ProjectId, ProjectReadOnlyReason)(project.Id, ProjectReadOnlyReason.None)) - encService.StartEditSession(currentSolution, activeStatement, projectStates.ToImmutableDictionary(), stoppedAtException:=False) + encService.StartEditSession(currentSolution, projectStates.ToImmutableDictionary(), stoppedAtException:=False) isReadOnly = encService.IsProjectReadOnly(project.Id, sessionReason, projectReason) Assert.Equal(ProjectReadOnlyReason.None, projectReason) Assert.Equal(SessionReadOnlyReason.None, sessionReason) Assert.Equal(False, isReadOnly) ' end edit session - encService.EndEditSession() + encService.EndEditSession(ImmutableDictionary(Of ActiveMethodId, ImmutableArray(Of NonRemappableRegion)).Empty) isReadOnly = encService.IsProjectReadOnly(project.Id, sessionReason, projectReason) Assert.Equal(ProjectReadOnlyReason.None, projectReason) Assert.Equal(SessionReadOnlyReason.Running, sessionReason) Assert.Equal(True, isReadOnly) ' break mode and stop at exception - encService.StartEditSession(currentSolution, activeStatement, projectStates.ToImmutableDictionary(), stoppedAtException:=True) + encService.StartEditSession(currentSolution, projectStates.ToImmutableDictionary(), stoppedAtException:=True) isReadOnly = encService.IsProjectReadOnly(project.Id, sessionReason, projectReason) Assert.Equal(ProjectReadOnlyReason.None, projectReason) Assert.Equal(SessionReadOnlyReason.StoppedAtException, sessionReason) @@ -62,7 +61,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue Public Sub NotLoadedTest() Dim diagnosticService As IDiagnosticAnalyzerService = New EditAndContinueTestHelper.TestDiagnosticAnalyzerService() - Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService) + Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService, New TestActiveStatementProvider()) Dim workspace = EditAndContinueTestHelper.CreateTestWorkspace() Dim currentSolution = workspace.CurrentSolution Dim project = currentSolution.Projects(0) @@ -75,10 +74,9 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue encService.StartDebuggingSession(workspace.CurrentSolution) ' edit mode - Dim activeStatement = New Dictionary(Of DocumentId, ImmutableArray(Of ActiveStatementSpan))() - Dim projectStates = ImmutableArray.Create(Of KeyValuePair(Of ProjectId, ProjectReadOnlyReason))(New KeyValuePair(Of ProjectId, ProjectReadOnlyReason)(project.Id, ProjectReadOnlyReason.NotLoaded)) + Dim projectStates = ImmutableArray.Create(New KeyValuePair(Of ProjectId, ProjectReadOnlyReason)(project.Id, ProjectReadOnlyReason.NotLoaded)) - encService.StartEditSession(currentSolution, activeStatement, projectStates.ToImmutableDictionary(), stoppedAtException:=False) + encService.StartEditSession(currentSolution, projectStates.ToImmutableDictionary(), stoppedAtException:=False) isReadOnly = encService.IsProjectReadOnly(project.Id, sessionReason, projectReason) Assert.Equal(ProjectReadOnlyReason.NotLoaded, projectReason) Assert.Equal(SessionReadOnlyReason.None, sessionReason) @@ -88,7 +86,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue Public Sub MetaDataNotAvailableTest() Dim diagnosticService As IDiagnosticAnalyzerService = New EditAndContinueTestHelper.TestDiagnosticAnalyzerService() - Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService) + Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService, New TestActiveStatementProvider()) Dim workspace = EditAndContinueTestHelper.CreateTestWorkspace() Dim currentSolution = workspace.CurrentSolution Dim project = currentSolution.Projects(0) @@ -101,10 +99,9 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue encService.StartDebuggingSession(workspace.CurrentSolution) ' edit mode with empty project - Dim activeStatement = New Dictionary(Of DocumentId, ImmutableArray(Of ActiveStatementSpan))() Dim projectStates = ImmutableDictionary.Create(Of ProjectId, ProjectReadOnlyReason) - encService.StartEditSession(currentSolution, activeStatement, projectStates, stoppedAtException:=False) + encService.StartEditSession(currentSolution, projectStates, stoppedAtException:=False) isReadOnly = encService.IsProjectReadOnly(project.Id, sessionReason, projectReason) Assert.Equal(ProjectReadOnlyReason.MetadataNotAvailable, projectReason) Assert.Equal(SessionReadOnlyReason.None, sessionReason) diff --git a/src/VisualStudio/Core/Test/EditAndContinue/TestActiveStatementProvider.vb b/src/VisualStudio/Core/Test/EditAndContinue/TestActiveStatementProvider.vb new file mode 100644 index 0000000000000..eaea50189a84f --- /dev/null +++ b/src/VisualStudio/Core/Test/EditAndContinue/TestActiveStatementProvider.vb @@ -0,0 +1,16 @@ +' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +Imports System.Collections.Immutable +Imports System.Threading +Imports System.Threading.Tasks +Imports Microsoft.CodeAnalysis.EditAndContinue + +Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue + Friend Class TestActiveStatementProvider + Implements IActiveStatementProvider + + Public Function GetActiveStatementsAsync(cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of ActiveStatementDebugInfo)) Implements IActiveStatementProvider.GetActiveStatementsAsync + Throw New NotImplementedException() + End Function + End Class +End Namespace diff --git a/src/VisualStudio/Core/Test/EditAndContinue/VsReadOnlyDocumentTrackerTests.vb b/src/VisualStudio/Core/Test/EditAndContinue/VsReadOnlyDocumentTrackerTests.vb index 807e5590cfbb7..9eb6ca3d24c8b 100644 --- a/src/VisualStudio/Core/Test/EditAndContinue/VsReadOnlyDocumentTrackerTests.vb +++ b/src/VisualStudio/Core/Test/EditAndContinue/VsReadOnlyDocumentTrackerTests.vb @@ -23,7 +23,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue Public Sub StandardTextDocumentTest() Dim diagnosticService As IDiagnosticAnalyzerService = New EditAndContinueTestHelper.TestDiagnosticAnalyzerService() - Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService) + Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService, New TestActiveStatementProvider()) Dim workspace = EditAndContinueTestHelper.CreateTestWorkspace() Dim currentSolution = workspace.CurrentSolution Dim project = currentSolution.Projects(0) @@ -48,22 +48,21 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue Assert.Equal(Of UInteger)(1, mockVsBuffer._oldFlags) ' Read-Only ' edit mode - Dim activeStatement = New Dictionary(Of DocumentId, ImmutableArray(Of ActiveStatementSpan))() - Dim projectStates = ImmutableArray.Create(Of KeyValuePair(Of ProjectId, ProjectReadOnlyReason))(New KeyValuePair(Of ProjectId, ProjectReadOnlyReason)(project.Id, ProjectReadOnlyReason.None)) + Dim projectStates = ImmutableArray.Create(New KeyValuePair(Of ProjectId, ProjectReadOnlyReason)(project.Id, ProjectReadOnlyReason.None)) - encService.StartEditSession(currentSolution, activeStatement, projectStates.ToImmutableDictionary(), stoppedAtException:=False) + encService.StartEditSession(currentSolution, projectStates.ToImmutableDictionary(), stoppedAtException:=False) isReadOnly = encService.IsProjectReadOnly(project.Id, sessionReason, projectReason) AndAlso allowsReadOnly readOnlyDocumentTracker.SetReadOnly(project.DocumentIds.First(), isReadOnly) Assert.Equal(Of UInteger)(0, mockVsBuffer._oldFlags) ' Editable ' end edit session - encService.EndEditSession() + encService.EndEditSession(ImmutableDictionary(Of ActiveMethodId, ImmutableArray(Of NonRemappableRegion)).Empty) isReadOnly = encService.IsProjectReadOnly(project.Id, sessionReason, projectReason) AndAlso allowsReadOnly readOnlyDocumentTracker.SetReadOnly(project.DocumentIds.First(), isReadOnly) Assert.Equal(Of UInteger)(1, mockVsBuffer._oldFlags) ' Read-Only ' break mode and stop at exception - encService.StartEditSession(currentSolution, activeStatement, projectStates.ToImmutableDictionary(), stoppedAtException:=True) + encService.StartEditSession(currentSolution, projectStates.ToImmutableDictionary(), stoppedAtException:=True) isReadOnly = encService.IsProjectReadOnly(project.Id, sessionReason, projectReason) AndAlso allowsReadOnly readOnlyDocumentTracker.SetReadOnly(project.DocumentIds.First(), isReadOnly) Assert.Equal(Of UInteger)(1, mockVsBuffer._oldFlags) ' Read-Only @@ -73,7 +72,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue Public Sub ContainedDocumentTest() Dim diagnosticService As IDiagnosticAnalyzerService = New EditAndContinueTestHelper.TestDiagnosticAnalyzerService() - Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService) + Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService, New TestActiveStatementProvider()) Dim workspace = EditAndContinueTestHelper.CreateTestWorkspace() Dim currentSolution = workspace.CurrentSolution Dim project = currentSolution.Projects(0) @@ -97,22 +96,21 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue Assert.Equal(Of UInteger)(0, mockVsBuffer._oldFlags) ' Editable ' edit mode - Dim activeStatement = New Dictionary(Of DocumentId, ImmutableArray(Of ActiveStatementSpan))() - Dim projectStates = ImmutableArray.Create(Of KeyValuePair(Of ProjectId, ProjectReadOnlyReason))(New KeyValuePair(Of ProjectId, ProjectReadOnlyReason)(project.Id, ProjectReadOnlyReason.None)) + Dim projectStates = ImmutableArray.Create(New KeyValuePair(Of ProjectId, ProjectReadOnlyReason)(project.Id, ProjectReadOnlyReason.None)) - encService.StartEditSession(currentSolution, activeStatement, projectStates.ToImmutableDictionary(), stoppedAtException:=False) + encService.StartEditSession(currentSolution, projectStates.ToImmutableDictionary(), stoppedAtException:=False) isReadOnly = encService.IsProjectReadOnly(project.Id, sessionReason, projectReason) AndAlso allowsReadOnly readOnlyDocumentTracker.SetReadOnly(project.DocumentIds.First(), isReadOnly) Assert.Equal(Of UInteger)(0, mockVsBuffer._oldFlags) ' Editable ' end edit session - encService.EndEditSession() + encService.EndEditSession(ImmutableDictionary(Of ActiveMethodId, ImmutableArray(Of NonRemappableRegion)).Empty) isReadOnly = encService.IsProjectReadOnly(project.Id, sessionReason, projectReason) AndAlso allowsReadOnly readOnlyDocumentTracker.SetReadOnly(project.DocumentIds.First(), isReadOnly) Assert.Equal(Of UInteger)(0, mockVsBuffer._oldFlags) ' Editable ' break mode and stop at exception - encService.StartEditSession(currentSolution, activeStatement, projectStates.ToImmutableDictionary(), stoppedAtException:=True) + encService.StartEditSession(currentSolution, projectStates.ToImmutableDictionary(), stoppedAtException:=True) isReadOnly = encService.IsProjectReadOnly(project.Id, sessionReason, projectReason) AndAlso allowsReadOnly readOnlyDocumentTracker.SetReadOnly(project.DocumentIds.First(), isReadOnly) Assert.Equal(Of UInteger)(0, mockVsBuffer._oldFlags) ' Editable @@ -122,7 +120,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue Public Sub InvalidDocumentTest1() Dim diagnosticService As IDiagnosticAnalyzerService = New EditAndContinueTestHelper.TestDiagnosticAnalyzerService() - Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService) + Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService, New TestActiveStatementProvider()) Dim workspace = EditAndContinueTestHelper.CreateTestWorkspace() Dim currentSolution = workspace.CurrentSolution Dim project = currentSolution.Projects(0) @@ -149,7 +147,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.EditAndContinue Public Sub InvalidDocumentTest2() Dim diagnosticService As IDiagnosticAnalyzerService = New EditAndContinueTestHelper.TestDiagnosticAnalyzerService() - Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService) + Dim encService As IEditAndContinueService = New EditAndContinueService(diagnosticService, New TestActiveStatementProvider()) Dim workspace = EditAndContinueTestHelper.CreateTestWorkspace() Dim currentSolution = workspace.CurrentSolution Dim project = currentSolution.Projects(0) diff --git a/src/Workspaces/Core/Portable/Utilities/IDictionaryExtensions.cs b/src/Workspaces/Core/Portable/Utilities/IDictionaryExtensions.cs index 91f6515c5e15f..b9c7b649a9ef2 100644 --- a/src/Workspaces/Core/Portable/Utilities/IDictionaryExtensions.cs +++ b/src/Workspaces/Core/Portable/Utilities/IDictionaryExtensions.cs @@ -29,57 +29,5 @@ public static TValue GetValueOrDefault(this IDictionary(this IDictionary left, IDictionary right, IEqualityComparer> comparer = null) - { - comparer = comparer ?? EqualityComparer>.Default; - - // two dictionaries should have same number of entries - if (left.Count != right.Count) - { - return false; - } - - // check two dictionaries have same key/value pairs - return left.All(pair => comparer.Equals(pair)); - } - - public static void MultiAdd(this IDictionary dictionary, TKey key, TValue value) - where TCollection : ICollection, new() - { - if (!dictionary.TryGetValue(key, out var collection)) - { - collection = new TCollection(); - dictionary.Add(key, collection); - } - - collection.Add(value); - } - - public static void MultiRemove(this IDictionary dictionary, TKey key, TValue value) - where TCollection : ICollection - { - if (dictionary.TryGetValue(key, out var collection)) - { - collection.Remove(value); - - if (collection.Count == 0) - { - dictionary.Remove(key); - } - } - } - - public static void MultiAddRange(this IDictionary dictionary, TKey key, IEnumerable values) - where TCollection : ICollection, new() - { - if (!dictionary.TryGetValue(key, out var collection)) - { - collection = new TCollection(); - dictionary.Add(key, collection); - } - - collection.AddRange(values); - } } } diff --git a/src/Workspaces/Core/Portable/Utilities/PooledBuilderExtensions.cs b/src/Workspaces/Core/Portable/Utilities/PooledBuilderExtensions.cs new file mode 100644 index 0000000000000..5d12949894d6f --- /dev/null +++ b/src/Workspaces/Core/Portable/Utilities/PooledBuilderExtensions.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using Microsoft.CodeAnalysis.PooledObjects; + +namespace Roslyn.Utilities +{ + internal static class PooledBuilderExtensions + { + public static Dictionary ToDictionaryAndFree(this PooledDictionary builders) + { + var dictionary = new Dictionary(builders.Count); + + foreach (var (key, items) in builders) + { + dictionary.Add(key, items); + } + + builders.Free(); + return dictionary; + } + + public static Dictionary> ToDictionaryAndFree(this PooledDictionary> builders) + { + var dictionary = new Dictionary>(builders.Count); + + foreach (var (key, items) in builders) + { + dictionary.Add(key, items.ToImmutableAndFree()); + } + + builders.Free(); + return dictionary; + } + + public static ImmutableDictionary> ToImmutableDictionaryAndFree(this PooledDictionary> builders) + { + var result = ImmutableDictionary.CreateBuilder>(); + + foreach (var (key, items) in builders) + { + result.Add(key, items.ToImmutableAndFree()); + } + + builders.Free(); + return result.ToImmutable(); + } + + public static ImmutableArray ToFlattenedImmutableArrayAndFree(this ArrayBuilder> builders) + { + try + { + if (builders.Count == 0) + { + return ImmutableArray.Empty; + } + + if (builders.Count == 1) + { + return builders[0].ToImmutableAndFree(); + } + + var result = ArrayBuilder.GetInstance(builders.Sum(b => b.Count)); + + foreach (var builder in builders) + { + result.AddRange(builder); + builder.Free(); + } + + return result.ToImmutableAndFree(); + } + finally + { + builders.Free(); + } + } + } +} From 37362c84c38ec4e268b737342ec102f9e2780eb2 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Tue, 27 Feb 2018 21:51:49 -0800 Subject: [PATCH 17/43] Restore MultiAdd helper to fix build break --- .../Core/Portable/Utilities/IDictionaryExtensions.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Workspaces/Core/Portable/Utilities/IDictionaryExtensions.cs b/src/Workspaces/Core/Portable/Utilities/IDictionaryExtensions.cs index b9c7b649a9ef2..6c92140d1ae86 100644 --- a/src/Workspaces/Core/Portable/Utilities/IDictionaryExtensions.cs +++ b/src/Workspaces/Core/Portable/Utilities/IDictionaryExtensions.cs @@ -29,5 +29,17 @@ public static TValue GetValueOrDefault(this IDictionary(this IDictionary dictionary, TKey key, TValue value) + where TCollection : ICollection, new() + { + if (!dictionary.TryGetValue(key, out var collection)) + { + collection = new TCollection(); + dictionary.Add(key, collection); + } + + collection.Add(value); + } } } From 551cd8231d63f71f1e95e2df0c722166668ba922 Mon Sep 17 00:00:00 2001 From: JieCarolHu Date: Wed, 28 Feb 2018 16:15:07 -0800 Subject: [PATCH 18/43] Move GetImageMoniker() Glyph extension method from Editor.wpf to EditorFeatures --- .../Presentation/CustomCommitCompletion.cs | 1 - .../Completion/Presentation/ImageMonikers.cs | 1 - .../Core.Wpf/GlyphExtensions.cs | 193 ----------------- .../NavigateTo/NavigateToItemDisplay.cs | 1 - .../SymbolGlyphDeferredContentConverter.cs | 1 - .../Tags/DefaultImageMonikerService.cs | 1 - .../Core/Shared/Extensions/GlyphExtensions.cs | 194 ++++++++++++++++++ .../NavigateTo/AbstractNavigateToTests.cs | 3 +- .../FindReferences/Entries/Entry.cs | 1 - .../FindReferences/RoslynDefinitionBucket.cs | 1 - .../Shared/VisualStudioImageMonikerService.cs | 3 +- 11 files changed, 196 insertions(+), 204 deletions(-) delete mode 100644 src/EditorFeatures/Core.Wpf/GlyphExtensions.cs diff --git a/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs b/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs index ddea192c2df19..fd67ceecadbbd 100644 --- a/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs +++ b/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; -using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Imaging.Interop; using Microsoft.VisualStudio.Language.Intellisense; diff --git a/src/EditorFeatures/Core.Wpf/Completion/Presentation/ImageMonikers.cs b/src/EditorFeatures/Core.Wpf/Completion/Presentation/ImageMonikers.cs index 219bc6992ee08..683a6a45a7fc8 100644 --- a/src/EditorFeatures/Core.Wpf/Completion/Presentation/ImageMonikers.cs +++ b/src/EditorFeatures/Core.Wpf/Completion/Presentation/ImageMonikers.cs @@ -2,7 +2,6 @@ using System.Collections.Immutable; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; -using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.VisualStudio.Imaging.Interop; namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.Presentation diff --git a/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs b/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs deleted file mode 100644 index 968b406368a07..0000000000000 --- a/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs +++ /dev/null @@ -1,193 +0,0 @@ -using System; -using Microsoft.VisualStudio.Imaging; -using Microsoft.VisualStudio.Imaging.Interop; - -namespace Microsoft.CodeAnalysis.Editor.Wpf -{ - internal static class GlyphExtensions - { - public static ImageMoniker GetImageMoniker(this Glyph glyph) - { - switch (glyph) - { - case Glyph.None: - return default; - - case Glyph.Assembly: - return KnownMonikers.Assembly; - - case Glyph.BasicFile: - return KnownMonikers.VBFileNode; - case Glyph.BasicProject: - return KnownMonikers.VBProjectNode; - - case Glyph.ClassPublic: - return KnownMonikers.ClassPublic; - case Glyph.ClassProtected: - return KnownMonikers.ClassProtected; - case Glyph.ClassPrivate: - return KnownMonikers.ClassPrivate; - case Glyph.ClassInternal: - return KnownMonikers.ClassInternal; - - case Glyph.CSharpFile: - return KnownMonikers.CSFileNode; - case Glyph.CSharpProject: - return KnownMonikers.CSProjectNode; - - case Glyph.ConstantPublic: - return KnownMonikers.ConstantPublic; - case Glyph.ConstantProtected: - return KnownMonikers.ConstantProtected; - case Glyph.ConstantPrivate: - return KnownMonikers.ConstantPrivate; - case Glyph.ConstantInternal: - return KnownMonikers.ConstantInternal; - - case Glyph.DelegatePublic: - return KnownMonikers.DelegatePublic; - case Glyph.DelegateProtected: - return KnownMonikers.DelegateProtected; - case Glyph.DelegatePrivate: - return KnownMonikers.DelegatePrivate; - case Glyph.DelegateInternal: - return KnownMonikers.DelegateInternal; - - case Glyph.EnumPublic: - return KnownMonikers.EnumerationPublic; - case Glyph.EnumProtected: - return KnownMonikers.EnumerationProtected; - case Glyph.EnumPrivate: - return KnownMonikers.EnumerationPrivate; - case Glyph.EnumInternal: - return KnownMonikers.EnumerationInternal; - - case Glyph.EnumMemberPublic: - case Glyph.EnumMemberProtected: - case Glyph.EnumMemberPrivate: - case Glyph.EnumMemberInternal: - return KnownMonikers.EnumerationItemPublic; - - case Glyph.Error: - return KnownMonikers.StatusError; - - case Glyph.EventPublic: - return KnownMonikers.EventPublic; - case Glyph.EventProtected: - return KnownMonikers.EventProtected; - case Glyph.EventPrivate: - return KnownMonikers.EventPrivate; - case Glyph.EventInternal: - return KnownMonikers.EventInternal; - - // Extension methods have the same glyph regardless of accessibility. - case Glyph.ExtensionMethodPublic: - case Glyph.ExtensionMethodProtected: - case Glyph.ExtensionMethodPrivate: - case Glyph.ExtensionMethodInternal: - return KnownMonikers.ExtensionMethod; - - case Glyph.FieldPublic: - return KnownMonikers.FieldPublic; - case Glyph.FieldProtected: - return KnownMonikers.FieldProtected; - case Glyph.FieldPrivate: - return KnownMonikers.FieldPrivate; - case Glyph.FieldInternal: - return KnownMonikers.FieldInternal; - - case Glyph.InterfacePublic: - return KnownMonikers.InterfacePublic; - case Glyph.InterfaceProtected: - return KnownMonikers.InterfaceProtected; - case Glyph.InterfacePrivate: - return KnownMonikers.InterfacePrivate; - case Glyph.InterfaceInternal: - return KnownMonikers.InterfaceInternal; - - // TODO: Figure out the right thing to return here. - case Glyph.Intrinsic: - return KnownMonikers.Type; - - case Glyph.Keyword: - return KnownMonikers.IntellisenseKeyword; - - case Glyph.Label: - return KnownMonikers.Label; - - case Glyph.Parameter: - case Glyph.Local: - return KnownMonikers.LocalVariable; - - case Glyph.Namespace: - return KnownMonikers.Namespace; - - case Glyph.MethodPublic: - return KnownMonikers.MethodPublic; - case Glyph.MethodProtected: - return KnownMonikers.MethodProtected; - case Glyph.MethodPrivate: - return KnownMonikers.MethodPrivate; - case Glyph.MethodInternal: - return KnownMonikers.MethodInternal; - - case Glyph.ModulePublic: - return KnownMonikers.ModulePublic; - case Glyph.ModuleProtected: - return KnownMonikers.ModuleProtected; - case Glyph.ModulePrivate: - return KnownMonikers.ModulePrivate; - case Glyph.ModuleInternal: - return KnownMonikers.ModuleInternal; - - case Glyph.OpenFolder: - return KnownMonikers.OpenFolder; - - case Glyph.Operator: - return KnownMonikers.Operator; - - case Glyph.PropertyPublic: - return KnownMonikers.PropertyPublic; - case Glyph.PropertyProtected: - return KnownMonikers.PropertyProtected; - case Glyph.PropertyPrivate: - return KnownMonikers.PropertyPrivate; - case Glyph.PropertyInternal: - return KnownMonikers.PropertyInternal; - - case Glyph.RangeVariable: - return KnownMonikers.FieldPublic; - - case Glyph.Reference: - return KnownMonikers.Reference; - - case Glyph.StructurePublic: - return KnownMonikers.ValueTypePublic; - case Glyph.StructureProtected: - return KnownMonikers.ValueTypeProtected; - case Glyph.StructurePrivate: - return KnownMonikers.ValueTypePrivate; - case Glyph.StructureInternal: - return KnownMonikers.ValueTypeInternal; - - case Glyph.TypeParameter: - return KnownMonikers.Type; - - case Glyph.Snippet: - return KnownMonikers.Snippet; - - case Glyph.CompletionWarning: - return KnownMonikers.IntellisenseWarning; - - case Glyph.StatusInformation: - return KnownMonikers.StatusInformation; - - case Glyph.NuGet: - return KnownMonikers.NuGet; - - default: - throw new ArgumentException("glyph"); - } - } - } -} diff --git a/src/EditorFeatures/Core.Wpf/NavigateTo/NavigateToItemDisplay.cs b/src/EditorFeatures/Core.Wpf/NavigateTo/NavigateToItemDisplay.cs index 0f5063b7bd52e..14a2dfb42f49e 100644 --- a/src/EditorFeatures/Core.Wpf/NavigateTo/NavigateToItemDisplay.cs +++ b/src/EditorFeatures/Core.Wpf/NavigateTo/NavigateToItemDisplay.cs @@ -5,7 +5,6 @@ using System.Drawing; using System.Threading; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; -using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.CodeAnalysis.NavigateTo; using Microsoft.CodeAnalysis.Navigation; using Microsoft.CodeAnalysis.Text.Shared.Extensions; diff --git a/src/EditorFeatures/Core.Wpf/QuickInfo/Converters/SymbolGlyphDeferredContentConverter.cs b/src/EditorFeatures/Core.Wpf/QuickInfo/Converters/SymbolGlyphDeferredContentConverter.cs index cad17e81ce528..94359540e5eca 100644 --- a/src/EditorFeatures/Core.Wpf/QuickInfo/Converters/SymbolGlyphDeferredContentConverter.cs +++ b/src/EditorFeatures/Core.Wpf/QuickInfo/Converters/SymbolGlyphDeferredContentConverter.cs @@ -4,7 +4,6 @@ using System.Windows.Data; using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; -using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.VisualStudio.Imaging; using Microsoft.VisualStudio.PlatformUI; diff --git a/src/EditorFeatures/Core.Wpf/Tags/DefaultImageMonikerService.cs b/src/EditorFeatures/Core.Wpf/Tags/DefaultImageMonikerService.cs index 338a74ea2fecb..1e0bad2aea9b6 100644 --- a/src/EditorFeatures/Core.Wpf/Tags/DefaultImageMonikerService.cs +++ b/src/EditorFeatures/Core.Wpf/Tags/DefaultImageMonikerService.cs @@ -3,7 +3,6 @@ using System.Collections.Immutable; using System.Composition; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; -using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.VisualStudio.Imaging; using Microsoft.VisualStudio.Imaging.Interop; diff --git a/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs b/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs index acd553625f92c..cb9ddf179cc98 100644 --- a/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs +++ b/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs @@ -1,12 +1,206 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Immutable; using Microsoft.CodeAnalysis.Tags; +using Microsoft.VisualStudio.Core.Imaging; +using Microsoft.VisualStudio.Imaging; +using Microsoft.VisualStudio.Imaging.Interop; namespace Microsoft.CodeAnalysis.Editor.Shared.Extensions { internal static class GlyphExtensions { + public static ImageId GetImageId(this Glyph glyph) + { + var moniker = glyph.GetImageMoniker(); + return new ImageId(moniker.Guid, moniker.Id); + } + + public static ImageMoniker GetImageMoniker(this Glyph glyph) + { + switch (glyph) + { + case Glyph.None: + return default; + + case Glyph.Assembly: + return KnownMonikers.Assembly; + + case Glyph.BasicFile: + return KnownMonikers.VBFileNode; + case Glyph.BasicProject: + return KnownMonikers.VBProjectNode; + + case Glyph.ClassPublic: + return KnownMonikers.ClassPublic; + case Glyph.ClassProtected: + return KnownMonikers.ClassProtected; + case Glyph.ClassPrivate: + return KnownMonikers.ClassPrivate; + case Glyph.ClassInternal: + return KnownMonikers.ClassInternal; + + case Glyph.CSharpFile: + return KnownMonikers.CSFileNode; + case Glyph.CSharpProject: + return KnownMonikers.CSProjectNode; + + case Glyph.ConstantPublic: + return KnownMonikers.ConstantPublic; + case Glyph.ConstantProtected: + return KnownMonikers.ConstantProtected; + case Glyph.ConstantPrivate: + return KnownMonikers.ConstantPrivate; + case Glyph.ConstantInternal: + return KnownMonikers.ConstantInternal; + + case Glyph.DelegatePublic: + return KnownMonikers.DelegatePublic; + case Glyph.DelegateProtected: + return KnownMonikers.DelegateProtected; + case Glyph.DelegatePrivate: + return KnownMonikers.DelegatePrivate; + case Glyph.DelegateInternal: + return KnownMonikers.DelegateInternal; + + case Glyph.EnumPublic: + return KnownMonikers.EnumerationPublic; + case Glyph.EnumProtected: + return KnownMonikers.EnumerationProtected; + case Glyph.EnumPrivate: + return KnownMonikers.EnumerationPrivate; + case Glyph.EnumInternal: + return KnownMonikers.EnumerationInternal; + + case Glyph.EnumMemberPublic: + case Glyph.EnumMemberProtected: + case Glyph.EnumMemberPrivate: + case Glyph.EnumMemberInternal: + return KnownMonikers.EnumerationItemPublic; + + case Glyph.Error: + return KnownMonikers.StatusError; + + case Glyph.EventPublic: + return KnownMonikers.EventPublic; + case Glyph.EventProtected: + return KnownMonikers.EventProtected; + case Glyph.EventPrivate: + return KnownMonikers.EventPrivate; + case Glyph.EventInternal: + return KnownMonikers.EventInternal; + + // Extension methods have the same glyph regardless of accessibility. + case Glyph.ExtensionMethodPublic: + case Glyph.ExtensionMethodProtected: + case Glyph.ExtensionMethodPrivate: + case Glyph.ExtensionMethodInternal: + return KnownMonikers.ExtensionMethod; + + case Glyph.FieldPublic: + return KnownMonikers.FieldPublic; + case Glyph.FieldProtected: + return KnownMonikers.FieldProtected; + case Glyph.FieldPrivate: + return KnownMonikers.FieldPrivate; + case Glyph.FieldInternal: + return KnownMonikers.FieldInternal; + + case Glyph.InterfacePublic: + return KnownMonikers.InterfacePublic; + case Glyph.InterfaceProtected: + return KnownMonikers.InterfaceProtected; + case Glyph.InterfacePrivate: + return KnownMonikers.InterfacePrivate; + case Glyph.InterfaceInternal: + return KnownMonikers.InterfaceInternal; + + // TODO: Figure out the right thing to return here. + case Glyph.Intrinsic: + return KnownMonikers.Type; + + case Glyph.Keyword: + return KnownMonikers.IntellisenseKeyword; + + case Glyph.Label: + return KnownMonikers.Label; + + case Glyph.Parameter: + case Glyph.Local: + return KnownMonikers.LocalVariable; + + case Glyph.Namespace: + return KnownMonikers.Namespace; + + case Glyph.MethodPublic: + return KnownMonikers.MethodPublic; + case Glyph.MethodProtected: + return KnownMonikers.MethodProtected; + case Glyph.MethodPrivate: + return KnownMonikers.MethodPrivate; + case Glyph.MethodInternal: + return KnownMonikers.MethodInternal; + + case Glyph.ModulePublic: + return KnownMonikers.ModulePublic; + case Glyph.ModuleProtected: + return KnownMonikers.ModuleProtected; + case Glyph.ModulePrivate: + return KnownMonikers.ModulePrivate; + case Glyph.ModuleInternal: + return KnownMonikers.ModuleInternal; + + case Glyph.OpenFolder: + return KnownMonikers.OpenFolder; + + case Glyph.Operator: + return KnownMonikers.Operator; + + case Glyph.PropertyPublic: + return KnownMonikers.PropertyPublic; + case Glyph.PropertyProtected: + return KnownMonikers.PropertyProtected; + case Glyph.PropertyPrivate: + return KnownMonikers.PropertyPrivate; + case Glyph.PropertyInternal: + return KnownMonikers.PropertyInternal; + + case Glyph.RangeVariable: + return KnownMonikers.FieldPublic; + + case Glyph.Reference: + return KnownMonikers.Reference; + + case Glyph.StructurePublic: + return KnownMonikers.ValueTypePublic; + case Glyph.StructureProtected: + return KnownMonikers.ValueTypeProtected; + case Glyph.StructurePrivate: + return KnownMonikers.ValueTypePrivate; + case Glyph.StructureInternal: + return KnownMonikers.ValueTypeInternal; + + case Glyph.TypeParameter: + return KnownMonikers.Type; + + case Glyph.Snippet: + return KnownMonikers.Snippet; + + case Glyph.CompletionWarning: + return KnownMonikers.IntellisenseWarning; + + case Glyph.StatusInformation: + return KnownMonikers.StatusInformation; + + case Glyph.NuGet: + return KnownMonikers.NuGet; + + default: + throw new ArgumentException("glyph"); + } + } + public static Glyph GetGlyph(this ImmutableArray tags) { foreach (var tag in tags) diff --git a/src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs b/src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs index 03ea7a9a58945..8235fe137778b 100644 --- a/src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs +++ b/src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs @@ -11,7 +11,6 @@ using Microsoft.CodeAnalysis.Editor.Implementation.NavigateTo; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; -using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Test.Utilities.RemoteHost; @@ -122,7 +121,7 @@ protected void VerifyNavigateToResultItems( } internal void VerifyNavigateToResultItem( - NavigateToItem result, string name, string displayMarkup, + NavigateToItem result, string name, string displayMarkup, PatternMatchKind matchKind, string navigateToItemKind, Glyph glyph, string additionalInfo = null) { diff --git a/src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/Entry.cs b/src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/Entry.cs index 87f846ee51172..342eaf469f25d 100644 --- a/src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/Entry.cs +++ b/src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/Entry.cs @@ -2,7 +2,6 @@ using System.Windows; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; -using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.VisualStudio.Shell.TableControl; diff --git a/src/VisualStudio/Core/Def/Implementation/FindReferences/RoslynDefinitionBucket.cs b/src/VisualStudio/Core/Def/Implementation/FindReferences/RoslynDefinitionBucket.cs index fd0575d35bf0e..2c2098a7c46ee 100644 --- a/src/VisualStudio/Core/Def/Implementation/FindReferences/RoslynDefinitionBucket.cs +++ b/src/VisualStudio/Core/Def/Implementation/FindReferences/RoslynDefinitionBucket.cs @@ -5,7 +5,6 @@ using System.Windows.Documents; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; -using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.CodeAnalysis.FindUsages; using Microsoft.VisualStudio.Shell.FindAllReferences; using Microsoft.VisualStudio.Shell.TableControl; diff --git a/src/VisualStudio/Core/Def/Shared/VisualStudioImageMonikerService.cs b/src/VisualStudio/Core/Def/Shared/VisualStudioImageMonikerService.cs index 90ed147c362cd..b2c39c091f588 100644 --- a/src/VisualStudio/Core/Def/Shared/VisualStudioImageMonikerService.cs +++ b/src/VisualStudio/Core/Def/Shared/VisualStudioImageMonikerService.cs @@ -13,7 +13,6 @@ using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Utilities; -using Microsoft.CodeAnalysis.Editor.Wpf; namespace Microsoft.VisualStudio.LanguageServices.Shared { @@ -69,7 +68,7 @@ private ImageMoniker GetImageMoniker(ImmutableArray tags) } private ImageCompositionLayer CreateLayer( - ImageMoniker imageMoniker, + ImageMoniker imageMoniker, int virtualWidth = 16, int virtualYOffset = 0, int virtualXOffset = 0) From 7c27374247a556520bdc6fb83dcf8b8246752786 Mon Sep 17 00:00:00 2001 From: Carol Hu Date: Thu, 1 Mar 2018 11:45:27 -0800 Subject: [PATCH 19/43] Revert "Move GetImageMoniker() Glyph extension method from Editor.wpf to EditorFeatures" This reverts commit 551cd8231d63f71f1e95e2df0c722166668ba922. --- .../Presentation/CustomCommitCompletion.cs | 1 + .../Completion/Presentation/ImageMonikers.cs | 1 + .../Core.Wpf/GlyphExtensions.cs | 193 +++++++++++++++++ .../NavigateTo/NavigateToItemDisplay.cs | 1 + .../SymbolGlyphDeferredContentConverter.cs | 1 + .../Tags/DefaultImageMonikerService.cs | 1 + .../Core/Shared/Extensions/GlyphExtensions.cs | 194 ------------------ .../NavigateTo/AbstractNavigateToTests.cs | 3 +- .../FindReferences/Entries/Entry.cs | 1 + .../FindReferences/RoslynDefinitionBucket.cs | 1 + .../Shared/VisualStudioImageMonikerService.cs | 3 +- 11 files changed, 204 insertions(+), 196 deletions(-) create mode 100644 src/EditorFeatures/Core.Wpf/GlyphExtensions.cs diff --git a/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs b/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs index fd67ceecadbbd..ddea192c2df19 100644 --- a/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs +++ b/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; +using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Imaging.Interop; using Microsoft.VisualStudio.Language.Intellisense; diff --git a/src/EditorFeatures/Core.Wpf/Completion/Presentation/ImageMonikers.cs b/src/EditorFeatures/Core.Wpf/Completion/Presentation/ImageMonikers.cs index 683a6a45a7fc8..219bc6992ee08 100644 --- a/src/EditorFeatures/Core.Wpf/Completion/Presentation/ImageMonikers.cs +++ b/src/EditorFeatures/Core.Wpf/Completion/Presentation/ImageMonikers.cs @@ -2,6 +2,7 @@ using System.Collections.Immutable; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; +using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.VisualStudio.Imaging.Interop; namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.Presentation diff --git a/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs b/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs new file mode 100644 index 0000000000000..968b406368a07 --- /dev/null +++ b/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs @@ -0,0 +1,193 @@ +using System; +using Microsoft.VisualStudio.Imaging; +using Microsoft.VisualStudio.Imaging.Interop; + +namespace Microsoft.CodeAnalysis.Editor.Wpf +{ + internal static class GlyphExtensions + { + public static ImageMoniker GetImageMoniker(this Glyph glyph) + { + switch (glyph) + { + case Glyph.None: + return default; + + case Glyph.Assembly: + return KnownMonikers.Assembly; + + case Glyph.BasicFile: + return KnownMonikers.VBFileNode; + case Glyph.BasicProject: + return KnownMonikers.VBProjectNode; + + case Glyph.ClassPublic: + return KnownMonikers.ClassPublic; + case Glyph.ClassProtected: + return KnownMonikers.ClassProtected; + case Glyph.ClassPrivate: + return KnownMonikers.ClassPrivate; + case Glyph.ClassInternal: + return KnownMonikers.ClassInternal; + + case Glyph.CSharpFile: + return KnownMonikers.CSFileNode; + case Glyph.CSharpProject: + return KnownMonikers.CSProjectNode; + + case Glyph.ConstantPublic: + return KnownMonikers.ConstantPublic; + case Glyph.ConstantProtected: + return KnownMonikers.ConstantProtected; + case Glyph.ConstantPrivate: + return KnownMonikers.ConstantPrivate; + case Glyph.ConstantInternal: + return KnownMonikers.ConstantInternal; + + case Glyph.DelegatePublic: + return KnownMonikers.DelegatePublic; + case Glyph.DelegateProtected: + return KnownMonikers.DelegateProtected; + case Glyph.DelegatePrivate: + return KnownMonikers.DelegatePrivate; + case Glyph.DelegateInternal: + return KnownMonikers.DelegateInternal; + + case Glyph.EnumPublic: + return KnownMonikers.EnumerationPublic; + case Glyph.EnumProtected: + return KnownMonikers.EnumerationProtected; + case Glyph.EnumPrivate: + return KnownMonikers.EnumerationPrivate; + case Glyph.EnumInternal: + return KnownMonikers.EnumerationInternal; + + case Glyph.EnumMemberPublic: + case Glyph.EnumMemberProtected: + case Glyph.EnumMemberPrivate: + case Glyph.EnumMemberInternal: + return KnownMonikers.EnumerationItemPublic; + + case Glyph.Error: + return KnownMonikers.StatusError; + + case Glyph.EventPublic: + return KnownMonikers.EventPublic; + case Glyph.EventProtected: + return KnownMonikers.EventProtected; + case Glyph.EventPrivate: + return KnownMonikers.EventPrivate; + case Glyph.EventInternal: + return KnownMonikers.EventInternal; + + // Extension methods have the same glyph regardless of accessibility. + case Glyph.ExtensionMethodPublic: + case Glyph.ExtensionMethodProtected: + case Glyph.ExtensionMethodPrivate: + case Glyph.ExtensionMethodInternal: + return KnownMonikers.ExtensionMethod; + + case Glyph.FieldPublic: + return KnownMonikers.FieldPublic; + case Glyph.FieldProtected: + return KnownMonikers.FieldProtected; + case Glyph.FieldPrivate: + return KnownMonikers.FieldPrivate; + case Glyph.FieldInternal: + return KnownMonikers.FieldInternal; + + case Glyph.InterfacePublic: + return KnownMonikers.InterfacePublic; + case Glyph.InterfaceProtected: + return KnownMonikers.InterfaceProtected; + case Glyph.InterfacePrivate: + return KnownMonikers.InterfacePrivate; + case Glyph.InterfaceInternal: + return KnownMonikers.InterfaceInternal; + + // TODO: Figure out the right thing to return here. + case Glyph.Intrinsic: + return KnownMonikers.Type; + + case Glyph.Keyword: + return KnownMonikers.IntellisenseKeyword; + + case Glyph.Label: + return KnownMonikers.Label; + + case Glyph.Parameter: + case Glyph.Local: + return KnownMonikers.LocalVariable; + + case Glyph.Namespace: + return KnownMonikers.Namespace; + + case Glyph.MethodPublic: + return KnownMonikers.MethodPublic; + case Glyph.MethodProtected: + return KnownMonikers.MethodProtected; + case Glyph.MethodPrivate: + return KnownMonikers.MethodPrivate; + case Glyph.MethodInternal: + return KnownMonikers.MethodInternal; + + case Glyph.ModulePublic: + return KnownMonikers.ModulePublic; + case Glyph.ModuleProtected: + return KnownMonikers.ModuleProtected; + case Glyph.ModulePrivate: + return KnownMonikers.ModulePrivate; + case Glyph.ModuleInternal: + return KnownMonikers.ModuleInternal; + + case Glyph.OpenFolder: + return KnownMonikers.OpenFolder; + + case Glyph.Operator: + return KnownMonikers.Operator; + + case Glyph.PropertyPublic: + return KnownMonikers.PropertyPublic; + case Glyph.PropertyProtected: + return KnownMonikers.PropertyProtected; + case Glyph.PropertyPrivate: + return KnownMonikers.PropertyPrivate; + case Glyph.PropertyInternal: + return KnownMonikers.PropertyInternal; + + case Glyph.RangeVariable: + return KnownMonikers.FieldPublic; + + case Glyph.Reference: + return KnownMonikers.Reference; + + case Glyph.StructurePublic: + return KnownMonikers.ValueTypePublic; + case Glyph.StructureProtected: + return KnownMonikers.ValueTypeProtected; + case Glyph.StructurePrivate: + return KnownMonikers.ValueTypePrivate; + case Glyph.StructureInternal: + return KnownMonikers.ValueTypeInternal; + + case Glyph.TypeParameter: + return KnownMonikers.Type; + + case Glyph.Snippet: + return KnownMonikers.Snippet; + + case Glyph.CompletionWarning: + return KnownMonikers.IntellisenseWarning; + + case Glyph.StatusInformation: + return KnownMonikers.StatusInformation; + + case Glyph.NuGet: + return KnownMonikers.NuGet; + + default: + throw new ArgumentException("glyph"); + } + } + } +} diff --git a/src/EditorFeatures/Core.Wpf/NavigateTo/NavigateToItemDisplay.cs b/src/EditorFeatures/Core.Wpf/NavigateTo/NavigateToItemDisplay.cs index 14a2dfb42f49e..0f5063b7bd52e 100644 --- a/src/EditorFeatures/Core.Wpf/NavigateTo/NavigateToItemDisplay.cs +++ b/src/EditorFeatures/Core.Wpf/NavigateTo/NavigateToItemDisplay.cs @@ -5,6 +5,7 @@ using System.Drawing; using System.Threading; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; +using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.CodeAnalysis.NavigateTo; using Microsoft.CodeAnalysis.Navigation; using Microsoft.CodeAnalysis.Text.Shared.Extensions; diff --git a/src/EditorFeatures/Core.Wpf/QuickInfo/Converters/SymbolGlyphDeferredContentConverter.cs b/src/EditorFeatures/Core.Wpf/QuickInfo/Converters/SymbolGlyphDeferredContentConverter.cs index 94359540e5eca..cad17e81ce528 100644 --- a/src/EditorFeatures/Core.Wpf/QuickInfo/Converters/SymbolGlyphDeferredContentConverter.cs +++ b/src/EditorFeatures/Core.Wpf/QuickInfo/Converters/SymbolGlyphDeferredContentConverter.cs @@ -4,6 +4,7 @@ using System.Windows.Data; using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; +using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.VisualStudio.Imaging; using Microsoft.VisualStudio.PlatformUI; diff --git a/src/EditorFeatures/Core.Wpf/Tags/DefaultImageMonikerService.cs b/src/EditorFeatures/Core.Wpf/Tags/DefaultImageMonikerService.cs index 1e0bad2aea9b6..338a74ea2fecb 100644 --- a/src/EditorFeatures/Core.Wpf/Tags/DefaultImageMonikerService.cs +++ b/src/EditorFeatures/Core.Wpf/Tags/DefaultImageMonikerService.cs @@ -3,6 +3,7 @@ using System.Collections.Immutable; using System.Composition; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; +using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.VisualStudio.Imaging; using Microsoft.VisualStudio.Imaging.Interop; diff --git a/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs b/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs index cb9ddf179cc98..acd553625f92c 100644 --- a/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs +++ b/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs @@ -1,206 +1,12 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Collections.Immutable; using Microsoft.CodeAnalysis.Tags; -using Microsoft.VisualStudio.Core.Imaging; -using Microsoft.VisualStudio.Imaging; -using Microsoft.VisualStudio.Imaging.Interop; namespace Microsoft.CodeAnalysis.Editor.Shared.Extensions { internal static class GlyphExtensions { - public static ImageId GetImageId(this Glyph glyph) - { - var moniker = glyph.GetImageMoniker(); - return new ImageId(moniker.Guid, moniker.Id); - } - - public static ImageMoniker GetImageMoniker(this Glyph glyph) - { - switch (glyph) - { - case Glyph.None: - return default; - - case Glyph.Assembly: - return KnownMonikers.Assembly; - - case Glyph.BasicFile: - return KnownMonikers.VBFileNode; - case Glyph.BasicProject: - return KnownMonikers.VBProjectNode; - - case Glyph.ClassPublic: - return KnownMonikers.ClassPublic; - case Glyph.ClassProtected: - return KnownMonikers.ClassProtected; - case Glyph.ClassPrivate: - return KnownMonikers.ClassPrivate; - case Glyph.ClassInternal: - return KnownMonikers.ClassInternal; - - case Glyph.CSharpFile: - return KnownMonikers.CSFileNode; - case Glyph.CSharpProject: - return KnownMonikers.CSProjectNode; - - case Glyph.ConstantPublic: - return KnownMonikers.ConstantPublic; - case Glyph.ConstantProtected: - return KnownMonikers.ConstantProtected; - case Glyph.ConstantPrivate: - return KnownMonikers.ConstantPrivate; - case Glyph.ConstantInternal: - return KnownMonikers.ConstantInternal; - - case Glyph.DelegatePublic: - return KnownMonikers.DelegatePublic; - case Glyph.DelegateProtected: - return KnownMonikers.DelegateProtected; - case Glyph.DelegatePrivate: - return KnownMonikers.DelegatePrivate; - case Glyph.DelegateInternal: - return KnownMonikers.DelegateInternal; - - case Glyph.EnumPublic: - return KnownMonikers.EnumerationPublic; - case Glyph.EnumProtected: - return KnownMonikers.EnumerationProtected; - case Glyph.EnumPrivate: - return KnownMonikers.EnumerationPrivate; - case Glyph.EnumInternal: - return KnownMonikers.EnumerationInternal; - - case Glyph.EnumMemberPublic: - case Glyph.EnumMemberProtected: - case Glyph.EnumMemberPrivate: - case Glyph.EnumMemberInternal: - return KnownMonikers.EnumerationItemPublic; - - case Glyph.Error: - return KnownMonikers.StatusError; - - case Glyph.EventPublic: - return KnownMonikers.EventPublic; - case Glyph.EventProtected: - return KnownMonikers.EventProtected; - case Glyph.EventPrivate: - return KnownMonikers.EventPrivate; - case Glyph.EventInternal: - return KnownMonikers.EventInternal; - - // Extension methods have the same glyph regardless of accessibility. - case Glyph.ExtensionMethodPublic: - case Glyph.ExtensionMethodProtected: - case Glyph.ExtensionMethodPrivate: - case Glyph.ExtensionMethodInternal: - return KnownMonikers.ExtensionMethod; - - case Glyph.FieldPublic: - return KnownMonikers.FieldPublic; - case Glyph.FieldProtected: - return KnownMonikers.FieldProtected; - case Glyph.FieldPrivate: - return KnownMonikers.FieldPrivate; - case Glyph.FieldInternal: - return KnownMonikers.FieldInternal; - - case Glyph.InterfacePublic: - return KnownMonikers.InterfacePublic; - case Glyph.InterfaceProtected: - return KnownMonikers.InterfaceProtected; - case Glyph.InterfacePrivate: - return KnownMonikers.InterfacePrivate; - case Glyph.InterfaceInternal: - return KnownMonikers.InterfaceInternal; - - // TODO: Figure out the right thing to return here. - case Glyph.Intrinsic: - return KnownMonikers.Type; - - case Glyph.Keyword: - return KnownMonikers.IntellisenseKeyword; - - case Glyph.Label: - return KnownMonikers.Label; - - case Glyph.Parameter: - case Glyph.Local: - return KnownMonikers.LocalVariable; - - case Glyph.Namespace: - return KnownMonikers.Namespace; - - case Glyph.MethodPublic: - return KnownMonikers.MethodPublic; - case Glyph.MethodProtected: - return KnownMonikers.MethodProtected; - case Glyph.MethodPrivate: - return KnownMonikers.MethodPrivate; - case Glyph.MethodInternal: - return KnownMonikers.MethodInternal; - - case Glyph.ModulePublic: - return KnownMonikers.ModulePublic; - case Glyph.ModuleProtected: - return KnownMonikers.ModuleProtected; - case Glyph.ModulePrivate: - return KnownMonikers.ModulePrivate; - case Glyph.ModuleInternal: - return KnownMonikers.ModuleInternal; - - case Glyph.OpenFolder: - return KnownMonikers.OpenFolder; - - case Glyph.Operator: - return KnownMonikers.Operator; - - case Glyph.PropertyPublic: - return KnownMonikers.PropertyPublic; - case Glyph.PropertyProtected: - return KnownMonikers.PropertyProtected; - case Glyph.PropertyPrivate: - return KnownMonikers.PropertyPrivate; - case Glyph.PropertyInternal: - return KnownMonikers.PropertyInternal; - - case Glyph.RangeVariable: - return KnownMonikers.FieldPublic; - - case Glyph.Reference: - return KnownMonikers.Reference; - - case Glyph.StructurePublic: - return KnownMonikers.ValueTypePublic; - case Glyph.StructureProtected: - return KnownMonikers.ValueTypeProtected; - case Glyph.StructurePrivate: - return KnownMonikers.ValueTypePrivate; - case Glyph.StructureInternal: - return KnownMonikers.ValueTypeInternal; - - case Glyph.TypeParameter: - return KnownMonikers.Type; - - case Glyph.Snippet: - return KnownMonikers.Snippet; - - case Glyph.CompletionWarning: - return KnownMonikers.IntellisenseWarning; - - case Glyph.StatusInformation: - return KnownMonikers.StatusInformation; - - case Glyph.NuGet: - return KnownMonikers.NuGet; - - default: - throw new ArgumentException("glyph"); - } - } - public static Glyph GetGlyph(this ImmutableArray tags) { foreach (var tag in tags) diff --git a/src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs b/src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs index 8235fe137778b..03ea7a9a58945 100644 --- a/src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs +++ b/src/EditorFeatures/TestUtilities/NavigateTo/AbstractNavigateToTests.cs @@ -11,6 +11,7 @@ using Microsoft.CodeAnalysis.Editor.Implementation.NavigateTo; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; +using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Test.Utilities.RemoteHost; @@ -121,7 +122,7 @@ protected void VerifyNavigateToResultItems( } internal void VerifyNavigateToResultItem( - NavigateToItem result, string name, string displayMarkup, + NavigateToItem result, string name, string displayMarkup, PatternMatchKind matchKind, string navigateToItemKind, Glyph glyph, string additionalInfo = null) { diff --git a/src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/Entry.cs b/src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/Entry.cs index 342eaf469f25d..87f846ee51172 100644 --- a/src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/Entry.cs +++ b/src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/Entry.cs @@ -2,6 +2,7 @@ using System.Windows; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; +using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.VisualStudio.Shell.TableControl; diff --git a/src/VisualStudio/Core/Def/Implementation/FindReferences/RoslynDefinitionBucket.cs b/src/VisualStudio/Core/Def/Implementation/FindReferences/RoslynDefinitionBucket.cs index 2c2098a7c46ee..fd0575d35bf0e 100644 --- a/src/VisualStudio/Core/Def/Implementation/FindReferences/RoslynDefinitionBucket.cs +++ b/src/VisualStudio/Core/Def/Implementation/FindReferences/RoslynDefinitionBucket.cs @@ -5,6 +5,7 @@ using System.Windows.Documents; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; +using Microsoft.CodeAnalysis.Editor.Wpf; using Microsoft.CodeAnalysis.FindUsages; using Microsoft.VisualStudio.Shell.FindAllReferences; using Microsoft.VisualStudio.Shell.TableControl; diff --git a/src/VisualStudio/Core/Def/Shared/VisualStudioImageMonikerService.cs b/src/VisualStudio/Core/Def/Shared/VisualStudioImageMonikerService.cs index b2c39c091f588..90ed147c362cd 100644 --- a/src/VisualStudio/Core/Def/Shared/VisualStudioImageMonikerService.cs +++ b/src/VisualStudio/Core/Def/Shared/VisualStudioImageMonikerService.cs @@ -13,6 +13,7 @@ using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Utilities; +using Microsoft.CodeAnalysis.Editor.Wpf; namespace Microsoft.VisualStudio.LanguageServices.Shared { @@ -68,7 +69,7 @@ private ImageMoniker GetImageMoniker(ImmutableArray tags) } private ImageCompositionLayer CreateLayer( - ImageMoniker imageMoniker, + ImageMoniker imageMoniker, int virtualWidth = 16, int virtualYOffset = 0, int virtualXOffset = 0) From fcef664a90f078deafdf798e84a172f72f186838 Mon Sep 17 00:00:00 2001 From: Carol Hu Date: Thu, 1 Mar 2018 14:09:41 -0800 Subject: [PATCH 20/43] Add GetImageId() Glyph extension method --- .../Core/Shared/Extensions/GlyphExtensions.cs | 189 ++++++++++++++++++ 1 file changed, 189 insertions(+) diff --git a/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs b/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs index acd553625f92c..845c8ae77e7f2 100644 --- a/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs +++ b/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs @@ -1,12 +1,201 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Immutable; using Microsoft.CodeAnalysis.Tags; +using Microsoft.VisualStudio.Core.Imaging; +using Microsoft.VisualStudio.Imaging; namespace Microsoft.CodeAnalysis.Editor.Shared.Extensions { internal static class GlyphExtensions { + public static ImageId GetImageId(this Glyph glyph) + { + // VS for mac cannot refer to ImageMoniker + // so we need to expose ImageId instead of ImageMoniker here + // and expose ImageMoniker in the EditorFeatures.wpf.dll + switch (glyph) + { + case Glyph.None: + return default; + + case Glyph.Assembly: + return new ImageId(KnownMonikers.Assembly.Guid, KnownMonikers.Assembly.Id); + + case Glyph.BasicFile: + return new ImageId(KnownMonikers.VBFileNode.Guid, KnownMonikers.VBFileNode.Id); + case Glyph.BasicProject: + return new ImageId(KnownMonikers.VBProjectNode.Guid, KnownMonikers.VBProjectNode.Id); + + case Glyph.ClassPublic: + return new ImageId(KnownMonikers.ClassPublic.Guid, KnownMonikers.ClassPublic.Id); + case Glyph.ClassProtected: + return new ImageId(KnownMonikers.ClassProtected.Guid, KnownMonikers.ClassProtected.Id); + case Glyph.ClassPrivate: + return new ImageId(KnownMonikers.ClassPrivate.Guid, KnownMonikers.ClassPrivate.Id); + case Glyph.ClassInternal: + return new ImageId(KnownMonikers.ClassInternal.Guid, KnownMonikers.ClassInternal.Id); + + case Glyph.CSharpFile: + return new ImageId(KnownMonikers.CSFileNode.Guid, KnownMonikers.CSFileNode.Id); + case Glyph.CSharpProject: + return new ImageId(KnownMonikers.CSProjectNode.Guid, KnownMonikers.CSProjectNode.Id); + + case Glyph.ConstantPublic: + return new ImageId(KnownMonikers.ConstantPublic.Guid, KnownMonikers.ConstantPublic.Id); + case Glyph.ConstantProtected: + return new ImageId(KnownMonikers.ConstantProtected.Guid, KnownMonikers.ConstantProtected.Id); + case Glyph.ConstantPrivate: + return new ImageId(KnownMonikers.ConstantPrivate.Guid, KnownMonikers.ConstantPrivate.Id); + case Glyph.ConstantInternal: + return new ImageId(KnownMonikers.ConstantInternal.Guid, KnownMonikers.ConstantInternal.Id); + + case Glyph.DelegatePublic: + return new ImageId(KnownMonikers.DelegatePublic.Guid, KnownMonikers.DelegatePublic.Id); + case Glyph.DelegateProtected: + return new ImageId(KnownMonikers.DelegateProtected.Guid, KnownMonikers.DelegateProtected.Id); + case Glyph.DelegatePrivate: + return new ImageId(KnownMonikers.DelegatePrivate.Guid, KnownMonikers.DelegatePrivate.Id); + case Glyph.DelegateInternal: + return new ImageId(KnownMonikers.DelegateInternal.Guid, KnownMonikers.DelegateInternal.Id); + + case Glyph.EnumPublic: + return new ImageId(KnownMonikers.EnumerationPublic.Guid, KnownMonikers.EnumerationPublic.Id); + case Glyph.EnumProtected: + return new ImageId(KnownMonikers.EnumerationProtected.Guid, KnownMonikers.EnumerationProtected.Id); + case Glyph.EnumPrivate: + return new ImageId(KnownMonikers.EnumerationPrivate.Guid, KnownMonikers.EnumerationPrivate.Id); + case Glyph.EnumInternal: + return new ImageId(KnownMonikers.EnumerationInternal.Guid, KnownMonikers.EnumerationInternal.Id); + + case Glyph.EnumMemberPublic: + case Glyph.EnumMemberProtected: + case Glyph.EnumMemberPrivate: + case Glyph.EnumMemberInternal: + return new ImageId(KnownMonikers.EnumerationItemPublic.Guid, KnownMonikers.EnumerationItemPublic.Id); + + case Glyph.Error: + return new ImageId(KnownMonikers.StatusError.Guid, KnownMonikers.StatusError.Id); + + case Glyph.EventPublic: + return new ImageId(KnownMonikers.EventPublic.Guid, KnownMonikers.EventPublic.Id); + case Glyph.EventProtected: + return new ImageId(KnownMonikers.EventProtected.Guid, KnownMonikers.EventProtected.Id); + case Glyph.EventPrivate: + return new ImageId(KnownMonikers.EventPrivate.Guid, KnownMonikers.EventPrivate.Id); + case Glyph.EventInternal: + return new ImageId(KnownMonikers.EventInternal.Guid, KnownMonikers.EventInternal.Id); + + // Extension methods have the same glyph regardless of accessibility. + case Glyph.ExtensionMethodPublic: + case Glyph.ExtensionMethodProtected: + case Glyph.ExtensionMethodPrivate: + case Glyph.ExtensionMethodInternal: + return new ImageId(KnownMonikers.ExtensionMethod.Guid, KnownMonikers.ExtensionMethod.Id); + + case Glyph.FieldPublic: + return new ImageId(KnownMonikers.FieldPublic.Guid, KnownMonikers.FieldPublic.Id); + case Glyph.FieldProtected: + return new ImageId(KnownMonikers.FieldProtected.Guid, KnownMonikers.FieldProtected.Id); + case Glyph.FieldPrivate: + return new ImageId(KnownMonikers.FieldPrivate.Guid, KnownMonikers.FieldPrivate.Id); + case Glyph.FieldInternal: + return new ImageId(KnownMonikers.FieldInternal.Guid, KnownMonikers.FieldInternal.Id); + + case Glyph.InterfacePublic: + return new ImageId(KnownMonikers.InterfacePublic.Guid, KnownMonikers.InterfacePublic.Id); + case Glyph.InterfaceProtected: + return new ImageId(KnownMonikers.InterfaceProtected.Guid, KnownMonikers.InterfaceProtected.Id); + case Glyph.InterfacePrivate: + return new ImageId(KnownMonikers.InterfacePrivate.Guid, KnownMonikers.InterfacePrivate.Id); + case Glyph.InterfaceInternal: + return new ImageId(KnownMonikers.InterfaceInternal.Guid, KnownMonikers.InterfaceInternal.Id); + + // TODO: Figure out the right thing to return here. + case Glyph.Intrinsic: + return new ImageId(KnownMonikers.Type.Guid, KnownMonikers.Type.Id); + + case Glyph.Keyword: + return new ImageId(KnownMonikers.IntellisenseKeyword.Guid, KnownMonikers.IntellisenseKeyword.Id); + + case Glyph.Label: + return new ImageId(KnownMonikers.Label.Guid, KnownMonikers.Label.Id); + + case Glyph.Parameter: + case Glyph.Local: + return new ImageId(KnownMonikers.LocalVariable.Guid, KnownMonikers.LocalVariable.Id); + + case Glyph.Namespace: + return new ImageId(KnownMonikers.Namespace.Guid, KnownMonikers.Namespace.Id); + + case Glyph.MethodPublic: + return new ImageId(KnownMonikers.MethodPublic.Guid, KnownMonikers.MethodPublic.Id); + case Glyph.MethodProtected: + return new ImageId(KnownMonikers.MethodProtected.Guid, KnownMonikers.MethodProtected.Id); + case Glyph.MethodPrivate: + return new ImageId(KnownMonikers.MethodPrivate.Guid, KnownMonikers.MethodPrivate.Id); + case Glyph.MethodInternal: + return new ImageId(KnownMonikers.MethodInternal.Guid, KnownMonikers.MethodInternal.Id); + + case Glyph.ModulePublic: + return new ImageId(KnownMonikers.ModulePublic.Guid, KnownMonikers.ModulePublic.Id); + case Glyph.ModuleProtected: + return new ImageId(KnownMonikers.ModuleProtected.Guid, KnownMonikers.ModuleProtected.Id); + case Glyph.ModulePrivate: + return new ImageId(KnownMonikers.ModulePrivate.Guid, KnownMonikers.ModulePrivate.Id); + case Glyph.ModuleInternal: + return new ImageId(KnownMonikers.ModuleInternal.Guid, KnownMonikers.ModuleInternal.Id); + + case Glyph.OpenFolder: + return new ImageId(KnownMonikers.OpenFolder.Guid, KnownMonikers.OpenFolder.Id); + + case Glyph.Operator: + return new ImageId(KnownMonikers.Operator.Guid, KnownMonikers.Operator.Id); + + case Glyph.PropertyPublic: + return new ImageId(KnownMonikers.PropertyPublic.Guid, KnownMonikers.PropertyPublic.Id); + case Glyph.PropertyProtected: + return new ImageId(KnownMonikers.PropertyProtected.Guid, KnownMonikers.PropertyProtected.Id); + case Glyph.PropertyPrivate: + return new ImageId(KnownMonikers.PropertyPrivate.Guid, KnownMonikers.PropertyPrivate.Id); + case Glyph.PropertyInternal: + return new ImageId(KnownMonikers.PropertyInternal.Guid, KnownMonikers.PropertyInternal.Id); + + case Glyph.RangeVariable: + return new ImageId(KnownMonikers.FieldPublic.Guid, KnownMonikers.FieldPublic.Id); + + case Glyph.Reference: + return new ImageId(KnownMonikers.Reference.Guid, KnownMonikers.Reference.Id); + + case Glyph.StructurePublic: + return new ImageId(KnownMonikers.ValueTypePublic.Guid, KnownMonikers.ValueTypePublic.Id); + case Glyph.StructureProtected: + return new ImageId(KnownMonikers.ValueTypeProtected.Guid, KnownMonikers.ValueTypeProtected.Id); + case Glyph.StructurePrivate: + return new ImageId(KnownMonikers.ValueTypePrivate.Guid, KnownMonikers.ValueTypePrivate.Id); + case Glyph.StructureInternal: + return new ImageId(KnownMonikers.ValueTypeInternal.Guid, KnownMonikers.ValueTypeInternal.Id); + + case Glyph.TypeParameter: + return new ImageId(KnownMonikers.Type.Guid, KnownMonikers.Type.Id); + + case Glyph.Snippet: + return new ImageId(KnownMonikers.Snippet.Guid, KnownMonikers.Snippet.Id); + + case Glyph.CompletionWarning: + return new ImageId(KnownMonikers.IntellisenseWarning.Guid, KnownMonikers.IntellisenseWarning.Id); + + case Glyph.StatusInformation: + return new ImageId(KnownMonikers.StatusInformation.Guid, KnownMonikers.StatusInformation.Id); + + case Glyph.NuGet: + return new ImageId(KnownMonikers.NuGet.Guid, KnownMonikers.NuGet.Id); + + default: + throw new ArgumentException("glyph"); + } + } public static Glyph GetGlyph(this ImmutableArray tags) { foreach (var tag in tags) From 058606456846225a9ffd58d50ba7b2a8c2230551 Mon Sep 17 00:00:00 2001 From: Carol Hu Date: Thu, 1 Mar 2018 14:22:30 -0800 Subject: [PATCH 21/43] update GetImageMoniker() to use GetImageId() --- .../Core.Wpf/GlyphExtensions.cs | 185 +----------------- 1 file changed, 6 insertions(+), 179 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs b/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs index 968b406368a07..883346e0c41a3 100644 --- a/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs +++ b/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs @@ -1,4 +1,5 @@ using System; +using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.VisualStudio.Imaging; using Microsoft.VisualStudio.Imaging.Interop; @@ -8,186 +9,12 @@ internal static class GlyphExtensions { public static ImageMoniker GetImageMoniker(this Glyph glyph) { - switch (glyph) + var imageId = glyph.GetImageId(); + return new ImageMoniker() { - case Glyph.None: - return default; - - case Glyph.Assembly: - return KnownMonikers.Assembly; - - case Glyph.BasicFile: - return KnownMonikers.VBFileNode; - case Glyph.BasicProject: - return KnownMonikers.VBProjectNode; - - case Glyph.ClassPublic: - return KnownMonikers.ClassPublic; - case Glyph.ClassProtected: - return KnownMonikers.ClassProtected; - case Glyph.ClassPrivate: - return KnownMonikers.ClassPrivate; - case Glyph.ClassInternal: - return KnownMonikers.ClassInternal; - - case Glyph.CSharpFile: - return KnownMonikers.CSFileNode; - case Glyph.CSharpProject: - return KnownMonikers.CSProjectNode; - - case Glyph.ConstantPublic: - return KnownMonikers.ConstantPublic; - case Glyph.ConstantProtected: - return KnownMonikers.ConstantProtected; - case Glyph.ConstantPrivate: - return KnownMonikers.ConstantPrivate; - case Glyph.ConstantInternal: - return KnownMonikers.ConstantInternal; - - case Glyph.DelegatePublic: - return KnownMonikers.DelegatePublic; - case Glyph.DelegateProtected: - return KnownMonikers.DelegateProtected; - case Glyph.DelegatePrivate: - return KnownMonikers.DelegatePrivate; - case Glyph.DelegateInternal: - return KnownMonikers.DelegateInternal; - - case Glyph.EnumPublic: - return KnownMonikers.EnumerationPublic; - case Glyph.EnumProtected: - return KnownMonikers.EnumerationProtected; - case Glyph.EnumPrivate: - return KnownMonikers.EnumerationPrivate; - case Glyph.EnumInternal: - return KnownMonikers.EnumerationInternal; - - case Glyph.EnumMemberPublic: - case Glyph.EnumMemberProtected: - case Glyph.EnumMemberPrivate: - case Glyph.EnumMemberInternal: - return KnownMonikers.EnumerationItemPublic; - - case Glyph.Error: - return KnownMonikers.StatusError; - - case Glyph.EventPublic: - return KnownMonikers.EventPublic; - case Glyph.EventProtected: - return KnownMonikers.EventProtected; - case Glyph.EventPrivate: - return KnownMonikers.EventPrivate; - case Glyph.EventInternal: - return KnownMonikers.EventInternal; - - // Extension methods have the same glyph regardless of accessibility. - case Glyph.ExtensionMethodPublic: - case Glyph.ExtensionMethodProtected: - case Glyph.ExtensionMethodPrivate: - case Glyph.ExtensionMethodInternal: - return KnownMonikers.ExtensionMethod; - - case Glyph.FieldPublic: - return KnownMonikers.FieldPublic; - case Glyph.FieldProtected: - return KnownMonikers.FieldProtected; - case Glyph.FieldPrivate: - return KnownMonikers.FieldPrivate; - case Glyph.FieldInternal: - return KnownMonikers.FieldInternal; - - case Glyph.InterfacePublic: - return KnownMonikers.InterfacePublic; - case Glyph.InterfaceProtected: - return KnownMonikers.InterfaceProtected; - case Glyph.InterfacePrivate: - return KnownMonikers.InterfacePrivate; - case Glyph.InterfaceInternal: - return KnownMonikers.InterfaceInternal; - - // TODO: Figure out the right thing to return here. - case Glyph.Intrinsic: - return KnownMonikers.Type; - - case Glyph.Keyword: - return KnownMonikers.IntellisenseKeyword; - - case Glyph.Label: - return KnownMonikers.Label; - - case Glyph.Parameter: - case Glyph.Local: - return KnownMonikers.LocalVariable; - - case Glyph.Namespace: - return KnownMonikers.Namespace; - - case Glyph.MethodPublic: - return KnownMonikers.MethodPublic; - case Glyph.MethodProtected: - return KnownMonikers.MethodProtected; - case Glyph.MethodPrivate: - return KnownMonikers.MethodPrivate; - case Glyph.MethodInternal: - return KnownMonikers.MethodInternal; - - case Glyph.ModulePublic: - return KnownMonikers.ModulePublic; - case Glyph.ModuleProtected: - return KnownMonikers.ModuleProtected; - case Glyph.ModulePrivate: - return KnownMonikers.ModulePrivate; - case Glyph.ModuleInternal: - return KnownMonikers.ModuleInternal; - - case Glyph.OpenFolder: - return KnownMonikers.OpenFolder; - - case Glyph.Operator: - return KnownMonikers.Operator; - - case Glyph.PropertyPublic: - return KnownMonikers.PropertyPublic; - case Glyph.PropertyProtected: - return KnownMonikers.PropertyProtected; - case Glyph.PropertyPrivate: - return KnownMonikers.PropertyPrivate; - case Glyph.PropertyInternal: - return KnownMonikers.PropertyInternal; - - case Glyph.RangeVariable: - return KnownMonikers.FieldPublic; - - case Glyph.Reference: - return KnownMonikers.Reference; - - case Glyph.StructurePublic: - return KnownMonikers.ValueTypePublic; - case Glyph.StructureProtected: - return KnownMonikers.ValueTypeProtected; - case Glyph.StructurePrivate: - return KnownMonikers.ValueTypePrivate; - case Glyph.StructureInternal: - return KnownMonikers.ValueTypeInternal; - - case Glyph.TypeParameter: - return KnownMonikers.Type; - - case Glyph.Snippet: - return KnownMonikers.Snippet; - - case Glyph.CompletionWarning: - return KnownMonikers.IntellisenseWarning; - - case Glyph.StatusInformation: - return KnownMonikers.StatusInformation; - - case Glyph.NuGet: - return KnownMonikers.NuGet; - - default: - throw new ArgumentException("glyph"); - } + Guid = imageId.Guid, + Id = imageId.Id + }; } } } From 90eefa5f2bf1cd12b3895d4da5a1e12c5f632f5c Mon Sep 17 00:00:00 2001 From: Carol Hu Date: Thu, 1 Mar 2018 14:29:04 -0800 Subject: [PATCH 22/43] remove unused usings --- src/EditorFeatures/Core.Wpf/GlyphExtensions.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs b/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs index 883346e0c41a3..623fec687ccb2 100644 --- a/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs +++ b/src/EditorFeatures/Core.Wpf/GlyphExtensions.cs @@ -1,6 +1,4 @@ -using System; -using Microsoft.CodeAnalysis.Editor.Shared.Extensions; -using Microsoft.VisualStudio.Imaging; +using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.VisualStudio.Imaging.Interop; namespace Microsoft.CodeAnalysis.Editor.Wpf From b1d4885e147835bc30ee475d56aff5978736f98d Mon Sep 17 00:00:00 2001 From: Carol Hu Date: Thu, 1 Mar 2018 15:49:08 -0800 Subject: [PATCH 23/43] add an empty line between methods --- src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs b/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs index 845c8ae77e7f2..005657a8bf69b 100644 --- a/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs +++ b/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs @@ -196,6 +196,7 @@ public static ImageId GetImageId(this Glyph glyph) throw new ArgumentException("glyph"); } } + public static Glyph GetGlyph(this ImmutableArray tags) { foreach (var tag in tags) From 06fed70488e5c8c6a82819eb2e13c93355f26840 Mon Sep 17 00:00:00 2001 From: Carol Hu Date: Fri, 2 Mar 2018 11:16:25 -0800 Subject: [PATCH 24/43] use KnowImageIds --- .../Core/Shared/Extensions/GlyphExtensions.cs | 146 ++++++++++-------- 1 file changed, 78 insertions(+), 68 deletions(-) diff --git a/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs b/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs index 005657a8bf69b..7f9eecaa1bb17 100644 --- a/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs +++ b/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs @@ -21,179 +21,189 @@ public static ImageId GetImageId(this Glyph glyph) return default; case Glyph.Assembly: - return new ImageId(KnownMonikers.Assembly.Guid, KnownMonikers.Assembly.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.Assembly); case Glyph.BasicFile: - return new ImageId(KnownMonikers.VBFileNode.Guid, KnownMonikers.VBFileNode.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.VBFileNode); case Glyph.BasicProject: - return new ImageId(KnownMonikers.VBProjectNode.Guid, KnownMonikers.VBProjectNode.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.VBProjectNode); case Glyph.ClassPublic: - return new ImageId(KnownMonikers.ClassPublic.Guid, KnownMonikers.ClassPublic.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ClassPublic); case Glyph.ClassProtected: - return new ImageId(KnownMonikers.ClassProtected.Guid, KnownMonikers.ClassProtected.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ClassProtected); case Glyph.ClassPrivate: - return new ImageId(KnownMonikers.ClassPrivate.Guid, KnownMonikers.ClassPrivate.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ClassPrivate); case Glyph.ClassInternal: - return new ImageId(KnownMonikers.ClassInternal.Guid, KnownMonikers.ClassInternal.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ClassInternal); case Glyph.CSharpFile: - return new ImageId(KnownMonikers.CSFileNode.Guid, KnownMonikers.CSFileNode.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.CSFileNode); case Glyph.CSharpProject: - return new ImageId(KnownMonikers.CSProjectNode.Guid, KnownMonikers.CSProjectNode.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.CSProjectNode); case Glyph.ConstantPublic: - return new ImageId(KnownMonikers.ConstantPublic.Guid, KnownMonikers.ConstantPublic.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ConstantPublic); case Glyph.ConstantProtected: - return new ImageId(KnownMonikers.ConstantProtected.Guid, KnownMonikers.ConstantProtected.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ConstantProtected); case Glyph.ConstantPrivate: - return new ImageId(KnownMonikers.ConstantPrivate.Guid, KnownMonikers.ConstantPrivate.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ConstantPrivate); case Glyph.ConstantInternal: - return new ImageId(KnownMonikers.ConstantInternal.Guid, KnownMonikers.ConstantInternal.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ConstantInternal); case Glyph.DelegatePublic: - return new ImageId(KnownMonikers.DelegatePublic.Guid, KnownMonikers.DelegatePublic.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.DelegatePublic); case Glyph.DelegateProtected: - return new ImageId(KnownMonikers.DelegateProtected.Guid, KnownMonikers.DelegateProtected.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.DelegateProtected); case Glyph.DelegatePrivate: - return new ImageId(KnownMonikers.DelegatePrivate.Guid, KnownMonikers.DelegatePrivate.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.DelegatePrivate); case Glyph.DelegateInternal: - return new ImageId(KnownMonikers.DelegateInternal.Guid, KnownMonikers.DelegateInternal.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.DelegateInternal); case Glyph.EnumPublic: - return new ImageId(KnownMonikers.EnumerationPublic.Guid, KnownMonikers.EnumerationPublic.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.EnumerationPublic); case Glyph.EnumProtected: - return new ImageId(KnownMonikers.EnumerationProtected.Guid, KnownMonikers.EnumerationProtected.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.EnumerationProtected); case Glyph.EnumPrivate: - return new ImageId(KnownMonikers.EnumerationPrivate.Guid, KnownMonikers.EnumerationPrivate.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.EnumerationPrivate); case Glyph.EnumInternal: - return new ImageId(KnownMonikers.EnumerationInternal.Guid, KnownMonikers.EnumerationInternal.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.EnumerationInternal); case Glyph.EnumMemberPublic: case Glyph.EnumMemberProtected: case Glyph.EnumMemberPrivate: case Glyph.EnumMemberInternal: - return new ImageId(KnownMonikers.EnumerationItemPublic.Guid, KnownMonikers.EnumerationItemPublic.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.EnumerationItemPublic); case Glyph.Error: - return new ImageId(KnownMonikers.StatusError.Guid, KnownMonikers.StatusError.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.StatusError); case Glyph.EventPublic: - return new ImageId(KnownMonikers.EventPublic.Guid, KnownMonikers.EventPublic.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.EventPublic); case Glyph.EventProtected: - return new ImageId(KnownMonikers.EventProtected.Guid, KnownMonikers.EventProtected.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.EventProtected); case Glyph.EventPrivate: - return new ImageId(KnownMonikers.EventPrivate.Guid, KnownMonikers.EventPrivate.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.EventPrivate); case Glyph.EventInternal: - return new ImageId(KnownMonikers.EventInternal.Guid, KnownMonikers.EventInternal.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.EventInternal); // Extension methods have the same glyph regardless of accessibility. case Glyph.ExtensionMethodPublic: case Glyph.ExtensionMethodProtected: case Glyph.ExtensionMethodPrivate: case Glyph.ExtensionMethodInternal: - return new ImageId(KnownMonikers.ExtensionMethod.Guid, KnownMonikers.ExtensionMethod.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ExtensionMethod); case Glyph.FieldPublic: - return new ImageId(KnownMonikers.FieldPublic.Guid, KnownMonikers.FieldPublic.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.FieldPublic); case Glyph.FieldProtected: - return new ImageId(KnownMonikers.FieldProtected.Guid, KnownMonikers.FieldProtected.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.FieldProtected); case Glyph.FieldPrivate: - return new ImageId(KnownMonikers.FieldPrivate.Guid, KnownMonikers.FieldPrivate.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.FieldPrivate); case Glyph.FieldInternal: - return new ImageId(KnownMonikers.FieldInternal.Guid, KnownMonikers.FieldInternal.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.FieldInternal); case Glyph.InterfacePublic: - return new ImageId(KnownMonikers.InterfacePublic.Guid, KnownMonikers.InterfacePublic.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.InterfacePublic); case Glyph.InterfaceProtected: - return new ImageId(KnownMonikers.InterfaceProtected.Guid, KnownMonikers.InterfaceProtected.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.InterfaceProtected); case Glyph.InterfacePrivate: - return new ImageId(KnownMonikers.InterfacePrivate.Guid, KnownMonikers.InterfacePrivate.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.InterfacePrivate); case Glyph.InterfaceInternal: - return new ImageId(KnownMonikers.InterfaceInternal.Guid, KnownMonikers.InterfaceInternal.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.InterfaceInternal); // TODO: Figure out the right thing to return here. case Glyph.Intrinsic: - return new ImageId(KnownMonikers.Type.Guid, KnownMonikers.Type.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.Type); case Glyph.Keyword: - return new ImageId(KnownMonikers.IntellisenseKeyword.Guid, KnownMonikers.IntellisenseKeyword.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.IntellisenseKeyword); case Glyph.Label: - return new ImageId(KnownMonikers.Label.Guid, KnownMonikers.Label.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.Label); case Glyph.Parameter: case Glyph.Local: return new ImageId(KnownMonikers.LocalVariable.Guid, KnownMonikers.LocalVariable.Id); case Glyph.Namespace: - return new ImageId(KnownMonikers.Namespace.Guid, KnownMonikers.Namespace.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.Namespace); case Glyph.MethodPublic: - return new ImageId(KnownMonikers.MethodPublic.Guid, KnownMonikers.MethodPublic.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.MethodPublic); case Glyph.MethodProtected: - return new ImageId(KnownMonikers.MethodProtected.Guid, KnownMonikers.MethodProtected.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.MethodProtected); case Glyph.MethodPrivate: - return new ImageId(KnownMonikers.MethodPrivate.Guid, KnownMonikers.MethodPrivate.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.MethodPrivate); case Glyph.MethodInternal: - return new ImageId(KnownMonikers.MethodInternal.Guid, KnownMonikers.MethodInternal.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.MethodInternal); case Glyph.ModulePublic: - return new ImageId(KnownMonikers.ModulePublic.Guid, KnownMonikers.ModulePublic.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ModulePublic); case Glyph.ModuleProtected: - return new ImageId(KnownMonikers.ModuleProtected.Guid, KnownMonikers.ModuleProtected.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ModuleProtected); case Glyph.ModulePrivate: - return new ImageId(KnownMonikers.ModulePrivate.Guid, KnownMonikers.ModulePrivate.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ModulePrivate); case Glyph.ModuleInternal: - return new ImageId(KnownMonikers.ModuleInternal.Guid, KnownMonikers.ModuleInternal.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ModuleInternal); case Glyph.OpenFolder: - return new ImageId(KnownMonikers.OpenFolder.Guid, KnownMonikers.OpenFolder.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.OpenFolder); case Glyph.Operator: - return new ImageId(KnownMonikers.Operator.Guid, KnownMonikers.Operator.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.Operator); case Glyph.PropertyPublic: - return new ImageId(KnownMonikers.PropertyPublic.Guid, KnownMonikers.PropertyPublic.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.PropertyPublic); case Glyph.PropertyProtected: - return new ImageId(KnownMonikers.PropertyProtected.Guid, KnownMonikers.PropertyProtected.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.PropertyProtected); case Glyph.PropertyPrivate: - return new ImageId(KnownMonikers.PropertyPrivate.Guid, KnownMonikers.PropertyPrivate.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.PropertyPrivate); case Glyph.PropertyInternal: - return new ImageId(KnownMonikers.PropertyInternal.Guid, KnownMonikers.PropertyInternal.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.PropertyInternal); case Glyph.RangeVariable: - return new ImageId(KnownMonikers.FieldPublic.Guid, KnownMonikers.FieldPublic.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.FieldPublic); case Glyph.Reference: - return new ImageId(KnownMonikers.Reference.Guid, KnownMonikers.Reference.Id); - + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.Reference); + + //// this is not a copy-paste mistake, we were using these before in the previous GetImageMoniker() + //case Glyph.StructurePublic: + // return KnownMonikers.ValueTypePublic; + //case Glyph.StructureProtected: + // return KnownMonikers.ValueTypeProtected; + //case Glyph.StructurePrivate: + // return KnownMonikers.ValueTypePrivate; + //case Glyph.StructureInternal: + // return KnownMonikers.ValueTypeInternal; + case Glyph.StructurePublic: - return new ImageId(KnownMonikers.ValueTypePublic.Guid, KnownMonikers.ValueTypePublic.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ValueTypePublic); case Glyph.StructureProtected: - return new ImageId(KnownMonikers.ValueTypeProtected.Guid, KnownMonikers.ValueTypeProtected.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ValueTypeProtected); case Glyph.StructurePrivate: - return new ImageId(KnownMonikers.ValueTypePrivate.Guid, KnownMonikers.ValueTypePrivate.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ValueTypePrivate); case Glyph.StructureInternal: - return new ImageId(KnownMonikers.ValueTypeInternal.Guid, KnownMonikers.ValueTypeInternal.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ValueTypeInternal); case Glyph.TypeParameter: - return new ImageId(KnownMonikers.Type.Guid, KnownMonikers.Type.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.Type); case Glyph.Snippet: - return new ImageId(KnownMonikers.Snippet.Guid, KnownMonikers.Snippet.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.Snippet); case Glyph.CompletionWarning: - return new ImageId(KnownMonikers.IntellisenseWarning.Guid, KnownMonikers.IntellisenseWarning.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.IntellisenseWarning); case Glyph.StatusInformation: - return new ImageId(KnownMonikers.StatusInformation.Guid, KnownMonikers.StatusInformation.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.StatusInformation); - case Glyph.NuGet: - return new ImageId(KnownMonikers.NuGet.Guid, KnownMonikers.NuGet.Id); + case Glyph.NuGet: + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.NuGet); default: - throw new ArgumentException("glyph"); + throw new ArgumentException(nameof(glyph)); } } From d078bf2c5c56848e7bbe949f8ffa1ef635942a4c Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Tue, 6 Mar 2018 13:51:09 -0800 Subject: [PATCH 25/43] Harden against errors reading active statement properties --- .../VisualStudioActiveStatementProvider.cs | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.cs b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.cs index 0ec06d353e7d4..a6e82c07be0bd 100644 --- a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.cs +++ b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.cs @@ -30,12 +30,21 @@ public Task> GetActiveStatementsAsync(C // TODO: return empty outside of debug session. // https://github.com/dotnet/roslyn/issues/24325 - var workList = DkmWorkList.Create(CompletionRoutine: null); + bool completed = false; + int unexpectedError = 0; var completion = new TaskCompletionSource>(); var builders = default(ArrayBuilder>); int pendingRuntimes = 0; int runtimeCount = 0; + var workList = DkmWorkList.Create(CompletionRoutine: _ => + { + if (!completed) + { + completion.TrySetException(new InvalidOperationException($"Unexpected error enumerating active statements: 0x{unexpectedError:X8}")); + } + }); + void CancelWork() { if (builders != null) @@ -50,6 +59,7 @@ void CancelWork() // workList.Cancel(); // make sure we cancel with the token we received from the caller: + completed = true; completion.TrySetCanceled(cancellationToken); } } @@ -73,8 +83,15 @@ void CancelWork() return; } + if (activeStatementsResult.ErrorCode != 0) + { + unexpectedError = activeStatementsResult.ErrorCode; + return; + } + // group active statement by instruction and aggregate flags and threads: var instructionMap = PooledDictionary Threads, int Index, ActiveStatementFlags Flags)>.GetInstance(); + GroupActiveStatementsByInstructionId(instructionMap, activeStatementsResult.ActiveStatements); int pendingStatements = instructionMap.Count; @@ -93,10 +110,16 @@ void CancelWork() return; } - var position = sourcePositionResult.SourcePosition; + int errorCode = sourcePositionResult.ErrorCode; + if (errorCode != 0) + { + unexpectedError = errorCode; + } + + DkmSourcePosition position; string documentNameOpt; LinePositionSpan span; - if (sourcePositionResult.ErrorCode == 0 && position != null) + if (errorCode == 0 && (position = sourcePositionResult.SourcePosition) != null) { documentNameOpt = position.DocumentName; span = ToLinePositionSpan(position.TextSpan); @@ -122,6 +145,7 @@ void CancelWork() // the last active statement of the last runtime has been processed: if (Interlocked.Decrement(ref pendingRuntimes) == 0) { + completed = true; completion.SetResult(builders.ToFlattenedImmutableArrayAndFree()); } } From 974a0cfafa8ad1ad71c4c66af1c436c3c600dbbe Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Tue, 6 Mar 2018 15:55:15 -0800 Subject: [PATCH 26/43] Use TrySet methods --- .../VisualStudioActiveStatementProvider.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.cs b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.cs index a6e82c07be0bd..6094067c729fc 100644 --- a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.cs +++ b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/VisualStudioActiveStatementProvider.cs @@ -30,7 +30,6 @@ public Task> GetActiveStatementsAsync(C // TODO: return empty outside of debug session. // https://github.com/dotnet/roslyn/issues/24325 - bool completed = false; int unexpectedError = 0; var completion = new TaskCompletionSource>(); var builders = default(ArrayBuilder>); @@ -39,10 +38,7 @@ public Task> GetActiveStatementsAsync(C var workList = DkmWorkList.Create(CompletionRoutine: _ => { - if (!completed) - { - completion.TrySetException(new InvalidOperationException($"Unexpected error enumerating active statements: 0x{unexpectedError:X8}")); - } + completion.TrySetException(new InvalidOperationException($"Unexpected error enumerating active statements: 0x{unexpectedError:X8}")); }); void CancelWork() @@ -59,7 +55,6 @@ void CancelWork() // workList.Cancel(); // make sure we cancel with the token we received from the caller: - completed = true; completion.TrySetCanceled(cancellationToken); } } @@ -145,8 +140,7 @@ void CancelWork() // the last active statement of the last runtime has been processed: if (Interlocked.Decrement(ref pendingRuntimes) == 0) { - completed = true; - completion.SetResult(builders.ToFlattenedImmutableArrayAndFree()); + completion.TrySetResult(builders.ToFlattenedImmutableArrayAndFree()); } } }); From 299c6c5902c71d7a273c506731d72a3c6d2affe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Mon, 12 Mar 2018 10:48:55 -0700 Subject: [PATCH 27/43] Insert packages to CoreXT store that were previously blocked (#25416) --- .../BuildDevDivInsertionFiles.vb | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/src/Setup/DevDivInsertionFiles/BuildDevDivInsertionFiles.vb b/src/Setup/DevDivInsertionFiles/BuildDevDivInsertionFiles.vb index 8e02135c55f5e..a16a9460f0774 100644 --- a/src/Setup/DevDivInsertionFiles/BuildDevDivInsertionFiles.vb +++ b/src/Setup/DevDivInsertionFiles/BuildDevDivInsertionFiles.vb @@ -470,26 +470,6 @@ Public Class BuildDevDivInsertionFiles Me.IsNative = isNative Me.IsFacade = isFacade End Sub - - ' TODO: remove (https://github.com/dotnet/roslyn/issues/13204) - ' Don't update CoreXT incompatible packages. They are inserted manually until CoreXT updates to NuGet 3.5 RTM. - Public ReadOnly Property IsCoreXTCompatible As Boolean - Get - Select Case PackageName - Case "System.Security.Cryptography.Algorithms", - "System.Security.Cryptography.X509Certificates", - "System.Reflection.TypeExtensions", - "System.Net.Security", - "System.Diagnostics.Process", - "System.AppContext", - "System.IO.Compression" - - Return False - Case Else - Return True - End Select - End Get - End Property End Class Private Function BuildDependencyMap(inputDirectory As String) As Dictionary(Of String, DependencyInfo) @@ -617,12 +597,6 @@ Public Class BuildDevDivInsertionFiles Private Sub CopyDependencies(dependencies As IReadOnlyDictionary(Of String, DependencyInfo)) For Each dependency In dependencies.Values - ' TODO: remove (https://github.com/dotnet/roslyn/issues/13204) - ' Don't update CoreXT incompatible packages. They are inserted manually until CoreXT updates to NuGet 3.5 RTM. - If Not dependency.IsCoreXTCompatible Then - Continue For - End If - Dim nupkg = $"{dependency.PackageName}.{dependency.PackageVersion}.nupkg" Dim srcPath = Path.Combine(_nugetPackageRoot, dependency.PackageName, dependency.PackageVersion, nupkg) Dim dstDir = Path.Combine(_outputPackageDirectory, If(dependency.IsNative, "NativeDependencies", "ManagedDependencies")) From 98d186c5abd2a7d993a70e4005d23a3a6464f141 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Mon, 12 Mar 2018 17:55:26 -0700 Subject: [PATCH 28/43] Remove binary that (correctly) doesn't exist anymore I can't explain why we're seeing this now, but this definitely shouldn't exist. This is now NoPIA embedded, and the NuGet package's temporary reference contains a different named file anyways. --- src/Setup/DevDivInsertionFiles/BuildDevDivInsertionFiles.vb | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Setup/DevDivInsertionFiles/BuildDevDivInsertionFiles.vb b/src/Setup/DevDivInsertionFiles/BuildDevDivInsertionFiles.vb index cbdd920f02ec8..4bd63b749a209 100644 --- a/src/Setup/DevDivInsertionFiles/BuildDevDivInsertionFiles.vb +++ b/src/Setup/DevDivInsertionFiles/BuildDevDivInsertionFiles.vb @@ -812,7 +812,6 @@ Public Class BuildDevDivInsertionFiles add("UnitTests\CSharpCompilerEmitTest\net461\Microsoft.DiaSymReader.dll") add("UnitTests\CSharpCompilerEmitTest\net461\Microsoft.DiaSymReader.Native.amd64.dll") add("UnitTests\CSharpCompilerEmitTest\net461\Microsoft.DiaSymReader.Native.x86.dll") - add("UnitTests\EditorServicesTest\Microsoft.VisualStudio.Platform.VSEditor.Interop.dll") add("Vsix\ExpressionEvaluatorPackage\Microsoft.VisualStudio.Debugger.Engine.dll") add("Vsix\VisualStudioIntegrationTestSetup\Microsoft.Diagnostics.Runtime.dll") add("Exes\Toolset\System.AppContext.dll") From d27181911f074572c6c9b3ceaebeb6c9116d3e05 Mon Sep 17 00:00:00 2001 From: Carol Hu Date: Tue, 13 Mar 2018 16:43:01 -0700 Subject: [PATCH 29/43] Upgrade Editor and related nuget packages from 15.6.281-preview to 15.7.153-preview-g7d0635149a --- build/Targets/Packages.props | 22 +++++++++--------- .../CompletionPresenterSession.cs | 9 ++++---- .../Presentation/CustomCommitCompletion.cs | 7 +++--- .../Presentation/RoslynCompletionSet.cs | 23 ++++++++++--------- .../IntelliSense/Completion/Controller.cs | 4 ++-- .../AbstractCompletionProviderTests.cs | 10 ++++---- .../TestUtilities2/Intellisense/TestState.vb | 2 +- 7 files changed, 40 insertions(+), 37 deletions(-) diff --git a/build/Targets/Packages.props b/build/Targets/Packages.props index f49592fd60d78..62f2adb65b668 100644 --- a/build/Targets/Packages.props +++ b/build/Targets/Packages.props @@ -76,25 +76,25 @@ 15.0.26730-alpha 15.0.26730-alpha 15.5.23 - 15.6.281-preview + 15.7.153-preview-g7d0635149a 15.0.27309-vsucorediag 15.0.27309-vsucorediag 15.0.27309-vsucorediag 10.0.30319 1.1.4322 15.0.26730-alpha - 15.6.281-preview + 15.7.153-preview-g7d0635149a 15.0.26730-alpha 15.0.26730-alpha 15.0.26730-alpha 15.0.25726-Preview5 2.0.0-rc3-61304-01 15.3.1710.203 - 15.6.281-preview - 15.6.281-preview - 15.6.281-preview + 15.7.153-preview-g7d0635149a + 15.7.153-preview-g7d0635149a + 15.7.153-preview-g7d0635149a 7.10.6070 - 15.6.281-preview + 15.7.153-preview-g7d0635149a 15.0.26730-alpha 15.0.26730-alpha 15.0.26730-alpha @@ -120,11 +120,11 @@ 9.0.30729 15.0.26730-alpha 8.0.0.0-alpha - 15.6.281-preview - 15.6.281-preview - 15.6.281-preview - 15.6.281-preview - 15.6.281-preview + 15.7.153-preview-g7d0635149a + 15.7.153-preview-g7d0635149a + 15.7.153-preview-g7d0635149a + 15.7.153-preview-g7d0635149a + 15.7.153-preview-g7d0635149a 7.10.6070 10.0.30319 12.0.30110 diff --git a/src/EditorFeatures/Core.Wpf/Completion/Presentation/CompletionPresenterSession.cs b/src/EditorFeatures/Core.Wpf/Completion/Presentation/CompletionPresenterSession.cs index 4ab8bd7b71ad7..0507614a4ea1d 100644 --- a/src/EditorFeatures/Core.Wpf/Completion/Presentation/CompletionPresenterSession.cs +++ b/src/EditorFeatures/Core.Wpf/Completion/Presentation/CompletionPresenterSession.cs @@ -12,6 +12,7 @@ using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; using Roslyn.Utilities; +using CACompletionItem = Microsoft.CodeAnalysis.Completion.CompletionItem; namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.Presentation { @@ -70,9 +71,9 @@ public CompletionPresenterSession( public void PresentItems( ITrackingSpan triggerSpan, - IList completionItems, - CompletionItem selectedItem, - CompletionItem suggestionModeItem, + IList completionItems, + CACompletionItem selectedItem, + CACompletionItem suggestionModeItem, bool suggestionMode, bool isSoftSelected, ImmutableArray completionItemFilters, @@ -140,7 +141,7 @@ private void OnEditorSessionDismissed() this.Dismissed?.Invoke(this, new EventArgs()); } - internal void OnCompletionItemCommitted(CompletionItem completionItem) + internal void OnCompletionItemCommitted(CACompletionItem completionItem) { AssertIsForeground(); this.ItemCommitted?.Invoke(this, new CompletionItemEventArgs(completionItem)); diff --git a/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs b/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs index ddea192c2df19..d0292fe6c7666 100644 --- a/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs +++ b/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs @@ -5,12 +5,11 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Completion; -using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Editor.Wpf; -using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Imaging.Interop; using Microsoft.VisualStudio.Language.Intellisense; using Roslyn.Utilities; +using CACompletionItem = Microsoft.CodeAnalysis.Completion.CompletionItem; namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.Presentation { @@ -18,12 +17,12 @@ internal sealed class CustomCommitCompletion : Completion3, ICustomCommit { private const string s_glyphCompletionWarning = "GlyphCompletionWarning"; private readonly CompletionPresenterSession _completionPresenterSession; - internal readonly CompletionItem CompletionItem; + internal readonly CACompletionItem CompletionItem; private readonly ImageMoniker _imageMoniker; public CustomCommitCompletion( CompletionPresenterSession completionPresenterSession, - CompletionItem completionItem) + CACompletionItem completionItem) { // PERF: Note that the base class contains a constructor taking the displayText string // but we're intentionally NOT using that here because it allocates a private CompletionState diff --git a/src/EditorFeatures/Core.Wpf/Completion/Presentation/RoslynCompletionSet.cs b/src/EditorFeatures/Core.Wpf/Completion/Presentation/RoslynCompletionSet.cs index d5ac895953c6d..ce987861fe98f 100644 --- a/src/EditorFeatures/Core.Wpf/Completion/Presentation/RoslynCompletionSet.cs +++ b/src/EditorFeatures/Core.Wpf/Completion/Presentation/RoslynCompletionSet.cs @@ -10,6 +10,7 @@ using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; using VSCompletion = Microsoft.VisualStudio.Language.Intellisense.Completion; +using CACompletionItem = Microsoft.CodeAnalysis.Completion.CompletionItem; namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.Presentation { @@ -26,8 +27,8 @@ internal class RoslynCompletionSet : CompletionSet2 protected readonly CompletionPresenterSession CompletionPresenterSession; private CompletionHelper _completionHelper; - protected Dictionary CompletionItemMap; - protected CompletionItem SuggestionModeItem; + protected Dictionary CompletionItemMap; + protected CACompletionItem SuggestionModeItem; protected string FilterText; @@ -80,9 +81,9 @@ public override void Recalculate() } public void SetCompletionItems( - IList completionItems, - CompletionItem selectedItem, - CompletionItem suggestionModeItem, + IList completionItems, + CACompletionItem selectedItem, + CACompletionItem suggestionModeItem, bool suggestionMode, bool isSoftSelected, ImmutableArray completionItemFilters, @@ -91,7 +92,7 @@ public void SetCompletionItems( _foregroundThread.AssertIsForeground(); // Initialize the completion map to a reasonable default initial size (+1 for the builder) - CompletionItemMap = CompletionItemMap ?? new Dictionary(completionItems.Count + 1); + CompletionItemMap = CompletionItemMap ?? new Dictionary(completionItems.Count + 1); FilterText = filterText; SuggestionModeItem = suggestionModeItem; @@ -112,8 +113,8 @@ public void SetCompletionItems( } private void CreateCompletionListBuilder( - CompletionItem selectedItem, - CompletionItem suggestionModeItem, + CACompletionItem selectedItem, + CACompletionItem suggestionModeItem, bool suggestionMode) { try @@ -138,7 +139,7 @@ private void CreateCompletionListBuilder( } } - private void CreateNormalCompletionListItems(IList completionItems) + private void CreateNormalCompletionListItems(IList completionItems) { try { @@ -157,7 +158,7 @@ private void CreateNormalCompletionListItems(IList completionIte } } - private VSCompletion GetVSCompletion(CompletionItem item, string displayText = null) + private VSCompletion GetVSCompletion(CACompletionItem item, string displayText = null) { if (!CompletionItemMap.TryGetValue(item, out var value)) { @@ -170,7 +171,7 @@ private VSCompletion GetVSCompletion(CompletionItem item, string displayText = n return value; } - public CompletionItem GetCompletionItem(VSCompletion completion) + public CACompletionItem GetCompletionItem(VSCompletion completion) { // Linear search is ok since this is only called by the user manually selecting // an item. Creating a reverse mapping uses too much memory and affects GCs. diff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs index 925c05e193dea..b191c8fa111d9 100644 --- a/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs +++ b/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs @@ -152,7 +152,7 @@ internal override void OnModelUpdated(Model modelOpt) private bool StartNewModelComputation( CompletionService completionService, - CompletionTrigger trigger) + CodeAnalysis.Completion.CompletionTrigger trigger) { AssertIsForeground(); Contract.ThrowIfTrue(sessionOpt != null); @@ -214,7 +214,7 @@ private OptionSet GetOptions() : workspace.Options; } - private void CommitItem(CompletionItem item) + private void CommitItem(CodeAnalysis.Completion.CompletionItem item) { AssertIsForeground(); diff --git a/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs b/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs index 06bfbe231e0b0..2c91a277d7552 100644 --- a/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs +++ b/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs @@ -20,6 +20,7 @@ using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; +using CompletionTrigger = Microsoft.CodeAnalysis.Completion.CompletionTrigger; namespace Microsoft.CodeAnalysis.Editor.UnitTests.Completion { @@ -74,7 +75,8 @@ internal static CompletionHelper GetCompletionHelper(Document document) internal Task GetCompletionListAsync( CompletionService service, - Document document, int position, CompletionTrigger triggerInfo, OptionSet options = null) + Document document, int position, + CodeAnalysis.Completion.CompletionTrigger triggerInfo, OptionSet options = null) { return service.GetCompletionsAsync(document, position, triggerInfo, options: options); } @@ -96,7 +98,7 @@ protected async Task CheckResultsAsync( var completionService = GetCompletionService(document.Project.Solution.Workspace); var completionList = await GetCompletionListAsync(completionService, document, position, trigger); - var items = completionList == null ? ImmutableArray.Empty : completionList.Items; + var items = completionList == null ? ImmutableArray.Empty : completionList.Items; if (hasSuggestionModeItem != null) { @@ -332,7 +334,7 @@ protected virtual void SetWorkspaceOptions(TestWorkspace workspace) internal async Task VerifyCustomCommitWorkerAsync( CompletionServiceWithProviders service, Document document, - CompletionItem completionItem, + CodeAnalysis.Completion.CompletionItem completionItem, string codeBeforeCommit, string expectedCodeAfterCommit, char? commitChar = null) @@ -366,7 +368,7 @@ internal async Task VerifyCustomCommitWorkerAsync( internal virtual void VerifyCustomCommitWorker( CompletionService service, ICustomCommitCompletionProvider customCommitCompletionProvider, - CompletionItem completionItem, + CodeAnalysis.Completion.CompletionItem completionItem, CompletionHelper completionRules, ITextView textView, ITextBuffer textBuffer, diff --git a/src/EditorFeatures/TestUtilities2/Intellisense/TestState.vb b/src/EditorFeatures/TestUtilities2/Intellisense/TestState.vb index f86151c4472fb..121b98a76a5ca 100644 --- a/src/EditorFeatures/TestUtilities2/Intellisense/TestState.vb +++ b/src/EditorFeatures/TestUtilities2/Intellisense/TestState.vb @@ -196,7 +196,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense CurrentCompletionPresenterSession.SetSelectedItem(item) End Sub - Public Overloads Sub SendSelectCompletionItemThroughPresenterSession(item As CompletionItem) + Public Overloads Sub SendSelectCompletionItemThroughPresenterSession(item As CodeAnalysis.Completion.CompletionItem) CurrentCompletionPresenterSession.SetSelectedItem(item) End Sub From f8782301e54581af824125275110c9597fbe9229 Mon Sep 17 00:00:00 2001 From: Carol Hu Date: Wed, 14 Mar 2018 11:14:44 -0700 Subject: [PATCH 30/43] update document to require VS15.7 preview 1 --- .../Building, Debugging, and Testing on Windows.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/contributing/Building, Debugging, and Testing on Windows.md b/docs/contributing/Building, Debugging, and Testing on Windows.md index f5043a05f430b..f153af8e1fc97 100644 --- a/docs/contributing/Building, Debugging, and Testing on Windows.md +++ b/docs/contributing/Building, Debugging, and Testing on Windows.md @@ -20,9 +20,9 @@ If a stack trace is displayed on .NET Framework older than 4.7.1 (e.g. by xUnit ## Developing with Visual Studio 2017 -1. [Visual Studio 2017 Version 15.6 Preview 4](https://www.visualstudio.com/vs/preview/) +1. [Visual Studio 2017 Version 15.7 Preview 1](https://www.visualstudio.com/vs/preview/) - Ensure C#, VB, MSBuild, .NET Core and Visual Studio Extensibility are included in the selected work loads - - Ensure Visual Studio is on Version "15.6 Preview 4" or greater + - Ensure Visual Studio is on Version "15.7 Preview 1" or greater 1. [.NET Core SDK 2.2](https://www.microsoft.com/net/download/core) (if you don't see the 2.2 SDK binaries there yet, the current previews are: [Windows x64 installer](https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.2.0-preview1-007622/dotnet-sdk-2.2.0-preview1-007622-win-x64.exe), [Windows x86 installer](https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.2.0-preview1-007622/dotnet-sdk-2.2.0-preview1-007622-win-x86.exe)) 1. [PowerShell 3.0 or newer](https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell). If you are on Windows 10, you are fine; you'll only need to upgrade if you're on Windows 7. The download link is under the "upgrading existing Windows PowerShell" heading. 1. Run Restore.cmd From 2753997d6f0d814e131c8557c1d48d63d83830f7 Mon Sep 17 00:00:00 2001 From: Carol Hu Date: Wed, 14 Mar 2018 11:31:05 -0700 Subject: [PATCH 31/43] resolve merge conflict --- .../contributing/Building, Debugging, and Testing on Windows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributing/Building, Debugging, and Testing on Windows.md b/docs/contributing/Building, Debugging, and Testing on Windows.md index e404701e5e592..fc055a16cb36f 100644 --- a/docs/contributing/Building, Debugging, and Testing on Windows.md +++ b/docs/contributing/Building, Debugging, and Testing on Windows.md @@ -22,7 +22,7 @@ If a stack trace is displayed on .NET Framework older than 4.7.1 (e.g. by xUnit 1. [Visual Studio 2017 Version 15.7 Preview 1](https://www.visualstudio.com/vs/preview/) - Ensure C#, VB, MSBuild, .NET Core and Visual Studio Extensibility are included in the selected work loads - - Ensure Visual Studio is on Version "15.6 Preview 4" or greater + - Ensure Visual Studio is on Version "15.7 Preview 1" or greater 1. [.NET Core SDK 2.1.300](https://www.microsoft.com/net/download/core) (if you don't see the 2.2 SDK binaries there yet, the current previews are: [Windows x64 installer](https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.1.300-preview2-008324/dotnet-sdk-2.1.300-preview2-008324-win-x64.exe), [Windows x86 installer](https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.1.300-preview2-008324/dotnet-sdk-2.1.300-preview2-008324-win-x86.exe)) 1. [PowerShell 3.0 or newer](https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell). If you are on Windows 10, you are fine; you'll only need to upgrade if you're on Windows 7. The download link is under the "upgrading existing Windows PowerShell" heading. 1. Run Restore.cmd From e24fb40e88a733066acb336b05da079b924d07c9 Mon Sep 17 00:00:00 2001 From: Carol Hu Date: Wed, 14 Mar 2018 16:18:18 -0700 Subject: [PATCH 32/43] fix PR comments --- .../CompletionPresenterSession.cs | 11 +++++---- .../Presentation/CustomCommitCompletion.cs | 6 ++--- .../Presentation/RoslynCompletionSet.cs | 24 +++++++++---------- .../IntelliSense/Completion/Controller.cs | 4 +++- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/Completion/Presentation/CompletionPresenterSession.cs b/src/EditorFeatures/Core.Wpf/Completion/Presentation/CompletionPresenterSession.cs index 0507614a4ea1d..b9a8e90dc3267 100644 --- a/src/EditorFeatures/Core.Wpf/Completion/Presentation/CompletionPresenterSession.cs +++ b/src/EditorFeatures/Core.Wpf/Completion/Presentation/CompletionPresenterSession.cs @@ -12,10 +12,11 @@ using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; using Roslyn.Utilities; -using CACompletionItem = Microsoft.CodeAnalysis.Completion.CompletionItem; namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.Presentation { + using CompletionItem = Microsoft.CodeAnalysis.Completion.CompletionItem; + internal sealed class CompletionPresenterSession : ForegroundThreadAffinitizedObject, ICompletionPresenterSession { internal static readonly object Key = new object(); @@ -71,9 +72,9 @@ public CompletionPresenterSession( public void PresentItems( ITrackingSpan triggerSpan, - IList completionItems, - CACompletionItem selectedItem, - CACompletionItem suggestionModeItem, + IList completionItems, + CompletionItem selectedItem, + CompletionItem suggestionModeItem, bool suggestionMode, bool isSoftSelected, ImmutableArray completionItemFilters, @@ -141,7 +142,7 @@ private void OnEditorSessionDismissed() this.Dismissed?.Invoke(this, new EventArgs()); } - internal void OnCompletionItemCommitted(CACompletionItem completionItem) + internal void OnCompletionItemCommitted(CompletionItem completionItem) { AssertIsForeground(); this.ItemCommitted?.Invoke(this, new CompletionItemEventArgs(completionItem)); diff --git a/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs b/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs index d0292fe6c7666..f571d8379891e 100644 --- a/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs +++ b/src/EditorFeatures/Core.Wpf/Completion/Presentation/CustomCommitCompletion.cs @@ -9,7 +9,7 @@ using Microsoft.VisualStudio.Imaging.Interop; using Microsoft.VisualStudio.Language.Intellisense; using Roslyn.Utilities; -using CACompletionItem = Microsoft.CodeAnalysis.Completion.CompletionItem; +using CompletionItem = Microsoft.CodeAnalysis.Completion.CompletionItem; namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.Presentation { @@ -17,12 +17,12 @@ internal sealed class CustomCommitCompletion : Completion3, ICustomCommit { private const string s_glyphCompletionWarning = "GlyphCompletionWarning"; private readonly CompletionPresenterSession _completionPresenterSession; - internal readonly CACompletionItem CompletionItem; + internal readonly CompletionItem CompletionItem; private readonly ImageMoniker _imageMoniker; public CustomCommitCompletion( CompletionPresenterSession completionPresenterSession, - CACompletionItem completionItem) + CompletionItem completionItem) { // PERF: Note that the base class contains a constructor taking the displayText string // but we're intentionally NOT using that here because it allocates a private CompletionState diff --git a/src/EditorFeatures/Core.Wpf/Completion/Presentation/RoslynCompletionSet.cs b/src/EditorFeatures/Core.Wpf/Completion/Presentation/RoslynCompletionSet.cs index ce987861fe98f..e1e7b9f61175d 100644 --- a/src/EditorFeatures/Core.Wpf/Completion/Presentation/RoslynCompletionSet.cs +++ b/src/EditorFeatures/Core.Wpf/Completion/Presentation/RoslynCompletionSet.cs @@ -10,7 +10,7 @@ using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; using VSCompletion = Microsoft.VisualStudio.Language.Intellisense.Completion; -using CACompletionItem = Microsoft.CodeAnalysis.Completion.CompletionItem; +using CompletionItem = Microsoft.CodeAnalysis.Completion.CompletionItem; namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.Presentation { @@ -27,8 +27,8 @@ internal class RoslynCompletionSet : CompletionSet2 protected readonly CompletionPresenterSession CompletionPresenterSession; private CompletionHelper _completionHelper; - protected Dictionary CompletionItemMap; - protected CACompletionItem SuggestionModeItem; + protected Dictionary CompletionItemMap; + protected CompletionItem SuggestionModeItem; protected string FilterText; @@ -81,9 +81,9 @@ public override void Recalculate() } public void SetCompletionItems( - IList completionItems, - CACompletionItem selectedItem, - CACompletionItem suggestionModeItem, + IList completionItems, + CompletionItem selectedItem, + CompletionItem suggestionModeItem, bool suggestionMode, bool isSoftSelected, ImmutableArray completionItemFilters, @@ -92,7 +92,7 @@ public void SetCompletionItems( _foregroundThread.AssertIsForeground(); // Initialize the completion map to a reasonable default initial size (+1 for the builder) - CompletionItemMap = CompletionItemMap ?? new Dictionary(completionItems.Count + 1); + CompletionItemMap = CompletionItemMap ?? new Dictionary(completionItems.Count + 1); FilterText = filterText; SuggestionModeItem = suggestionModeItem; @@ -113,8 +113,8 @@ public void SetCompletionItems( } private void CreateCompletionListBuilder( - CACompletionItem selectedItem, - CACompletionItem suggestionModeItem, + CompletionItem selectedItem, + CompletionItem suggestionModeItem, bool suggestionMode) { try @@ -139,7 +139,7 @@ private void CreateCompletionListBuilder( } } - private void CreateNormalCompletionListItems(IList completionItems) + private void CreateNormalCompletionListItems(IList completionItems) { try { @@ -158,7 +158,7 @@ private void CreateNormalCompletionListItems(IList completionI } } - private VSCompletion GetVSCompletion(CACompletionItem item, string displayText = null) + private VSCompletion GetVSCompletion(CompletionItem item, string displayText = null) { if (!CompletionItemMap.TryGetValue(item, out var value)) { @@ -171,7 +171,7 @@ private VSCompletion GetVSCompletion(CACompletionItem item, string displayText = return value; } - public CACompletionItem GetCompletionItem(VSCompletion completion) + public CompletionItem GetCompletionItem(VSCompletion completion) { // Linear search is ok since this is only called by the user manually selecting // an item. Creating a reverse mapping uses too much memory and affects GCs. diff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs index b191c8fa111d9..3e5f01f04ccf4 100644 --- a/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs +++ b/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs @@ -16,6 +16,8 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion { + using CompletionTrigger = Microsoft.CodeAnalysis.Completion.CompletionTrigger; + internal partial class Controller : AbstractController, IChainedCommandHandler, @@ -152,7 +154,7 @@ internal override void OnModelUpdated(Model modelOpt) private bool StartNewModelComputation( CompletionService completionService, - CodeAnalysis.Completion.CompletionTrigger trigger) + CompletionTrigger trigger) { AssertIsForeground(); Contract.ThrowIfTrue(sessionOpt != null); From b4eaa35a5cb08929d5fd9660f5632bb5cd7fa3d0 Mon Sep 17 00:00:00 2001 From: Carol Hu Date: Wed, 14 Mar 2018 16:26:39 -0700 Subject: [PATCH 33/43] fix PR comments --- .../Implementation/IntelliSense/Completion/Controller.cs | 3 ++- .../Completion/AbstractCompletionProviderTests.cs | 7 ++++--- .../TestUtilities2/Intellisense/TestState.vb | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs index 3e5f01f04ccf4..17bff462646d7 100644 --- a/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs +++ b/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs @@ -17,6 +17,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion { using CompletionTrigger = Microsoft.CodeAnalysis.Completion.CompletionTrigger; + using CompletionItem = Microsoft.CodeAnalysis.Completion.CompletionItem; internal partial class Controller : AbstractController, @@ -216,7 +217,7 @@ private OptionSet GetOptions() : workspace.Options; } - private void CommitItem(CodeAnalysis.Completion.CompletionItem item) + private void CommitItem(CompletionItem item) { AssertIsForeground(); diff --git a/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs b/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs index 2c91a277d7552..6a46e905cd1fe 100644 --- a/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs +++ b/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs @@ -21,6 +21,7 @@ using Roslyn.Utilities; using Xunit; using CompletionTrigger = Microsoft.CodeAnalysis.Completion.CompletionTrigger; +using CompletionItem = Microsoft.CodeAnalysis.Completion.CompletionItem; namespace Microsoft.CodeAnalysis.Editor.UnitTests.Completion { @@ -98,7 +99,7 @@ protected async Task CheckResultsAsync( var completionService = GetCompletionService(document.Project.Solution.Workspace); var completionList = await GetCompletionListAsync(completionService, document, position, trigger); - var items = completionList == null ? ImmutableArray.Empty : completionList.Items; + var items = completionList == null ? ImmutableArray.Empty : completionList.Items; if (hasSuggestionModeItem != null) { @@ -334,7 +335,7 @@ protected virtual void SetWorkspaceOptions(TestWorkspace workspace) internal async Task VerifyCustomCommitWorkerAsync( CompletionServiceWithProviders service, Document document, - CodeAnalysis.Completion.CompletionItem completionItem, + CompletionItem completionItem, string codeBeforeCommit, string expectedCodeAfterCommit, char? commitChar = null) @@ -368,7 +369,7 @@ internal async Task VerifyCustomCommitWorkerAsync( internal virtual void VerifyCustomCommitWorker( CompletionService service, ICustomCommitCompletionProvider customCommitCompletionProvider, - CodeAnalysis.Completion.CompletionItem completionItem, + CompletionItem completionItem, CompletionHelper completionRules, ITextView textView, ITextBuffer textBuffer, diff --git a/src/EditorFeatures/TestUtilities2/Intellisense/TestState.vb b/src/EditorFeatures/TestUtilities2/Intellisense/TestState.vb index 121b98a76a5ca..8f70598024631 100644 --- a/src/EditorFeatures/TestUtilities2/Intellisense/TestState.vb +++ b/src/EditorFeatures/TestUtilities2/Intellisense/TestState.vb @@ -12,7 +12,6 @@ Imports Microsoft.CodeAnalysis.Host.Mef Imports Microsoft.CodeAnalysis.Shared.TestHooks Imports Microsoft.CodeAnalysis.SignatureHelp Imports Microsoft.VisualStudio.Commanding -Imports Microsoft.VisualStudio.Composition Imports Microsoft.VisualStudio.Language.Intellisense Imports Microsoft.VisualStudio.Text Imports Microsoft.VisualStudio.Text.BraceCompletion @@ -20,6 +19,7 @@ Imports Microsoft.VisualStudio.Text.Editor Imports Microsoft.VisualStudio.Text.Editor.Commanding.Commands Imports Microsoft.VisualStudio.Text.Operations Imports Roslyn.Utilities +Imports CompletionItem = Microsoft.CodeAnalysis.Completion.CompletionItem Imports VSCommanding = Microsoft.VisualStudio.Commanding Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense @@ -196,7 +196,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense CurrentCompletionPresenterSession.SetSelectedItem(item) End Sub - Public Overloads Sub SendSelectCompletionItemThroughPresenterSession(item As CodeAnalysis.Completion.CompletionItem) + Public Overloads Sub SendSelectCompletionItemThroughPresenterSession(item As CompletionItem) CurrentCompletionPresenterSession.SetSelectedItem(item) End Sub From a28ffe550e2c3c934dbb38097364e0a8cbc84f36 Mon Sep 17 00:00:00 2001 From: Carol Hu Date: Wed, 14 Mar 2018 16:28:38 -0700 Subject: [PATCH 34/43] fix PR comments --- .../Completion/AbstractCompletionProviderTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs b/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs index 6a46e905cd1fe..011191d2758ed 100644 --- a/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs +++ b/src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs @@ -76,8 +76,7 @@ internal static CompletionHelper GetCompletionHelper(Document document) internal Task GetCompletionListAsync( CompletionService service, - Document document, int position, - CodeAnalysis.Completion.CompletionTrigger triggerInfo, OptionSet options = null) + Document document, int position, CompletionTrigger triggerInfo, OptionSet options = null) { return service.GetCompletionsAsync(document, position, triggerInfo, options: options); } From 2be3c427e331be7f8987a58a419f783cb0827fe4 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Mon, 19 Mar 2018 10:55:36 -0700 Subject: [PATCH 35/43] Move all build diagnostic info into Logs dir This moves all of our build diagnistic output into the same folder: Binaries\Configuration\Logs. Having it in a single folder is necessary for us to upload the information using the VSTS Build Artifact task. Jenkins should be unaffected. It supports and uses wildcards for the file types we need to be uploaded on failed builds. --- build/scripts/build.ps1 | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/build/scripts/build.ps1 b/build/scripts/build.ps1 index 3c10f39e1dce9..8cfc9f5399bb1 100644 --- a/build/scripts/build.ps1 +++ b/build/scripts/build.ps1 @@ -146,9 +146,7 @@ function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string] $logFileName = [IO.Path]::GetFileNameWithoutExtension($projectFilePath) } $logFileName = [IO.Path]::ChangeExtension($logFileName, ".binlog") - $logDir = Join-Path $binariesDir "Logs" - Create-Directory $logDir - $logFilePath = Join-Path $logDir $logFileName + $logFilePath = Join-Path $logsDir $logFileName $args += " /bl:$logFilePath" } @@ -191,11 +189,9 @@ function Make-BootstrapBuild() { Create-Directory $dir if ($buildCoreClr) { $bootstrapFramework = "netcoreapp2.0" - $logDir = Join-Path $binariesDir "Logs" - Create-Directory $logDir - Exec-Console "dotnet" "publish --no-restore src/Compilers/CSharp/csc -o `"$dir/bincore`" --framework $bootstrapFramework $bootstrapArgs -bl:$logDir/BootstrapCsc.binlog" - Exec-Console "dotnet" "publish --no-restore src/Compilers/VisualBasic/vbc -o `"$dir/bincore`" --framework $bootstrapFramework $bootstrapArgs -bl:$logDir/BootstrapVbc.binlog" - Exec-Console "dotnet" "publish --no-restore src/Compilers/Server/VBCSCompiler -o `"$dir/bincore`" --framework $bootstrapFramework $bootstrapArgs -bl:$logDir/BootstrapVBCSCompiler.binlog" + Exec-Console "dotnet" "publish --no-restore src/Compilers/CSharp/csc -o `"$dir/bincore`" --framework $bootstrapFramework $bootstrapArgs -bl:$logsDir/BootstrapCsc.binlog" + Exec-Console "dotnet" "publish --no-restore src/Compilers/VisualBasic/vbc -o `"$dir/bincore`" --framework $bootstrapFramework $bootstrapArgs -bl:$logsDir/BootstrapVbc.binlog" + Exec-Console "dotnet" "publish --no-restore src/Compilers/Server/VBCSCompiler -o `"$dir/bincore`" --framework $bootstrapFramework $bootstrapArgs -bl:$logsDir/BootstrapVBCSCompiler.binlog" Exec-Console "dotnet" "publish --no-restore src/Compilers/Core/MSBuildTask -o `"$dir`" --framework $bootstrapFramework $bootstrapArgs -bl:$binariesDir/BootstrapMSBuildTask.binlog" Stop-BuildProcesses } @@ -397,8 +393,8 @@ function Test-XUnitCoreClr() { $unitDir = Join-Path $configDir "UnitTests" $tf = "netcoreapp2.0" - $logDir = Join-Path $unitDir "xUnitResults" - Create-Directory $logDir + $xunitResultDir = Join-Path $unitDir "xUnitResults" + Create-Directory $xunitResultDir $xunitConsole = Join-Path (Get-PackageDir "xunit.runner.console") "tools\$tf\xunit.console.dll" $dlls = @() @@ -414,7 +410,7 @@ function Test-XUnitCoreClr() { $args += " --runtimeconfig " + [IO.Path]::ChangeExtension($dllPath, ".runtimeconfig.json") $args += " $xunitConsole" $args += " $dllPath" - $args += " -xml " + (Join-Path $logDir ([IO.Path]::ChangeExtension($dllName, ".xml"))) + $args += " -xml " + (Join-Path $xunitResultDir ([IO.Path]::ChangeExtension($dllName, ".xml"))) # https://github.com/dotnet/roslyn/issues/25049 # Disable parallel runs everywhere until we get assembly specific settings working again @@ -448,7 +444,7 @@ function Test-XUnit() { Deploy-VsixViaTool } - $logFilePath = Join-Path $configDir "runtests.log" + $logFilePath = Join-Path $logsDir "runtests.log" $unitDir = Join-Path $configDir "UnitTests" $runTests = Join-Path $configDir "Exes\RunTests\RunTests.exe" $xunitDir = Join-Path (Get-PackageDir "xunit.runner.console") "tools\net452" @@ -649,11 +645,13 @@ try { $dotnet = Ensure-DotnetSdk $buildConfiguration = if ($release) { "Release" } else { "Debug" } $configDir = Join-Path $binariesDir $buildConfiguration + $logsDir = Join-Path $configDir "Logs" $bootstrapDir = "" # Ensure the main output directories exist as a number of tools will fail when they don't exist. Create-Directory $binariesDir Create-Directory $configDir + Create-Directory $logsDir if ($cibuild) { List-VSProcesses From d087f6f354d8329dcbd769f0155f874f3d5a506c Mon Sep 17 00:00:00 2001 From: JieCarolHu Date: Wed, 4 Apr 2018 17:35:30 -0700 Subject: [PATCH 36/43] fix the KnownImageIds.LocalVariable which was missed in the previous PR --- .../Core/Shared/Extensions/GlyphExtensions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs b/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs index 7f9eecaa1bb17..7e00ee897a7c2 100644 --- a/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs +++ b/src/EditorFeatures/Core/Shared/Extensions/GlyphExtensions.cs @@ -124,7 +124,7 @@ public static ImageId GetImageId(this Glyph glyph) case Glyph.Parameter: case Glyph.Local: - return new ImageId(KnownMonikers.LocalVariable.Guid, KnownMonikers.LocalVariable.Id); + return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.LocalVariable); case Glyph.Namespace: return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.Namespace); @@ -168,7 +168,7 @@ public static ImageId GetImageId(this Glyph glyph) case Glyph.Reference: return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.Reference); - //// this is not a copy-paste mistake, we were using these before in the previous GetImageMoniker() + //// this is not a copy-paste mistake, we were using these before in the previous GetImageMoniker() //case Glyph.StructurePublic: // return KnownMonikers.ValueTypePublic; //case Glyph.StructureProtected: @@ -177,7 +177,7 @@ public static ImageId GetImageId(this Glyph glyph) // return KnownMonikers.ValueTypePrivate; //case Glyph.StructureInternal: // return KnownMonikers.ValueTypeInternal; - + case Glyph.StructurePublic: return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.ValueTypePublic); case Glyph.StructureProtected: @@ -199,7 +199,7 @@ public static ImageId GetImageId(this Glyph glyph) case Glyph.StatusInformation: return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.StatusInformation); - case Glyph.NuGet: + case Glyph.NuGet: return new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.NuGet); default: From 79c7f8f99b6b5a9f9d3fc3fcc80f77382d05cbff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbyn=C4=9Bk=20Sailer?= Date: Mon, 9 Apr 2018 15:52:56 +0200 Subject: [PATCH 37/43] LOC CHECKIN | dotnet/roslyn dev15.7.x-vs-deps | 20180409 --- .../Portable/xlf/CSharpResources.cs.xlf | 78 +++++++-------- .../Portable/xlf/CSharpResources.de.xlf | 78 +++++++-------- .../Portable/xlf/CSharpResources.es.xlf | 78 +++++++-------- .../Portable/xlf/CSharpResources.fr.xlf | 78 +++++++-------- .../Portable/xlf/CSharpResources.it.xlf | 98 +++++++++---------- .../Portable/xlf/CSharpResources.ja.xlf | 80 +++++++-------- .../Portable/xlf/CSharpResources.ko.xlf | 78 +++++++-------- .../Portable/xlf/CSharpResources.pl.xlf | 78 +++++++-------- .../Portable/xlf/CSharpResources.pt-BR.xlf | 78 +++++++-------- .../Portable/xlf/CSharpResources.ru.xlf | 78 +++++++-------- .../Portable/xlf/CSharpResources.tr.xlf | 78 +++++++-------- .../Portable/xlf/CSharpResources.zh-Hans.xlf | 78 +++++++-------- .../Portable/xlf/CSharpResources.zh-Hant.xlf | 78 +++++++-------- .../Core/MSBuildTask/xlf/ErrorString.cs.xlf | 8 +- .../Core/MSBuildTask/xlf/ErrorString.de.xlf | 8 +- .../Core/MSBuildTask/xlf/ErrorString.es.xlf | 8 +- .../Core/MSBuildTask/xlf/ErrorString.fr.xlf | 8 +- .../Core/MSBuildTask/xlf/ErrorString.it.xlf | 8 +- .../Core/MSBuildTask/xlf/ErrorString.ja.xlf | 8 +- .../Core/MSBuildTask/xlf/ErrorString.ko.xlf | 8 +- .../Core/MSBuildTask/xlf/ErrorString.pl.xlf | 8 +- .../MSBuildTask/xlf/ErrorString.pt-BR.xlf | 8 +- .../Core/MSBuildTask/xlf/ErrorString.ru.xlf | 8 +- .../Core/MSBuildTask/xlf/ErrorString.tr.xlf | 8 +- .../MSBuildTask/xlf/ErrorString.zh-Hans.xlf | 8 +- .../MSBuildTask/xlf/ErrorString.zh-Hant.xlf | 8 +- .../Portable/xlf/VBResources.cs.xlf | 8 +- .../Portable/xlf/VBResources.de.xlf | 8 +- .../Portable/xlf/VBResources.es.xlf | 8 +- .../Portable/xlf/VBResources.fr.xlf | 8 +- .../Portable/xlf/VBResources.it.xlf | 8 +- .../Portable/xlf/VBResources.ja.xlf | 8 +- .../Portable/xlf/VBResources.ko.xlf | 8 +- .../Portable/xlf/VBResources.pl.xlf | 8 +- .../Portable/xlf/VBResources.pt-BR.xlf | 8 +- .../Portable/xlf/VBResources.ru.xlf | 8 +- .../Portable/xlf/VBResources.tr.xlf | 8 +- .../Portable/xlf/VBResources.zh-Hans.xlf | 8 +- .../Portable/xlf/VBResources.zh-Hant.xlf | 8 +- .../xlf/CSharpFeaturesResources.cs.xlf | 8 +- .../xlf/CSharpFeaturesResources.de.xlf | 8 +- .../xlf/CSharpFeaturesResources.es.xlf | 8 +- .../xlf/CSharpFeaturesResources.fr.xlf | 8 +- .../xlf/CSharpFeaturesResources.it.xlf | 8 +- .../xlf/CSharpFeaturesResources.ja.xlf | 8 +- .../xlf/CSharpFeaturesResources.ko.xlf | 8 +- .../xlf/CSharpFeaturesResources.pl.xlf | 8 +- .../xlf/CSharpFeaturesResources.pt-BR.xlf | 8 +- .../xlf/CSharpFeaturesResources.ru.xlf | 8 +- .../xlf/CSharpFeaturesResources.tr.xlf | 8 +- .../xlf/CSharpFeaturesResources.zh-Hans.xlf | 8 +- .../xlf/CSharpFeaturesResources.zh-Hant.xlf | 8 +- .../Portable/xlf/FeaturesResources.cs.xlf | 12 +-- .../Portable/xlf/FeaturesResources.de.xlf | 12 +-- .../Portable/xlf/FeaturesResources.es.xlf | 12 +-- .../Portable/xlf/FeaturesResources.fr.xlf | 12 +-- .../Portable/xlf/FeaturesResources.it.xlf | 12 +-- .../Portable/xlf/FeaturesResources.ja.xlf | 12 +-- .../Portable/xlf/FeaturesResources.ko.xlf | 12 +-- .../Portable/xlf/FeaturesResources.pl.xlf | 12 +-- .../Portable/xlf/FeaturesResources.pt-BR.xlf | 12 +-- .../Portable/xlf/FeaturesResources.ru.xlf | 12 +-- .../Portable/xlf/FeaturesResources.tr.xlf | 12 +-- .../xlf/FeaturesResources.zh-Hans.xlf | 12 +-- .../xlf/FeaturesResources.zh-Hant.xlf | 12 +-- .../Portable/xlf/VBFeaturesResources.cs.xlf | 6 +- .../Portable/xlf/VBFeaturesResources.de.xlf | 6 +- .../Portable/xlf/VBFeaturesResources.es.xlf | 6 +- .../Portable/xlf/VBFeaturesResources.fr.xlf | 6 +- .../Portable/xlf/VBFeaturesResources.it.xlf | 6 +- .../Portable/xlf/VBFeaturesResources.ja.xlf | 6 +- .../Portable/xlf/VBFeaturesResources.ko.xlf | 6 +- .../Portable/xlf/VBFeaturesResources.pl.xlf | 6 +- .../xlf/VBFeaturesResources.pt-BR.xlf | 6 +- .../Portable/xlf/VBFeaturesResources.ru.xlf | 6 +- .../Portable/xlf/VBFeaturesResources.tr.xlf | 6 +- .../xlf/VBFeaturesResources.zh-Hans.xlf | 6 +- .../xlf/VBFeaturesResources.zh-Hant.xlf | 6 +- .../Core/Def/xlf/ServicesVSResources.cs.xlf | 14 +-- .../Core/Def/xlf/ServicesVSResources.de.xlf | 14 +-- .../Core/Def/xlf/ServicesVSResources.es.xlf | 14 +-- .../Core/Def/xlf/ServicesVSResources.fr.xlf | 14 +-- .../Core/Def/xlf/ServicesVSResources.it.xlf | 14 +-- .../Core/Def/xlf/ServicesVSResources.ja.xlf | 14 +-- .../Core/Def/xlf/ServicesVSResources.ko.xlf | 14 +-- .../Core/Def/xlf/ServicesVSResources.pl.xlf | 14 +-- .../Def/xlf/ServicesVSResources.pt-BR.xlf | 14 +-- .../Core/Def/xlf/ServicesVSResources.ru.xlf | 14 +-- .../Core/Def/xlf/ServicesVSResources.tr.xlf | 14 +-- .../Def/xlf/ServicesVSResources.zh-Hans.xlf | 14 +-- .../Def/xlf/ServicesVSResources.zh-Hant.xlf | 14 +-- .../Portable/xlf/WorkspacesResources.cs.xlf | 2 +- .../Portable/xlf/WorkspacesResources.de.xlf | 2 +- .../Portable/xlf/WorkspacesResources.es.xlf | 2 +- .../Portable/xlf/WorkspacesResources.fr.xlf | 2 +- .../Portable/xlf/WorkspacesResources.it.xlf | 2 +- .../Portable/xlf/WorkspacesResources.ja.xlf | 2 +- .../Portable/xlf/WorkspacesResources.ko.xlf | 2 +- .../Portable/xlf/WorkspacesResources.pl.xlf | 2 +- .../xlf/WorkspacesResources.pt-BR.xlf | 2 +- .../Portable/xlf/WorkspacesResources.ru.xlf | 2 +- .../Portable/xlf/WorkspacesResources.tr.xlf | 2 +- .../xlf/WorkspacesResources.zh-Hans.xlf | 2 +- .../xlf/WorkspacesResources.zh-Hant.xlf | 2 +- 104 files changed, 895 insertions(+), 895 deletions(-) diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf index f3bdf32b7d3e0..faab716986998 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf @@ -2698,7 +2698,7 @@ Pokud se taková třída používá jako základní třída a pokud odvozující '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute - '{0}: Typy polí instance označené deklarací StructLayout(LayoutKind.Explicit) musí mít atribut FieldOffset. + {0}: Typy polí instance označené deklarací StructLayout(LayoutKind.Explicit) musí mít atribut FieldOffset. @@ -4142,7 +4142,7 @@ Blok catch() po bloku catch (System.Exception e) může zachytit výjimky, kter foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - Příkaz foreach nejde použít pro proměnné typu {0}, protože {0} neobsahuje veřejnou definici pro {1}. + Příkaz foreach nejde použít pro proměnné typu {0}, protože {0} neobsahuje veřejnou definici instance pro {1}. @@ -4387,7 +4387,7 @@ Blok catch() po bloku catch (System.Exception e) může zachytit výjimky, kter Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function - Parametr ref nebo out {0} uvnitř anonymní metody, lambda výrazu nebo výrazu dotazu + Parametr ref, out nebo in {0} nejde použít uvnitř anonymní metody, výrazu lambda, výrazu dotazu nebo lokální funkce. @@ -4657,7 +4657,7 @@ Blok catch() po bloku catch (System.Exception e) může zachytit výjimky, kter Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 - Neplatná možnost {0} pro /platform. Musí být anycpu, x86, Itanium nebo x64. + Neplatná možnost {0} pro /platform. Musí být anycpu, x86, Itanium, arm, arm64 nebo x64. @@ -7346,7 +7346,7 @@ Pokud chcete odstranit toto varování, můžete místo toho použít /reference a part of /modulename:<string> Specify the name of the source module - + Parametry kompilátoru Visual C# – VÝSTUPNÍ SOUBORY – @@ -7366,7 +7366,7 @@ Pokud chcete odstranit toto varování, můžete místo toho použít /reference /doc:<soubor> Soubor dokumentace XML, který se má generovat. /refout:<file> Výstup referenčního sestavení, který se bude generovat /platform:<řetězec> Omezuje platformy, na kterých se dá tento kód spustit: x86, - Itanium, x64, arm, anycpu32bitpreferred nebo + Itanium, x64, arm, arm64, anycpu32bitpreferred nebo anycpu. Výchozí je anycpu. – VSTUPNÍ SOUBORY– @@ -8567,167 +8567,167 @@ Pokud chcete odstranit toto varování, můžete místo toho použít /reference Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. - Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. + Argumenty s modifikátorem in se nedají použít v dynamicky odbavených výrazech. Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property - Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property + Nepoužívejte u vlastnosti atribut System.Runtime.CompilerServices.FixedBuffer. Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. - Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. + Funkce {0} není dostupná v jazyce C# 7.3. Použijte prosím jazyk verze {1} nebo vyšší. Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. - Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. + Atributy cílící na pole se u automatických vlastností v jazyku verze {0} nepodporují. Použijte prosím jazyk verze {1} nebo vyšší. Field-targeted attributes on auto-properties are not supported in this version of the language. - Field-targeted attributes on auto-properties are not supported in this version of the language. + Atributy cílící na pole se u automatických vlastností v této verzi jazyka nepodporují. ref conditional expression - ref conditional expression + referenční podmínka '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter - '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter + {0} nemůže implementovat člen rozhraní {1} v typu {2}, protože má parametr __arglist. tuple equality - tuple equality + rovnost řazené kolekce členů Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. - Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. + Typy řazené kolekce členů, které se používají jako operandy operátoru == nebo !=, musí mít odpovídající kardinality. U tohoto operátoru je ale kardinalita typů řazené kolekce členů vlevo {0} a vpravo {1}. Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Neplatný název algoritmu hash: {0} An expression tree may not contain a tuple == or != operator - An expression tree may not contain a tuple == or != operator + Strom výrazů nesmí obsahovat operátor řazené kolekce členů == nebo !=. The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Název elementu řazené kolekce členů {0} se ignoruje, protože na druhé straně operátoru == nebo != řazené kolekce členů je určený jiný nebo žádný název. The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Název elementu řazené kolekce členů se ignoruje, protože na druhé straně operátoru == nebo != řazené kolekce členů je určený jiný nebo žádný název. '{0}': cannot specify both a constraint class and the 'unmanaged' constraint - '{0}': cannot specify both a constraint class and the 'unmanaged' constraint + {0}: Nejde zadat třídu omezení a zároveň omezení unmanaged. ref reassignment - ref reassignment + Opětovné přiřazení odkazu ref for-loop variables - ref for-loop variables + Proměnné smyčky for odkazu ref foreach iteration variables - ref foreach iteration variables + Iterační proměnné foreach odkazu The left-hand side of a ref assignment must be a ref local or parameter. - The left-hand side of a ref assignment must be a ref local or parameter. + Levá strana přiřazení odkazu musí být lokální proměnná nebo parametr odkazu. Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. - Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. + Přiřazení odkazu {1} k {0} nelze provést, protože {1} má užší řídicí obor než {0}. enum generic type constraints - enum generic type constraints + výčet obecných omezení typu delegate generic type constraints - delegate generic type constraints + delegovat obecná omezení typu unmanaged generic type constraints - unmanaged generic type constraints + nespravovaná obecná omezení typu The 'new()' constraint cannot be used with the 'unmanaged' constraint - The 'new()' constraint cannot be used with the 'unmanaged' constraint + Omezení new() nejde používat s omezením unmanaged. The 'unmanaged' constraint must come before any other constraints - The 'unmanaged' constraint must come before any other constraints + Omezení unmanaged musí být zadané před všemi ostatními omezeními. The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' + Typ {2} nesmí být typ odkazu a ani v žádné úrovni vnoření nesmí obsahovat pole typu odkazu, aby se dal použít jako parametr {1} v obecném typu nebo metodě {0}. Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' - Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' + Parametr typu {1} má omezení unmanaged, takže není možné používat {1} jako omezení pro {0}. stackalloc initializer - stackalloc initializer + inicializátor výrazu stackalloc "Invalid rank specifier: expected ']' - "Invalid rank specifier: expected ']' + Specifikátor rozsahu je neplatný. Očekávala se pravá hranatá závorka ]. declaration of expression variables in member initializers and queries - declaration of expression variables in member initializers and queries + deklarace proměnných výrazu v inicializátorech členů a dotazech The given expression cannot be used in a fixed statement - The given expression cannot be used in a fixed statement + Daný výraz nelze použít v příkazu fixed. extensible fixed statement - extensible fixed statement + rozšiřitelný příkaz fixed indexing movable fixed buffers - indexing movable fixed buffers + indexování mobilních vyrovnávacích pamětí pevné velikosti Invalid object creation - Invalid object creation + Vytvoření neplatného objektu diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf index 7e4e69495a19e..db21aee2ce182 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf @@ -2698,7 +2698,7 @@ Wenn solch eine Klasse als Basisklasse verwendet wird und die ableitende Klasse '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute - '"{0}": Instanzenfeldtypen, die mit StructLayout(LayoutKind.Explicit) markiert sind, müssen ein FieldOffset-Attribut aufweisen. + {0}: Das Instanzenfeld in Typen, die mit "StructLayout(LayoutKind.Explicit)" markiert sind, muss ein FieldOffset-Attribut aufweisen. @@ -4142,7 +4142,7 @@ Ein catch()-Block nach einem catch (System.Exception e)-Block kann nicht-CLS-Aus foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - Eine foreach-Anweisung kann nicht für Variablen vom Typ "{0}" verwendet werden, da "{0}" keine öffentliche Definition für "{1}" enthält. + Eine foreach-Anweisung kann nicht für Variablen vom Typ "{0}" verwendet werden, da "{0}" keine öffentliche Instanzendefinition für "{1}" enthält. @@ -4387,7 +4387,7 @@ Ein catch()-Block nach einem catch (System.Exception e)-Block kann nicht-CLS-Aus Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function - Der ref- oder out-Parameter "{0}" kann nicht in einer anonymen Methode, einem Lambdaausdruck oder einem Abfrageausdruck verwendet werden. + Der ref-, out-, oder in-Parameter "{0}" kann nicht in einer anonymen Methode, einem Lambdaausdruck, einem Abfrageausdruck oder einer lokalen Funktion verwendet werden. @@ -4657,7 +4657,7 @@ Ein catch()-Block nach einem catch (System.Exception e)-Block kann nicht-CLS-Aus Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 - Ungültige Option "{0}" für /platform. Gültige Werte sind "anycpu", "x86", "Itanium" oder "x64". + Ungültige Option "{0}" für /platform. Gültige Werte sind "anycpu", "x86", "Itanium", "arm", "arm64" oder "x64". @@ -7346,7 +7346,7 @@ Um die Warnung zu beheben, können Sie stattdessen /reference verwenden (Einbett a part of /modulename:<string> Specify the name of the source module - + Visual C#-Compileroptionen - AUSGABEDATEIEN - @@ -7366,7 +7366,7 @@ Um die Warnung zu beheben, können Sie stattdessen /reference verwenden (Einbett /doc:< Datei > Die zu generierende XML-Dokumentationsdatei /refout:<Datei> Die zu generierende Referenzverweisausgabe /platform:< Zeichenfolge > Schränkt ein, auf welchen Plattformen dieser Code ausgeführt werden kann: x86, - Itanium, x64, arm, anycpu32bitpreferred oder + Itanium, x64, arm, arm64, anycpu32bitpreferred oder anycpu. Die Standardeinstellung ist "anycpu". - EINGABEDATEIEN - @@ -8567,167 +8567,167 @@ Um die Warnung zu beheben, können Sie stattdessen /reference verwenden (Einbett Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. - Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. + Argumente mit dem Modifizierer "in" können in dynamisch verteilten Ausdrücken nicht verwendet werden. Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property - Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property + Verwenden Sie das Attribut "System.Runtime.CompilerServices.FixedBuffer" nicht für eine Eigenschaft. Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. - Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. + Das Feature "{0}" ist in C# 7.3 nicht verfügbar. Verwenden Sie Sprachversion {1} oder höher. Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. - Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. + Auf Felder ausgerichtete Attribute für automatische Eigenschaften werden in Sprachversion {0} nicht unterstützt. Verwenden Sie Sprachversion {1} oder höher. Field-targeted attributes on auto-properties are not supported in this version of the language. - Field-targeted attributes on auto-properties are not supported in this version of the language. + Auf Felder ausgerichtete Attribute für automatische Eigenschaften werden in dieser Sprachversion nicht unterstützt. ref conditional expression - ref conditional expression + Bedingter ref-Ausdruck '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter - '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter + "{0}" kann das Schnittstellenelement "{1}" in Typ "{2}" nicht implementieren, weil es einen __arglist-Parameter umfasst. tuple equality - tuple equality + Tupelgleichheit Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. - Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. + Tupeltypen, die als Operanden eines ==- oder !=-Operators verwendet werden, müssen übereinstimmende Kardinalitäten aufweisen. Dieser Operator enthält jedoch Tupeltypen der Kardinalität "{0}" auf der linken und "{1}" auf der rechten Seite. Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Ungültiger Name für Hashalgorithmus: "{0}" An expression tree may not contain a tuple == or != operator - An expression tree may not contain a tuple == or != operator + Eine Ausdrucksbaumstruktur darf keinen ==- oder !=-Tupeloperator enthalten. The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Der Tupelelementname "{0}" wird ignoriert, weil ein anderer oder gar kein Name auf der anderen Seite des ==- oder !=-Tupeloperators angegeben wurde. The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Der Tupelelementname wird ignoriert, weil ein anderer oder gar kein Name auf der anderen Seite des ==- oder !=-Tupeloperators angegeben wurde. '{0}': cannot specify both a constraint class and the 'unmanaged' constraint - '{0}': cannot specify both a constraint class and the 'unmanaged' constraint + "{0}": Eine Einschränkungsklasse kann nicht gleichzeitig mit einer unmanaged-Einschränkung angegeben werden. ref reassignment - ref reassignment + ref-Neuzuweisung ref for-loop variables - ref for-loop variables + Verweis auf for-loop-Variablen ref foreach iteration variables - ref foreach iteration variables + Verweis auf foreach-Iterationsvariablen The left-hand side of a ref assignment must be a ref local or parameter. - The left-hand side of a ref assignment must be a ref local or parameter. + Die linke Seite einer ref-Zuweisung muss ein lokaler Verweis oder ein Parameter sein. Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. - Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. + ref-assign von "{1}" zu "{0}" ist nicht möglich, weil "{1}" einen geringeren Escapebereich als "{0}" aufweist. enum generic type constraints - enum generic type constraints + Generische Typeneinschränkungen für Enumeration delegate generic type constraints - delegate generic type constraints + Generische Typeneinschränkungen für Delegat unmanaged generic type constraints - unmanaged generic type constraints + Nicht verwaltete generische Typeneinschränkungen The 'new()' constraint cannot be used with the 'unmanaged' constraint - The 'new()' constraint cannot be used with the 'unmanaged' constraint + Die new()-Einschränkung kann nicht mit der unmanaged-Einschränkung verwendet werden. The 'unmanaged' constraint must come before any other constraints - The 'unmanaged' constraint must come before any other constraints + Die unmanaged-Einschränkung muss vor allen anderen Einschränkungen stehen. The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' + Der Typ "{2}" kann kein Verweistyp sein oder Verweistypfelder auf einer beliebigen Schachtelungsebene enthalten, damit er als Parameter "{1}" im generischen Typ oder der Methode "{0}" verwendet werden kann. Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' - Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' + Der {1}-Typparameter enthält die Einschränkung "unmanaged". "{1}" kann daher nicht als Einschränkung für "{0}" verwendet werden. stackalloc initializer - stackalloc initializer + stackalloc-Initialisierer "Invalid rank specifier: expected ']' - "Invalid rank specifier: expected ']' + "Ungültiger Rangspezifizierer: Erwartet wurde ] declaration of expression variables in member initializers and queries - declaration of expression variables in member initializers and queries + Deklaration von Ausdrucksvariablen in Memberinitialisierern und Abfragen The given expression cannot be used in a fixed statement - The given expression cannot be used in a fixed statement + Der angegebene Ausdruck kann nicht in einer fixed-Anweisung verwendet werden. extensible fixed statement - extensible fixed statement + Erweiterbare fixed-Anweisung indexing movable fixed buffers - indexing movable fixed buffers + Bewegliche Puffer fester Größe werden indiziert. Invalid object creation - Invalid object creation + Ungültige Objekterstellung diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf index f62ee33938cff..627f0eebc282c 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf @@ -2698,7 +2698,7 @@ Si se utiliza una clase de este tipo como clase base y si la clase derivada defi '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute - '{0}': los tipos de campo de instancia marcados con StructLayout(LayoutKind.Explicit) deben tener un atributo FieldOffset + "{0}": el campo de instancia en tipos marcados con StructLayout(LayoutKind.Explicit) debe tener un atributo FieldOffset @@ -4142,7 +4142,7 @@ Un bloque catch() después de un bloque catch (System.Exception e) puede abarcar foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - La instrucción foreach no puede funcionar en variables de tipo '{0}' porque '{0}' no contiene ninguna definición pública para '{1}' + La instrucción foreach no puede funcionar en variables de tipo "{0}" porque "{0}" no contiene ninguna definición de instancia pública para "{1}" @@ -4387,7 +4387,7 @@ Un bloque catch() después de un bloque catch (System.Exception e) puede abarcar Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function - No se pueden usar los parámetros ref ni out '{0}' dentro de un método anónimo, una expresión lambda ni una expresión de consulta + No se puede usar el parámetro ref, out o in "{0}" dentro de un método anónimo, una expresión lambda, una expresión de consulta o una función local @@ -4657,7 +4657,7 @@ Un bloque catch() después de un bloque catch (System.Exception e) puede abarcar Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 - Opción '{0}' no válida para /platform; debe ser anycpu, x86, Itanium o x64 + Opción "{0}" no válida para /platform; debe ser anycpu, x86, Itanium, arm, arm64 o x64 @@ -7346,7 +7346,7 @@ Para eliminar la advertencia puede usar /reference (establezca la propiedad Embe a part of /modulename:<string> Specify the name of the source module - + Opciones del compilador de Visual C# - ARCHIVOS DE SALIDA - @@ -7366,7 +7366,7 @@ Para eliminar la advertencia puede usar /reference (establezca la propiedad Embe /doc:<archivo> Archivo de documentación XML para generar /refout:<archivo> Salida del ensamblado de referencia para generar /platform:<cadena> Limitar en qué plataformas se puede ejecutar este código: x86, - Itanium, x64, arm, anycpu32bitpreferred o + Itanium, x64, arm, arm64, anycpu32bitpreferred o anycpu. El valor predeterminado es anycpu. - ARCHIVOS DE ENTRADA - @@ -8567,167 +8567,167 @@ Para eliminar la advertencia puede usar /reference (establezca la propiedad Embe Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. - Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. + Los argumentos con el modificador "in" no se pueden usar en las expresiones distribuidas dinámicamente. Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property - Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property + No utilice el atributo "System.Runtime.CompilerServices.FixedBuffer" en una propiedad. Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. - Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. + La característica "{0}" no está disponible en C# 7.3. Use la versión {1} del lenguaje o una posterior. Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. - Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. + Los atributos destinados al campo en las propiedades automáticas no se admiten en la versión del lenguaje {0}. Use la versión del lenguaje {1} o una superior. Field-targeted attributes on auto-properties are not supported in this version of the language. - Field-targeted attributes on auto-properties are not supported in this version of the language. + Los atributos destinados al campo en las propiedades automáticas no se admiten en esta versión del lenguaje. ref conditional expression - ref conditional expression + expresión condicional de referencia '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter - '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter + “{0}” no puede implementar el miembro de interfaz “{1}” en el tipo “{2}” porque tiene un parámetro __arglist tuple equality - tuple equality + igualdad de tupla Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. - Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. + Los tipos de tupla utilizados como operandos de un operador == o != deben tener cardinalidades coincidentes. Pero este operador tiene tipos de tupla de cardinalidad {0} a la izquierda y {1} a la derecha. Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Nombre de algoritmo hash no válido: "{0}" An expression tree may not contain a tuple == or != operator - An expression tree may not contain a tuple == or != operator + Un árbol de expresión no puede contener un operador de tupla == o !=. The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + No se tiene en cuenta el nombre de elemento de tupla "{0}" porque no se ha especificado ningún nombre, o se ha especificado uno diferente, en el otro lado del operador == o != de la tupla. The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + No se tiene en cuenta el nombre de elemento de tupla porque no se ha especificado ningún nombre, o se ha especificado uno diferente, en el otro lado del operador == o != de la tupla. '{0}': cannot specify both a constraint class and the 'unmanaged' constraint - '{0}': cannot specify both a constraint class and the 'unmanaged' constraint + "{0}": no se puede especificar a la vez una clase de restricción y la restricción "unmanaged" ref reassignment - ref reassignment + reasignación de referencias ref for-loop variables - ref for-loop variables + variables for-loop de referencias ref foreach iteration variables - ref foreach iteration variables + variables de iteración foreach de referencias The left-hand side of a ref assignment must be a ref local or parameter. - The left-hand side of a ref assignment must be a ref local or parameter. + La parte izquierda de una asignación de referencias debe ser una referencia local o un parámetro. Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. - Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. + No se puede asignar referencia "{1}" a "{0}" porque "{1}" tiene un ámbito de escape más limitado que "{0}". enum generic type constraints - enum generic type constraints + restricciones de tipo genérico enum delegate generic type constraints - delegate generic type constraints + restricciones de tipo genérico delegate unmanaged generic type constraints - unmanaged generic type constraints + restricciones de tipo genérico unmanaged The 'new()' constraint cannot be used with the 'unmanaged' constraint - The 'new()' constraint cannot be used with the 'unmanaged' constraint + La restricción "new()" no se puede utilizar con la restricción "unmanaged" The 'unmanaged' constraint must come before any other constraints - The 'unmanaged' constraint must come before any other constraints + La restricción "unmanaged" debe preceder a cualquier otra restricción The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' + El tipo "{2}" no puede ser un tipo de referencia ni contener campos de un tipo de referencia a cualquier nivel de anidado, a fin de usarlo como parámetro "{1}" en el tipo o método genérico "{0}" Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' - Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' + El parámetro de tipo "{1}" tiene la restricción "unmanaged"; por tanto, "{1}" no se puede usar como restricción para "{0}" stackalloc initializer - stackalloc initializer + inicializador stackalloc "Invalid rank specifier: expected ']' - "Invalid rank specifier: expected ']' + "Especificador de rango no válido: se esperaba ']'" declaration of expression variables in member initializers and queries - declaration of expression variables in member initializers and queries + declaración de variables de expresión en inicializadores y consultas de miembros The given expression cannot be used in a fixed statement - The given expression cannot be used in a fixed statement + La expresión proporcionada no se puede utilizar en una declaración fija extensible fixed statement - extensible fixed statement + declaración fija extensible indexing movable fixed buffers - indexing movable fixed buffers + indexando búferes fijos movibles Invalid object creation - Invalid object creation + Creación de objeto no válida diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf index d6d4a259cfd9d..ebf7bcdfe6cf2 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf @@ -2698,7 +2698,7 @@ Si une telle classe est utilisée en tant que classe de base et si la classe dé '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute - '{0}' : les types de champ d'instance marqués avec StructLayout(LayoutKind.Explicit) doivent avoir un attribut FieldOffset + '{0}' : un champ d'instance dans les types marqués avec StructLayout(LayoutKind.Explicit) doit avoir un attribut FieldOffset @@ -4142,7 +4142,7 @@ Un bloc catch() après un bloc catch (System.Exception e) peut intercepter des e foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - L'instruction foreach ne peut pas fonctionner sur des variables de type '{0}', car '{0}' ne contient pas de définition publique pour '{1}' + L'instruction foreach ne peut pas fonctionner sur des variables de type '{0}', car '{0}' ne contient pas de définition d'instance publique pour '{1}' @@ -4387,7 +4387,7 @@ Un bloc catch() après un bloc catch (System.Exception e) peut intercepter des e Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function - Impossible d'utiliser le paramètre ref ou out '{0}' dans une méthode anonyme, une expression lambda ou une expression de requête + Impossible d'utiliser le paramètre ref, out ou in '{0}' dans une méthode anonyme, une expression lambda, une expression de requête ou une fonction locale @@ -4657,7 +4657,7 @@ Un bloc catch() après un bloc catch (System.Exception e) peut intercepter des e Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 - Option non valide '{0}' pour /platform ; doit être anycpu, x86, Itanium ou x64 + Option non valide '{0}' pour /platform ; la valeur doit être anycpu, x86, Itanium, arm, arm64 ou x64 @@ -7346,7 +7346,7 @@ Pour supprimer l'avertissement, vous pouvez utiliser la commande /reference (dé a part of /modulename:<string> Specify the name of the source module - + Options du compilateur Visual C# - FICHIERS DE SORTIE - @@ -7366,7 +7366,7 @@ Pour supprimer l'avertissement, vous pouvez utiliser la commande /reference (dé /doc:<fichier> Fichier de documentation XML à générer /refout:<fichier> Référencer la sortie d'assembly à générer /platform:<chaîne> Limiter les plateformes sur lesquelles ce code peut s'exécuter : x86, - Itanium, x64, arm, anycpu32bitpreferred ou + Itanium, x64, arm, arm64, anycpu32bitpreferred ou anycpu. La valeur par défaut est anycpu. - FICHIERS D'ENTRÉE - @@ -8567,167 +8567,167 @@ Pour supprimer l'avertissement, vous pouvez utiliser la commande /reference (dé Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. - Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. + Impossible d'utiliser les arguments avec le modificateur 'in' dans les expressions faisant l'objet d'un dispatch dynamique. Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property - Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property + N'utilisez pas l'attribut 'System.Runtime.CompilerServices.FixedBuffer' sur une propriété Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. - Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. + La fonctionnalité '{0}' n'est pas disponible en C# 7.3. Utilisez la version de langage {1} ou une version ultérieure. Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. - Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. + Les attributs ciblés par des champs sur les propriétés automatiques ne sont pas pris en charge dans la version de langage {0}. Utilisez la version de langage {1} ou une version ultérieure. Field-targeted attributes on auto-properties are not supported in this version of the language. - Field-targeted attributes on auto-properties are not supported in this version of the language. + Les attributs ciblés par des champs sur les propriétés automatiques ne sont pas pris en charge dans cette version du langage. ref conditional expression - ref conditional expression + expression conditionnelle ref '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter - '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter + '{0}' ne peut pas implémenter le membre d'interface '{1}' dans le type '{2}', car il a un paramètre __arglist tuple equality - tuple equality + égalité de tuple Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. - Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. + Les types de tuple utilisés en tant qu'opérandes d'un opérateur == ou != doivent avoir des cardinalités correspondantes. Toutefois, cet opérateur a des types de tuple de cardinalité {0} à gauche et {1} à droite. Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Nom d'algorithme de hachage non valide : '{0}' An expression tree may not contain a tuple == or != operator - An expression tree may not contain a tuple == or != operator + Une arborescence de l'expression ne peut pas contenir un opérateur de tuple == ou != The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Le nom d'élément de tuple '{0}' est ignoré, car un autre nom est spécifié ou aucun nom n'est spécifié de l'autre côté de l'opérateur de tuple == ou !=. The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Le nom d'élément de tuple est ignoré, car un autre nom est spécifié ou aucun nom n'est spécifié de l'autre côté de l'opérateur de tuple == ou !=. '{0}': cannot specify both a constraint class and the 'unmanaged' constraint - '{0}': cannot specify both a constraint class and the 'unmanaged' constraint + '{0}' : impossible de spécifier à la fois une classe de contrainte et la contrainte 'unmanaged' ref reassignment - ref reassignment + réassignation de référence ref for-loop variables - ref for-loop variables + variables for loop de référence ref foreach iteration variables - ref foreach iteration variables + variables d'itération foreach de référence The left-hand side of a ref assignment must be a ref local or parameter. - The left-hand side of a ref assignment must be a ref local or parameter. + La partie gauche d'une assignation par référence doit être une variable locale ou un paramètre ref. Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. - Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. + Impossible d'effectuer une assignation par référence de '{1}' vers '{0}', car '{1}' a une portée de sortie plus limitée que '{0}'. enum generic type constraints - enum generic type constraints + contraintes de type générique d'enum delegate generic type constraints - delegate generic type constraints + contraintes de type générique de délégué unmanaged generic type constraints - unmanaged generic type constraints + contraintes de type générique unmanaged The 'new()' constraint cannot be used with the 'unmanaged' constraint - The 'new()' constraint cannot be used with the 'unmanaged' constraint + La contrainte 'new()' ne peut pas être utilisée avec la contrainte 'unmanaged' The 'unmanaged' constraint must come before any other constraints - The 'unmanaged' constraint must come before any other constraints + La contrainte 'unmanaged' doit être placée avant toutes les autres contraintes The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' + Le type '{2}' ne doit pas être un type référence, ou contenir des champs de type référence à l'un des niveaux d'imbrication, pour pouvoir être utilisé en tant que paramètre '{1}' dans le type ou la méthode générique '{0}' Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' - Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' + Le paramètre de type '{1}' a la contrainte 'unmanaged'. '{1}' ne peut donc pas être utilisé comme contrainte pour '{0}' stackalloc initializer - stackalloc initializer + initialiseur stackalloc "Invalid rank specifier: expected ']' - "Invalid rank specifier: expected ']' + "Spécificateur de rang non valide : ']' attendu declaration of expression variables in member initializers and queries - declaration of expression variables in member initializers and queries + déclaration de variables d'expression dans les initialiseurs de membres et les requêtes The given expression cannot be used in a fixed statement - The given expression cannot be used in a fixed statement + Impossible d'utiliser l'expression donnée dans une instruction fixed extensible fixed statement - extensible fixed statement + instruction fixed extensible indexing movable fixed buffers - indexing movable fixed buffers + indexation de mémoires tampons fixes mobiles Invalid object creation - Invalid object creation + Création d'objet non valide diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf index 18e877a4f30a9..af2c9f2eff72f 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf @@ -2168,7 +2168,7 @@ Se si usa tale classe come classe di base e se la classe di derivazione definisc Explicit interface implementation matches more than one interface member - L'implementazione dell'interfaccia esplicita corrisponde a più di un membro di interfaccia + L'implementazione esplicita dell'interfaccia corrisponde a più di un membro di interfaccia @@ -2698,7 +2698,7 @@ Se si usa tale classe come classe di base e se la classe di derivazione definisc '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute - '{0}': i tipi di campi dell'istanza contrassegnati con StructLayout(LayoutKind.Explicit) devono avere un attributo FieldOffset + '{0}': il campo dell'istanza nei tipi contrassegnati con StructLayout(LayoutKind.Explicit) deve contenere un attributo FieldOffset @@ -3373,7 +3373,7 @@ Se si usa tale classe come classe di base e se la classe di derivazione definisc Cannot initialize an implicitly-typed variable with an array initializer - Non è possibile inizializzare una variabile locale tipizzata in modo implicito con un inizializzatore di matrici + Non è possibile inizializzare una variabile locale tipizzata in modo implicito con un inizializzatore di matrice @@ -3453,7 +3453,7 @@ Se si usa tale classe come classe di base e se la classe di derivazione definisc An expression tree may not contain a multidimensional array initializer - L'albero delle espressioni non può contenere un inizializzatore di matrici multidimensionali + L'albero delle espressioni non può contenere un inizializzatore di matrice multidimensionale @@ -4142,7 +4142,7 @@ Un blocco catch() dopo un blocco catch (System.Exception e) è in grado di rilev foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - L'istruzione foreach non può funzionare con variabili di tipo '{0}' perché '{0}' non contiene una definizione pubblica per '{1}' + L'istruzione foreach non può funzionare con variabili di tipo '{0}' perché '{0}' non contiene una definizione di istanza pubblica per '{1}' @@ -4187,7 +4187,7 @@ Un blocco catch() dopo un blocco catch (System.Exception e) è in grado di rilev Array creation must have array size or array initializer - Per la creazione della matrice occorre specificare la dimensione della matrice o l'inizializzatore della matrice + Per la creazione della matrice occorre specificare la dimensione della matrice o l'inizializzatore di matrice @@ -4387,7 +4387,7 @@ Un blocco catch() dopo un blocco catch (System.Exception e) è in grado di rilev Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function - Non è possibile usare il parametro out o ref '{0}' all'interno di un metodo anonimo, un'espressione lambda o un'espressione di query + Non è possibile usare il parametro ref, out o in '{0}' all'interno di un metodo anonimo, di un'espressione lambda, di un'espressione di query o di una funzione locale @@ -4447,7 +4447,7 @@ Un blocco catch() dopo un blocco catch (System.Exception e) è in grado di rilev The managed coclass wrapper class signature '{0}' for interface '{1}' is not a valid class name signature - La firma della classe wrapper '{0}' della coclasse gestita per l'interfaccia '{1}' non è valida per il nome della classe + La firma '{0}' della classe wrapper della coclasse gestita per l'interfaccia '{1}' non è valida per il nome della classe @@ -4657,7 +4657,7 @@ Un blocco catch() dopo un blocco catch (System.Exception e) è in grado di rilev Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 - L'opzione '{0}' non è valida per /platform. Specificare anycpu, x86, Itanium o x64 + L'opzione '{0}' non è valida per /platform. Specificare anycpu, x86, Itanium, arm, arm64 o x64 @@ -4762,7 +4762,7 @@ Un blocco catch() dopo un blocco catch (System.Exception e) è in grado di rilev This warning occurs when you try to call a method, property, or indexer on a member of a class that derives from MarshalByRefObject, and the member is a value type. Objects that inherit from MarshalByRefObject are typically intended to be marshaled by reference across an application domain. If any code ever attempts to directly access the value-type member of such an object across an application domain, a runtime exception will occur. To resolve the warning, first copy the member into a local variable and call the method on that variable. - Questo avviso viene visualizzato quando si tenta di chiamare un metodo, una proprietà o un indicizzatore su un membro di una classe derivante da MarshalByRefObject e tale membro è un tipo di valore. Degli oggetti che ereditano da MarshalByRefObject viene in genere effettuato il marshalling dal riferimento in un dominio applicazione. Qualora un codice tenti di accedere direttamente al membro di tipo di valore di tale oggetto in un dominio applicazione, si verificherà un'eccezione in fase di esecuzione. Per risolvere il problema, copiare innanzitutto il membro in una variabile locale e chiamare il metodo su tale variabile. + Questo avviso viene visualizzato quando si tenta di chiamare un metodo, una proprietà o un indicizzatore su un membro di una classe derivante da MarshalByRefObject e tale membro è un tipo di valore. Degli oggetti che ereditano da MarshalByRefObject viene in genere effettuato il marshalling dal riferimento in un dominio dell'applicazione. Qualora un codice tenti di accedere direttamente al membro di tipo di valore di tale oggetto in un dominio dell'applicazione, si verificherà un'eccezione in fase di esecuzione. Per risolvere il problema, copiare innanzitutto il membro in una variabile locale e chiamare il metodo su tale variabile. @@ -5077,7 +5077,7 @@ Un blocco catch() dopo un blocco catch (System.Exception e) è in grado di rilev Static field or property '{0}' cannot be assigned in an object initializer - Non è possibile assegnare la proprietà o il campo statico '{0}' in un inizializzatore di oggetti + Non è possibile assegnare la proprietà o il campo statico '{0}' in un inizializzatore di oggetto @@ -5097,7 +5097,7 @@ Un blocco catch() dopo un blocco catch (System.Exception e) è in grado di rilev Element initializer cannot be empty - L'inizializzatore di elementi non può essere vuoto + L'inizializzatore di elemento non può essere vuoto @@ -5540,7 +5540,7 @@ Impostare il compilatore in modo tale da distinguere i metodi, ad esempio assegn This error occurs if you have an overloaded method that takes a jagged array and the only difference between the method signatures is the element type of the array. To avoid this error, consider using a rectangular array rather than a jagged array; use an additional parameter to disambiguate the function call; rename one or more of the overloaded methods; or, if CLS Compliance is not needed, remove the CLSCompliantAttribute attribute. - Questo errore si verifica quando si usa un metodo di overload che accetta una matrice di matrici e le firme del metodo si differenziano solo per il tipo di elemento della matrice. Per evitare questo errore, provare a usare una matrice rettangolare invece di una matrice di matrici, aggiungere un parametro in modo da evitare ambiguità nella chiamata della funzione oppure ridenominare uno o più metodi di overload. In alternativa, se la compatibilità con CLS non è necessaria, rimuovere l'attributo CLSCompliantAttribute. + Questo errore si verifica quando si usa un metodo di overload che accetta una matrice di matrici e le firme del metodo si differenziano solo per il tipo di elemento della matrice. Per evitare questo errore, provare a usare una matrice rettangolare invece di una matrice di matrici, aggiungere un parametro in modo da evitare ambiguità nella chiamata della funzione oppure rinominare uno o più metodi di overload. In alternativa, se la compatibilità con CLS non è necessaria, rimuovere l'attributo CLSCompliantAttribute. @@ -7346,7 +7346,7 @@ Per rimuovere l'avviso, è invece possibile usare /reference (impostare la propr a part of /modulename:<string> Specify the name of the source module - + Opzioni del compilatore Visual C# - FILE DI OUTPUT - @@ -7365,8 +7365,8 @@ Per rimuovere l'avviso, è invece possibile usare /reference (impostare la propr usato da WinMDExp. Forma breve: /t:winmdobj /doc:<file> File di documentazione XML da generare /refout:<file> Output dell'assembly di riferimento da generare - platform:<stringa> Limita le piattaforme in cui è possibile eseguire il codice: x86, - Itanium, x64, arm, anycpu32bitpreferred, or + /platform:<stringa> Limita le piattaforme in cui è possibile eseguire il codice: x86, + Itanium, x64, arm, arm64, anycpu32bitpreferred, or anycpu. Il valore predefinito è anycpu. - FILE DI INPUT - @@ -8567,167 +8567,167 @@ Per rimuovere l'avviso, è invece possibile usare /reference (impostare la propr Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. - Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. + Non è possibile usare argomenti con il modificatore 'in' nelle espressioni inviate in modo dinamico. Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property - Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property + Non usare l'attributo 'System.Runtime.CompilerServices.FixedBuffer' su una proprietà Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. - Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. + La funzionalità '{0}' non è disponibile in C# 7.3. Usare la versione {1} o versioni successive del linguaggio. Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. - Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. + Gli attributi destinati a campi su proprietà automatiche non sono supportati nella versione {0} del linguaggio. Usare la versione {1} o superiore. Field-targeted attributes on auto-properties are not supported in this version of the language. - Field-targeted attributes on auto-properties are not supported in this version of the language. + Gli attributi destinati a campi su proprietà automatiche non sono supportati in questa versione del linguaggio. ref conditional expression - ref conditional expression + espressione condizionale ref '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter - '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter + '{0}' non può implementare il membro di interfaccia '{1}' nel tipo '{2}' perché contiene un parametro __arglist tuple equality - tuple equality + uguaglianza tuple Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. - Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. + Le cardinalità dei tipi di tupla usati come operandi di un operatore == o != devono essere uguali, ma questo operatore presenta tipi di tupla con cardinalità {0} sulla sinistra e {1} sulla destra. Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Il nome dell'algoritmo hash non è valido: '{0}' An expression tree may not contain a tuple == or != operator - An expression tree may not contain a tuple == or != operator + Un albero delle espressioni non può contenere un operatore == o != di tupla The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Il nome dell'elemento di tupla '{0}' viene ignorato perché nell'altra parte dell'operatore == o != di tupla è specificato un nome diverso o non è specificato alcun nome. The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Il nome dell'elemento di tupla viene ignorato perché nella destinazione di assegnazione è specificato un nome diverso o non è specificato alcun nome. '{0}': cannot specify both a constraint class and the 'unmanaged' constraint - '{0}': cannot specify both a constraint class and the 'unmanaged' constraint + '{0}': non è possibile specificare sia una classe constraint che il vincolo 'unmanaged' ref reassignment - ref reassignment + riassegnazione ref ref for-loop variables - ref for-loop variables + variabili ciclo for ref ref foreach iteration variables - ref foreach iteration variables + variabili di iterazione foreach ref The left-hand side of a ref assignment must be a ref local or parameter. - The left-hand side of a ref assignment must be a ref local or parameter. + La parte sinistra di un'assegnazione ref deve essere un parametro o una variabile locale ref. Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. - Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. + Non è possibile assegnare '{1}' a '{0}' come ref perché l'ambito di escape di '{1}' è ridotto rispetto a quello di '{0}'. enum generic type constraints - enum generic type constraints + vincoli di tipo generico enumerazione delegate generic type constraints - delegate generic type constraints + vincoli di tipo generico delegato unmanaged generic type constraints - unmanaged generic type constraints + vincoli di tipo generico unmanaged The 'new()' constraint cannot be used with the 'unmanaged' constraint - The 'new()' constraint cannot be used with the 'unmanaged' constraint + Non è possibile usare il vincolo 'new()' con il vincolo 'unmanaged' The 'unmanaged' constraint must come before any other constraints - The 'unmanaged' constraint must come before any other constraints + Il vincolo 'unmanaged' deve precedere gli altri vincoli The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' + Il tipo '{2}' non può essere un tipo riferimento o contenere campi di tipo riferimento a qualsiasi livello di annidamento per poterlo usare come parametro '{1}' nel metodo o nel tipo generico '{0}' Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' - Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' + Il parametro di tipo '{1}' ha il vincolo 'managed'. Non è quindi possibile usare '{1}' come vincolo per '{0}' stackalloc initializer - stackalloc initializer + inizializzatore stackalloc "Invalid rank specifier: expected ']' - "Invalid rank specifier: expected ']' + "L'identificatore del numero di dimensioni non è valido: è previsto ']' declaration of expression variables in member initializers and queries - declaration of expression variables in member initializers and queries + dichiarazione di variabili di espressione in query e inizializzatori di membri The given expression cannot be used in a fixed statement - The given expression cannot be used in a fixed statement + Non è possibile usare l'espressione specificata in un'istruzione fixed extensible fixed statement - extensible fixed statement + istruzione fixed estendibile indexing movable fixed buffers - indexing movable fixed buffers + indicizzazione di buffer fissi mobili Invalid object creation - Invalid object creation + Creazione oggetto non valida diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf index be4f227c210c4..133c9de8de951 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf @@ -2478,7 +2478,7 @@ If such a class is used as a base class and if the deriving class defines a dest Enums cannot contain explicit parameterless constructors - 列挙型は明示的なパラメーターなしのコンス トラクターを含めることはできません + 列挙型は明示的なパラメーターなしのコンストラクターを含めることはできません @@ -2698,7 +2698,7 @@ If such a class is used as a base class and if the deriving class defines a dest '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute - '{0}': StructLayout(LayoutKind.Explicit) でマークされたインスタンス フィールドの型には、FieldOffset 属性を指定する必要があります。 + '{0}': StructLayout(LayoutKind.Explicit) でマークされた型のインスタンス フィールドには、FieldOffset 属性を指定する必要があります @@ -4142,7 +4142,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - foreach ステートメントは、'{0}' が '{1}' のパブリック定義を含んでいないため、型 '{0}' の変数に対して使用できません。 + foreach ステートメントは、'{0}' が '{1}' のパブリック インスタンス定義を含んでいないため、型 '{0}' の変数に対して使用できません @@ -4387,7 +4387,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function - ref または out パラメーター '{0}' は、匿名メソッド、ラムダ式、またはクエリ式の内部では使用できません。 + ref、out、in パラメーター '{0}' は、匿名メソッド、ラムダ式、クエリ式、ローカル関数の内部では使用できません @@ -4657,7 +4657,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 - /platform に対するオプション '{0}' が無効です。anycpu、x86、Itanium、または x64 を指定してください。 + /platform に対するオプション '{0}' が無効です。anycpu、x86、Itanium、arm、arm64、x64 を指定してください @@ -7346,7 +7346,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ a part of /modulename:<string> Specify the name of the source module - + Visual C# Compiler のオプション - 出力ファイル - @@ -7366,7 +7366,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ /doc:<file> 生成する XML ドキュメント ファイル /refout:<file> 生成する参照アセンブリ出力 /platform:<string> このコードを実行できるプラットフォームを x86、 - Itanium、x64、arm、anycpu32bitpreferred、 + Itanium、x64、arm、arm64、anycpu32bitpreferred、 anycpu に制限します。既定は anycpu です。 - 入力ファイル - @@ -8567,167 +8567,167 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. - Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. + 'in' 修飾子を持つ引数を、動的にディスパッチされる式で使用することはできません。 Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property - Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property + プロパティでは 'System.Runtime.CompilerServices.FixedBuffer' 属性を使用しないでください Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. - Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. + 機能 '{0}' は C# 7.3 では使用できません。{1} 以上の言語バージョンをお使いください。 Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. - Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. + 自動プロパティ上でフィールドをターゲットとする属性を使用することは、言語バージョン {0} ではサポートされていません。{1} 以上の言語バージョンをお使いください。 Field-targeted attributes on auto-properties are not supported in this version of the language. - Field-targeted attributes on auto-properties are not supported in this version of the language. + 自動プロパティ上でフィールドをターゲットとする属性を使用することは、このバージョンの言語ではサポートされていません。 ref conditional expression - ref conditional expression + ref 条件式 '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter - '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter + '{0}' は、__arglist パラメーターが指定されているため、型 '{2}' のインターフェイス メンバー '{1}' を実装できません tuple equality - tuple equality + タプルの等値性 Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. - Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. + 演算子 == または != のオペランドとして使用するタプルの型は、カーディナリティが一致している必要があります。しかし、この演算子は、左辺のタプルの型のカーディナリティが {0} で、右辺が {1} です。 Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + 無効なハッシュ アルゴリズム名: '{0}' An expression tree may not contain a tuple == or != operator - An expression tree may not contain a tuple == or != operator + 式ツリーにタプルの == または != 演算子を含めることはできません The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + タプル要素名 '{0}' は、タプルの == または != 演算子の反対側に異なる名前が指定されたか名前が指定されていないため、無視されます。 The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + タプル要素名は、タプルの == または != 演算子の反対側に異なる名前が指定されたか名前が指定されていないため、無視されます。 '{0}': cannot specify both a constraint class and the 'unmanaged' constraint - '{0}': cannot specify both a constraint class and the 'unmanaged' constraint + '{0}': 制約クラスと 'unmanaged' 制約の両方を指定することはできません ref reassignment - ref reassignment + ref 再割り当て ref for-loop variables - ref for-loop variables + ref for ループ変数 ref foreach iteration variables - ref foreach iteration variables + ref foreach 繰り返し変数 The left-hand side of a ref assignment must be a ref local or parameter. - The left-hand side of a ref assignment must be a ref local or parameter. + ref 割り当ての左辺は、ref ローカルまたはパラメーターにする必要があります。 Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. - Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. + '{1}' を '{0}' に ref 割り当てすることはできません。'{1}' のエスケープ スコープが '{0}' より狭いためです。 enum generic type constraints - enum generic type constraints + enum ジェネリック型の制約 delegate generic type constraints - delegate generic type constraints + delegate ジェネリック型の制約 unmanaged generic type constraints - unmanaged generic type constraints + unmanaged ジェネリック型の制約 The 'new()' constraint cannot be used with the 'unmanaged' constraint - The 'new()' constraint cannot be used with the 'unmanaged' constraint + new()' 制約は 'unmanaged' 制約と一緒には使用できません The 'unmanaged' constraint must come before any other constraints - The 'unmanaged' constraint must come before any other constraints + 'unmanaged' 制約は、他の制約の前に指定されなければなりません The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' + 型 '{2}' は、ジェネリック型またはメソッド '{0}' のパラメーター '{1}' として使用するために、参照型にすることも、入れ子のどのレベルに参照型フィールドを含めることもできません Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' - Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' + 型パラメーター '{1}' は 'unmanaged' 制約を含むので、'{0}' の制約として '{1}' を使用することはできません stackalloc initializer - stackalloc initializer + stackalloc 初期化子 "Invalid rank specifier: expected ']' - "Invalid rank specifier: expected ']' + "無効な次元指定子です: ']' を指定してください declaration of expression variables in member initializers and queries - declaration of expression variables in member initializers and queries + メンバー初期化子とクエリ内の式変数の宣言 The given expression cannot be used in a fixed statement - The given expression cannot be used in a fixed statement + 指定された式を fixed ステートメントで使用することはできません extensible fixed statement - extensible fixed statement + 拡張可能な fixed ステートメント indexing movable fixed buffers - indexing movable fixed buffers + 移動可能な固定バッファーのインデックス化 Invalid object creation - Invalid object creation + 無効なオブジェクト作成 diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf index ce7ef49e30cc9..c7e2e732becba 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf @@ -2698,7 +2698,7 @@ If such a class is used as a base class and if the deriving class defines a dest '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute - '{0}': StructLayout(LayoutKind.Explicit)으로 표시된 인스턴스 필드 형식에는 FieldOffset 특성이 있어야 합니다. + '{0}': StructLayout(LayoutKind.Explicit)으로 표시된 형식의 인스턴스 필드에는 FieldOffset 특성이 있어야 합니다. @@ -4142,7 +4142,7 @@ catch (System.Exception e) 블록 뒤의 catch() 블록은 RuntimeCompatibilityA foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - {0}'에는 '{1}'에 대한 공용 정의가 포함되어 있지 않아 '{0}' 형식 변수에서 foreach 문을 수행할 수 없습니다. + '{0}' 형식 변수에서 foreach 문을 수행할 수 없습니다. ‘{0}’에는 '{1}'에 대한 공용 인스턴스 정의가 없기 때문입니다. @@ -4387,7 +4387,7 @@ catch (System.Exception e) 블록 뒤의 catch() 블록은 RuntimeCompatibilityA Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function - 무명 메서드, 람다 식 또는 쿼리 식 안에서는 ref 또는 out 매개 변수 '{0}'을(를) 사용할 수 없습니다. + 무명 메서드, 람다 식, 쿼리 식 또는 로컬 함수 안에서는 ref, out 또는 in 매개 변수 '{0}'을(를) 사용할 수 없습니다. @@ -4657,7 +4657,7 @@ catch (System.Exception e) 블록 뒤의 catch() 블록은 RuntimeCompatibilityA Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 - /platform에 대해 잘못된 '{0}' 옵션입니다. anycpu, x86, Itanium 또는 x64여야 합니다. + /platform에 대해 잘못된 '{0}' 옵션입니다. anycpu, x86, Itanium, arm, arm64 또는 x64여야 합니다. @@ -7346,7 +7346,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ a part of /modulename:<string> Specify the name of the source module - + Visual C# 컴파일러 옵션 - 출력 파일 - @@ -7366,7 +7366,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ /doc:<file> 생성할 XML 문서 파일 /refout:<file> 생성할 참조 어셈블리 출력 /platform:<string> 이 코드를 실행할 수 있는 플랫폼을 x86, - Itanium, x64, arm, anycpu32bitpreferred 또는 + Itanium, x64, arm, arm64, anycpu32bitpreferred 또는 anycpu로 제한합니다. 기본값은 anycpu입니다. - 입력 파일 - @@ -8567,167 +8567,167 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. - Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. + 동적으로 디스패치된 식에서 'in' 한정자가 있는 인수를 사용할 수 없습니다. Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property - Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property + 속성에서 'System.Runtime.CompilerServices.FixedBuffer' 특성을 사용하지 마세요. Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. - Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. + '{0}' 기능은 C# 7.3에서 사용할 수 없습니다. {1} 이상의 언어 버전을 사용하세요. Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. - Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. + Auto 속성의 필드 대상 특성이 언어 버전 {0}에서 지원되지 않습니다. {1} 이상의 언어 버전을 사용하세요. Field-targeted attributes on auto-properties are not supported in this version of the language. - Field-targeted attributes on auto-properties are not supported in this version of the language. + Auto 속성의 필드 대상 특성이 이 언어 버전에서 지원되지 않습니다. ref conditional expression - ref conditional expression + ref 조건식 '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter - '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter + '{0}'은(는) __arglist 매개 변수가 있으므로 '{2}' 형식의 인터페이스 멤버 '{1}'을(를) 구현할 수 없습니다. tuple equality - tuple equality + 튜플 같음 Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. - Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. + == 또는 != 연산자의 피연산자로 사용되는 튜플 형식에는 일치하는 카디널리티가 있어야 합니다. 하지만 이 연산자는 왼쪽에 {0}, 오른쪽에 {1} 카디널리티 형식의 튜플이 있습니다. Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + 잘못된 해시 알고리즘 이름: '{0}' An expression tree may not contain a tuple == or != operator - An expression tree may not contain a tuple == or != operator + 식 트리에는 튜플 == 또는 != 연산자를 사용할 수 없습니다. The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + 튜플 요소 이름 '{0}'은(는) 튜플 == 또는 != 연산자의 반대쪽에서 다른 이름이 지정되었거나 이름이 지정되지 않았기 때문에 무시됩니다. The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + 튜플 요소 이름은(는) 튜플 == 또는 != 연산자의 반대쪽에서 다른 이름이 지정되었거나 이름이 지정되지 않았기 때문에 무시됩니다. '{0}': cannot specify both a constraint class and the 'unmanaged' constraint - '{0}': cannot specify both a constraint class and the 'unmanaged' constraint + '{0}': constraint 클래스와 'unmanaged' 제약 조건을 둘 다 지정할 수는 없습니다. ref reassignment - ref reassignment + ref 다시 할당 ref for-loop variables - ref for-loop variables + ref for 루프 변수 ref foreach iteration variables - ref foreach iteration variables + ref foreach 반복 변수 The left-hand side of a ref assignment must be a ref local or parameter. - The left-hand side of a ref assignment must be a ref local or parameter. + 참조 할당의 왼쪽은 참조 로컬 또는 매개 변수여야 합니다. Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. - Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. + '{1}'을(를) '{0}'에 참조 할당할 수 없습니다. '{1}'이(가) '{0}'보다 이스케이프 범위가 좁기 때문입니다. enum generic type constraints - enum generic type constraints + 열거형 제네릭 형식 제약 조건 delegate generic type constraints - delegate generic type constraints + 대리자 제네릭 형식 제약 조건 unmanaged generic type constraints - unmanaged generic type constraints + unmanaged 제네릭 형식 제약 조건 The 'new()' constraint cannot be used with the 'unmanaged' constraint - The 'new()' constraint cannot be used with the 'unmanaged' constraint + new()' 제약 조건은 'unmanaged' 제약 조건과 함께 사용할 수 없습니다. The 'unmanaged' constraint must come before any other constraints - The 'unmanaged' constraint must come before any other constraints + 'unmanaged' 제약 조건은 다른 모든 제약 조건보다 앞에 와야 합니다. The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' + '{2}' 형식은 제네릭 형식 또는 메서드 '{0}'에서 '{1}' 매개 변수로 사용하려면 참조 형식이 아니거나 어느 중첩 수준에서도 참조 형식 필드를 포함하지 않아야 합니다. Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' - Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' + 형식 매개 변수 '{1}'에 'unmanaged' 제약 조건이 있으므로 '{1}'은(는) '{0}'에 대한 제약 조건으로 사용할 수 없습니다. stackalloc initializer - stackalloc initializer + stackalloc 이니셜라이저 "Invalid rank specifier: expected ']' - "Invalid rank specifier: expected ']' + 잘못된 차수 지정자입니다. ']'가 필요합니다. declaration of expression variables in member initializers and queries - declaration of expression variables in member initializers and queries + 멤버 이니셜라이저 및 쿼리에서 식 변수 선언 The given expression cannot be used in a fixed statement - The given expression cannot be used in a fixed statement + fixed 문에서는 지정된 식을 사용할 수 없습니다. extensible fixed statement - extensible fixed statement + 확장 가능한 fixed 문 indexing movable fixed buffers - indexing movable fixed buffers + 이동 가능한 고정 버퍼 인덱싱 Invalid object creation - Invalid object creation + 잘못된 개체 만들기 diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf index 2ed055cff5cda..61749375a3ca8 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf @@ -2698,7 +2698,7 @@ Jeśli taka klasa zostanie użyta jako klasa bazowa i klasa pochodna definiuje d '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute - '„{0}”: typy pól wystąpienia oznaczone elementem StructLayout(LayoutKind.Explicit) muszą mieć atrybut FieldOffset + „{0}”: pola wystąpienia w ramach typów oznaczonych elementem StructLayout(LayoutKind.Explicit) muszą mieć atrybut FieldOffset @@ -4142,7 +4142,7 @@ Blok catch() po bloku catch (System.Exception e) może przechwytywać wyjątki n foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - Instrukcja foreach nie może operować na zmiennych typu „{0}”, ponieważ „{0}” nie zawiera definicji publicznej elementu „{1}” + Instrukcja foreach nie może operować na zmiennych typu „{0}”, ponieważ typ „{0}” nie zawiera publicznej definicji wystąpienia elementu „{1}” @@ -4387,7 +4387,7 @@ Blok catch() po bloku catch (System.Exception e) może przechwytywać wyjątki n Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function - Nie można użyć parametru ref ani out „{0}” wewnątrz metody anonimowej, wyrażenia lambda lub wyrażenia zapytania + Nie można użyć parametru ref, out ani in „{0}” wewnątrz metody anonimowej, wyrażenia lambda, wyrażenia zapytania lub funkcji lokalnej @@ -4657,7 +4657,7 @@ Blok catch() po bloku catch (System.Exception e) może przechwytywać wyjątki n Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 - Nieprawidłowa opcja „{0}” dla opcji /platform; wymagana wartość anycpu, x86, Itanium lub x64 + Nieprawidłowa opcja „{0}” dla opcji /platform; wymagana wartość to anycpu, x86, Itanium, arm, arm64 lub x64 @@ -7346,7 +7346,7 @@ Aby usunąć ostrzeżenie, możesz zamiast tego użyć opcji /reference (ustaw w a part of /modulename:<string> Specify the name of the source module - + Opcje kompilatora Visual C# - PLIKI WYJŚCIOWE - @@ -7366,7 +7366,7 @@ Aby usunąć ostrzeżenie, możesz zamiast tego użyć opcji /reference (ustaw w /doc:<plik> Plik dokumentacji XML do wygenerowania /refout:<plik> Dane wyjściowe zestawu odwołania do wygenerowania /platform:<ciąg> Ogranicz platformy, na których można uruchamiać ten kod: x86, - Itanium, x64, arm, anycpu32bitpreferred lub + Itanium, x64, arm, arm64, anycpu32bitpreferred lub anycpu. Wartość domyślna to anycpu. - PLIKI WEJŚCIOWE - @@ -8567,167 +8567,167 @@ Aby usunąć ostrzeżenie, możesz zamiast tego użyć opcji /reference (ustaw w Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. - Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. + Argumentów z modyfikatorem „in” nie można używać w wyrażeniach wysyłanych dynamicznie. Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property - Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property + Nie używaj atrybutu „System.Runtime.CompilerServices.FixedBuffer” względem właściwości Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. - Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. + Funkcja „{0}” nie jest dostępna w języku C# 7.3. Użyj języka w wersji {1} lub nowszej. Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. - Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. + Atrybuty docelowe dla pól w ramach właściwości automatycznych nie są obsługiwane w języku w wersji {0}. Użyj języka w wersji {1} lub nowszej. Field-targeted attributes on auto-properties are not supported in this version of the language. - Field-targeted attributes on auto-properties are not supported in this version of the language. + Atrybuty docelowe dla pól w ramach właściwości automatycznych nie są obsługiwane w tej wersji języka. ref conditional expression - ref conditional expression + wyrażenie warunkowe ref '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter - '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter + Obiekt „{0}” nie może implementować elementu członkowskiego interfejsu „{1}” w ramach typu „{2}”, ponieważ zawiera on parametr __arglist tuple equality - tuple equality + równość krotki Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. - Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. + Typy krotek używane jako operandy operatorów == lub != muszą mieć zgodne kardynalności. Ten operator zawiera natomiast typy krotek o kardynalności {0} z lewej strony i {1} z prawej strony. Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Nieprawidłowa nazwa algorytmu wyznaczania wartości skrótu: „{0}” An expression tree may not contain a tuple == or != operator - An expression tree may not contain a tuple == or != operator + Drzewo wyrażenia nie może zawierać operatora == ani != krotki. The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Nazwa elementu krotki „{0}” została zignorowana, ponieważ po drugiej stronie operatora == lub != krotki określono inną nazwę lub nie określono żadnej nazwy. The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Nazwa elementu krotki została zignorowana, ponieważ po drugiej stronie operatora == lub != krotki określono inną nazwę lub nie określono żadnej nazwy. '{0}': cannot specify both a constraint class and the 'unmanaged' constraint - '{0}': cannot specify both a constraint class and the 'unmanaged' constraint + „{0}”: nie można jednocześnie określić klasy ograniczenia i ograniczenia „unmanaged” ref reassignment - ref reassignment + ponowny przydział odwołania ref for-loop variables - ref for-loop variables + zmienne pętli for odwołania ref foreach iteration variables - ref foreach iteration variables + zmienna iteracji foreach odwołania The left-hand side of a ref assignment must be a ref local or parameter. - The left-hand side of a ref assignment must be a ref local or parameter. + Lewa strona przypisania odwołania musi być odwołaniem lokalnym lub parametrem. Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. - Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. + Nie można przypisać odwołania elementu „{1}” do elementu „{0}”, ponieważ element „{1}” ma węższy zakres wyjścia niż element „{0}”. enum generic type constraints - enum generic type constraints + ogólne ograniczenia typów wyliczenia delegate generic type constraints - delegate generic type constraints + ogólne ograniczenia typów delegowania unmanaged generic type constraints - unmanaged generic type constraints + ogólne niezarządzane ograniczenia typów The 'new()' constraint cannot be used with the 'unmanaged' constraint - The 'new()' constraint cannot be used with the 'unmanaged' constraint + Ograniczenie „new()” nie może być używane z ograniczeniem „unmanaged” The 'unmanaged' constraint must come before any other constraints - The 'unmanaged' constraint must come before any other constraints + Ograniczenie „unmanaged” musi występować przed wszystkimi innymi ograniczeniami The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' + Typ „{2}” nie może być typem referencyjnym ani zawierać pól typów odwołania na jakimkolwiek poziomie zagnieżdżenia, aby można było używać go jako parametru „{1}” w typie ogólnym lub metodzie ogólnej „{0}” Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' - Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' + Parametr typu „{1}” ma ograniczenie „unmanaged”, dlatego elementu „{1}” nie można użyć jako ograniczenia dla elementu „{0}” stackalloc initializer - stackalloc initializer + inicjator stackalloc "Invalid rank specifier: expected ']' - "Invalid rank specifier: expected ']' + Nieprawidłowy specyfikator rangi: oczekiwano „]” declaration of expression variables in member initializers and queries - declaration of expression variables in member initializers and queries + deklaracje zmiennych wyrażeń w inicjatorach elementów członkowskich i zapytaniach The given expression cannot be used in a fixed statement - The given expression cannot be used in a fixed statement + Podanego wyrażenia nie można użyć w instrukcji fixed extensible fixed statement - extensible fixed statement + rozszerzalna instrukcja fixed indexing movable fixed buffers - indexing movable fixed buffers + indeksowanie możliwych do przenoszenia buforów fixed Invalid object creation - Invalid object creation + Nieprawidłowa operacja tworzenia obiektu diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf index 6c9fc24211c52..55b7d89740d34 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf @@ -2698,7 +2698,7 @@ Se tal classe for usada como uma classe base e se a classe derivada definir um d '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute - '"{0}": tipos de campo de instância marcados com StructLayout(LayoutKind.Explicit) devem ter um atributo FieldOffset + '{0}': campo de instância em tipos marcados com StructLayout(LayoutKind.Explicit) precisam ter um atributo FieldOffset @@ -4142,7 +4142,7 @@ Um bloco catch() depois de um bloco catch (System.Exception e) poderá capturar foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - Instrução foreach não pode operar em variáveis do tipo "{0}" porque "{0}" não contém uma definição pública para "{1}" + A instrução foreach não pode operar em variáveis do tipo '{0}' porque '{0}' não contém uma definição da instância pública para '{1}' @@ -4387,7 +4387,7 @@ Um bloco catch() depois de um bloco catch (System.Exception e) poderá capturar Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function - Não é possível usar parâmetro ref ou out "{0}" dentro de um método anônimo, expressão lambda ou expressão de consulta + Não é possível usar os parâmetro ref, out ou in '{0}' dentro de um método anônimo, de uma expressão lambda de uma expressão de consulta ou de uma função local @@ -4657,7 +4657,7 @@ Um bloco catch() depois de um bloco catch (System.Exception e) poderá capturar Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 - Opção inválida "{0}" para /platform; deve ser anycpu, x86, Itanium ou x64 + Opção inválida '{0}' para /platform; precisa ser anycpu, x86, Itanium, arm, arm64 ou x64 @@ -7346,7 +7346,7 @@ Para incorporar informações de tipo de interoperabilidade para os dois assembl a part of /modulename:<string> Specify the name of the source module - + Opções do Compilador do Visual C# – ARQUIVOS DE SAÍDA – @@ -7366,7 +7366,7 @@ Para incorporar informações de tipo de interoperabilidade para os dois assembl /doc:<file> Arquivo de Documentação XML a ser gerado /refout:<file> Saída do assembly de referência a ser gerado /platform:<string> Limitar em quais plataformas o código pode ser executado: x86, - Itanium, x64, arm, anycpu32bitpreferred ou + Itanium, x64, arm, arm64, anycpu32bitpreferred ou anycpu. O padrão é anycpu. – ARQUIVOS DE ENTRADA – @@ -8567,167 +8567,167 @@ Para incorporar informações de tipo de interoperabilidade para os dois assembl Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. - Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. + Argumentos com o modificador 'in' não podem ser usados em expressões dinamicamente expedidas. Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property - Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property + Não use o atributo 'System.Runtime.CompilerServices.FixedBuffer' em uma propriedade Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. - Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. + O recurso '{0}' não está disponível em C# 7.3. Use a versão da linguagem {1} ou superior. Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. - Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. + Os atributos direcionados a campo em propriedades automáticas não são compatíveis com a versão da linguagem {0}. Use a versão da linguagem {1} ou superior. Field-targeted attributes on auto-properties are not supported in this version of the language. - Field-targeted attributes on auto-properties are not supported in this version of the language. + Os atributos direcionados a campo em propriedades automáticas não são compatíveis com esta versão da linguagem. ref conditional expression - ref conditional expression + expressão condicional ref '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter - '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter + '{0}' não pode implementar o membro de interface '{1}' no tipo '{2}' porque tem um parâmetro __arglist tuple equality - tuple equality + igualdade de tupla Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. - Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. + Os tipos de tupla usados como operandos de um operador == ou != precisam ter cardinalidades correspondentes. No entanto, este operador tem tipos de tupla de cardinalidade {0} na esquerda e {1} na direita. Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Nome de algoritmo de hash inválido: '{0}' An expression tree may not contain a tuple == or != operator - An expression tree may not contain a tuple == or != operator + Uma árvore de expressão não pode conter um operador == ou != de tupla The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + O nome do elemento da tupla '{0}' foi ignorado porque um nome diferente ou nenhum nome foi especificado no outro lado do operador == ou != de tupla. The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + O nome do elemento da tupla foi ignorado porque um nome diferente ou nenhum nome foi especificado no outro lado do operador == ou != de tupla. '{0}': cannot specify both a constraint class and the 'unmanaged' constraint - '{0}': cannot specify both a constraint class and the 'unmanaged' constraint + '{0}': não é possível especificar uma classe de restrição e a restrição 'unmanaged' ref reassignment - ref reassignment + reatribuição de ref ref for-loop variables - ref for-loop variables + variáveis de loop ref for ref foreach iteration variables - ref foreach iteration variables + variáveis de iteração ref foreach The left-hand side of a ref assignment must be a ref local or parameter. - The left-hand side of a ref assignment must be a ref local or parameter. + O lado esquerdo da atribuição ref precisa ser um parâmetro ou local ref. Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. - Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. + Não é possível atribuir ref '{1}' a '{0}' porque '{1}' tem um escopo de escape mais limitado que '{0}'. enum generic type constraints - enum generic type constraints + restrições de tipo genérico enum delegate generic type constraints - delegate generic type constraints + restrições de tipo genérico delegate unmanaged generic type constraints - unmanaged generic type constraints + restrições de tipo genérico unmanaged The 'new()' constraint cannot be used with the 'unmanaged' constraint - The 'new()' constraint cannot be used with the 'unmanaged' constraint + A restrição 'new()' não pode ser usada com a restrição 'unmanaged' The 'unmanaged' constraint must come before any other constraints - The 'unmanaged' constraint must come before any other constraints + A restrição 'unmanaged' deve vir antes das outras restrições The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' + O tipo '{2}' não pode ser um tipo de referência nem conter campos de tipo de referência em nenhum nível de aninhamento, para usá-lo como um parâmetro '{1}' no tipo genérico ou no método '{0}' Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' - Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' + O parâmetro de tipo '{1}' tem a restrição 'unmanaged' e, por isso, '{1}' não pode ser usado como uma restrição de '{0}' stackalloc initializer - stackalloc initializer + inicializador stackalloc "Invalid rank specifier: expected ']' - "Invalid rank specifier: expected ']' + "Especificador de classificação inválido: era esperado ']' declaration of expression variables in member initializers and queries - declaration of expression variables in member initializers and queries + declaração de variáveis de expressão em inicializadores e em consultas do membro The given expression cannot be used in a fixed statement - The given expression cannot be used in a fixed statement + A expressão determinada não pode ser usada em uma instrução fixa extensible fixed statement - extensible fixed statement + instrução fixa extensível indexing movable fixed buffers - indexing movable fixed buffers + buffers fixos móveis de indexação Invalid object creation - Invalid object creation + Criação de objeto inválido diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf index 0614208224592..8f44f10eede0b 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf @@ -2698,7 +2698,7 @@ If such a class is used as a base class and if the deriving class defines a dest '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute - '{0}": типы полей экземпляров, помеченные StructLayout(LayoutKind.Explicit), должны иметь атрибут FieldOffset. + "{0}": поле экземпляра с типами, помеченными StructLayout(LayoutKind.Explicit), должно иметь атрибут FieldOffset @@ -4142,7 +4142,7 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - Оператор foreach не работает с переменными типа "{0}", так как "{0}" не содержит открытого определения для "{1}". + Оператор foreach не работает с переменными типа "{0}", так как "{0}" не содержит открытое определение экземпляра для "{1}" @@ -4387,7 +4387,7 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function - Нельзя использовать параметр "{0}" с ключевым словом ref или out внутри анонимного метода, лямбда-выражения или выражения запроса. + Недопустимо использовать параметр "{0}" с модификаторами ref, out или in внутри анонимного метода, лямбда-выражения, выражения запроса или локальной функции @@ -4657,7 +4657,7 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 - Недопустимый параметр "{0}" для /platform; должен быть anycpu, x86, Itanium или x64. + Недопустимый параметр "{0}" для /platform; должен быть anycpu, x86, Itanium, arm, arm64 или x64 @@ -7346,7 +7346,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ a part of /modulename:<string> Specify the name of the source module - + Параметры компилятора Visual C# - ВЫХОДНЫЕ ФАЙЛЫ - @@ -7366,7 +7366,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ /doc:<файл> Создаваемый XML-файл документации /refout:<файл> Создаваемые выходные данные базовой сборки. /platform:<строка> Ограничить платформы, на которых может выполняться этот код: x86, - Itanium, x64, arm, anycpu32bitpreferred или + Itanium, x64, arm, arm64, anycpu32bitpreferred или anycpu. Значение по умолчанию — anycpu. - ВХОДНЫЕ ФАЙЛЫ - @@ -8567,167 +8567,167 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. - Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. + Вы не можете использовать аргументы с модификатором "in" в динамически отправляемых выражениях. Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property - Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property + Не используйте атрибут "System.Runtime.CompilerServices.FixedBuffer" для свойства Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. - Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. + Компонент "{0}" недоступен в C# 7.3. Используйте версию языка {1} или выше. Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. - Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. + Ориентированные на поле атрибуты для автосвойств не поддерживаются в версии языка {0}. Используйте версию языка {1} или выше. Field-targeted attributes on auto-properties are not supported in this version of the language. - Field-targeted attributes on auto-properties are not supported in this version of the language. + Ориентированные на поле атрибуты для автосвойств не поддерживаются в этой версии языка. ref conditional expression - ref conditional expression + Условное выражение ref '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter - '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter + "{0}" не может реализовать член интерфейса "{1}" в типе "{2}" из-за наличия параметра __arglist tuple equality - tuple equality + равенство кортежей Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. - Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. + Типы кортежей, используемые в качестве операндов оператора == или !=, должны иметь соответствующие кратности. Однако этот оператор имеет типы кортежей с кратностью {0} слева и {1} справа. Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Недопустимое имя хэш-алгоритма: "{0}" An expression tree may not contain a tuple == or != operator - An expression tree may not contain a tuple == or != operator + Дерево выражений не может содержать оператор == или != кортежа. The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Имя элемента кортежа "{0}" игнорируется, так как на другой стороне оператора == или != кортежа имя имеет другое значение или отсутствует. The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Имя элемента кортежа игнорируется, так как на другой стороне оператора == или != кортежа имя имеет другое значение или отсутствует. '{0}': cannot specify both a constraint class and the 'unmanaged' constraint - '{0}': cannot specify both a constraint class and the 'unmanaged' constraint + "{0}": невозможно одновременно задать класс ограничения и ограничение "unmanaged" ref reassignment - ref reassignment + повторное присваивание по ссылке ref for-loop variables - ref for-loop variables + переменные цикла for-loop для ссылки ref foreach iteration variables - ref foreach iteration variables + переменные итерации foreach для ссылки The left-hand side of a ref assignment must be a ref local or parameter. - The left-hand side of a ref assignment must be a ref local or parameter. + Левая часть выражения присваивания ссылки должна быть локальной ссылкой или параметром. Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. - Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. + Не удается присвоить по ссылке "{1}" для "{0}", так как escape-область у "{1}" уже, чем у "{0}". enum generic type constraints - enum generic type constraints + ограничения универсального типа перечисления delegate generic type constraints - delegate generic type constraints + ограничения универсального типа для делегата unmanaged generic type constraints - unmanaged generic type constraints + ограничения неуправляемого универсального типа The 'new()' constraint cannot be used with the 'unmanaged' constraint - The 'new()' constraint cannot be used with the 'unmanaged' constraint + Ограничение "new()" невозможно использовать вместе с ограничением "unmanaged" The 'unmanaged' constraint must come before any other constraints - The 'unmanaged' constraint must come before any other constraints + Все другие ограничения должны следовать после ограничения "unmanaged" The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' + Тип "{2}" не может быть ссылочным или содержать поля типов ссылок на любом уровне вложения, чтобы его можно было использовать в качестве параметра "{1}" в универсальном типе или методе "{0}". Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' - Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' + Параметр типа "{1}" имеет ограничение "unmanaged", поэтому "{1}" не может использоваться в качестве ограничения для "{0}". stackalloc initializer - stackalloc initializer + инициализатор stackalloc "Invalid rank specifier: expected ']' - "Invalid rank specifier: expected ']' + "Недопустимый описатель ранга: ожидается "]" declaration of expression variables in member initializers and queries - declaration of expression variables in member initializers and queries + объявление переменных выражения в инициализаторах члена и запросах The given expression cannot be used in a fixed statement - The given expression cannot be used in a fixed statement + Заданное выражение невозможно использовать в операторе fixed extensible fixed statement - extensible fixed statement + расширяемый оператор fixed indexing movable fixed buffers - indexing movable fixed buffers + индексирование перемещаемых буферов фиксированного размера Invalid object creation - Invalid object creation + Недопустимое создание объекта diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf index b2cff103a4586..c7845fe207ea9 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf @@ -2698,7 +2698,7 @@ Bu sınıf temel sınıf olarak kullanılırsa ve türetilen sınıf bir yıkıc '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute - '{0}': StructLayout(LayoutKind.Explicit) ile işaretlenen örnek alan türlerinin FieldOffset özniteliği olmalıdır + '{0}': StructLayout(LayoutKind.Explicit) ile işaretlenen örnek alan türlerinin FieldOffset özniteliği olmalıdır @@ -4142,7 +4142,7 @@ RuntimeCompatibilityAttribute AssemblyInfo.cs dosyasında false olarak ayarlanm foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - {0}' bir '{1}' ortak tanım içermediğinden veya erişilemez olduğundan foreach deyimi '{0}' türündeki değişkenlerde çalışamaz + {0}' bir '{1}' ortak örnek tanımı içermediğinden veya erişilemez olduğundan foreach deyimi '{0}' türündeki değişkenlerde çalışamaz @@ -4387,7 +4387,7 @@ RuntimeCompatibilityAttribute AssemblyInfo.cs dosyasında false olarak ayarlanm Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function - Anonim yöntem, lambda ifadesi veya sorgu ifadesi içinde '{0}' ref veya out parametresi kullanılamaz + Anonim metot, lambda ifadesi, sorgu ifadesi veya yerel işlev içinde '{0}' ref, out veya in parametresi kullanılamaz @@ -4657,7 +4657,7 @@ RuntimeCompatibilityAttribute AssemblyInfo.cs dosyasında false olarak ayarlanm Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 - /platform için geçersiz '{0}' seçeneği; anycpu, x86, Itanium veya x64 olmalıdır + /platform için geçersiz '{0}' seçeneği; anycpu, x86, Itanium, arm, arm64 veya x64 olmalıdır @@ -7346,7 +7346,7 @@ Uyarıyı kaldırmak için, /reference kullanabilirsiniz (Birlikte Çalışma T a part of /modulename:<string> Specify the name of the source module - + Visual C# Derleyici Seçenekleri - ÇIKIŞ DOSYALARI - @@ -7366,7 +7366,7 @@ Uyarıyı kaldırmak için, /reference kullanabilirsiniz (Birlikte Çalışma T /doc:<file> Oluşturulacak XML Belgeleri dosyası /refout:<file> Oluşturulacak başvuru derlemesi çıkışı /platform:<string> Bu kodun üstünde çalışacağı platformları sınırlar: x86, - Itanium, x64, arm, anycpu32bitpreferred, or + Itanium, x64, arm, arm64, anycpu32bitpreferred, or anycpu. Varsayılan anycpu. - GİRİŞ DOSYALARI - @@ -8567,167 +8567,167 @@ Uyarıyı kaldırmak için, /reference kullanabilirsiniz (Birlikte Çalışma T Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. - Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. + 'in' değiştiricisine sahip bağımsız değişkenler dinamik olarak dağıtılan ifadelerde kullanılamaz. Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property - Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property + Bir özellikte 'System.Runtime.CompilerServices.FixedBuffer' özniteliğini kullanmayın Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. - Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. + '{0}' özelliği C# 7.3'te kullanılamaz. Lütfen {1} veya daha yüksek bir dil sürümü kullanın. Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. - Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. + Otomatik özelliklerdeki alan hedefli öznitelikler, {0} dil sürümünde desteklenmez. Lütfen {1} veya daha yüksek bir dil sürümü kullanın. Field-targeted attributes on auto-properties are not supported in this version of the language. - Field-targeted attributes on auto-properties are not supported in this version of the language. + Otomatik özelliklerdeki alan hedefli öznitelikler, bu dil sürümünde desteklenmez. ref conditional expression - ref conditional expression + ref koşullu ifadesi '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter - '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter + '{0}' bir __arglist parametresine sahip olduğundan '{2}' türünde '{1}' arabirim üyesini uygulayamıyor. tuple equality - tuple equality + demet eşitliği Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. - Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. + == veya != işlecinin işleneni olarak kullanılan demet türlerinin kardinalitesi eşleşmelidir. Ancak bu işleç, solda {0} ve sağda {1} demet kardinalite türlerine sahip olmalıdır. Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Geçersiz karma algoritması adı: '{0}' An expression tree may not contain a tuple == or != operator - An expression tree may not contain a tuple == or != operator + İfade ağacı, demetin == veya != işlecini içeremez. The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Demetin == veya != işlecinin diğer tarafında farklı bir ad belirtildiğinden ya da bir ad belirtilmediğinden '{0}' demet öğesi adı yok sayıldı. The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + Demetin == veya != işlecinin diğer tarafında farklı bir ad belirtildiğinden ya da bir ad belirtilmediğinden demet öğesi adı yok sayıldı. '{0}': cannot specify both a constraint class and the 'unmanaged' constraint - '{0}': cannot specify both a constraint class and the 'unmanaged' constraint + '{0}': hem bir kısıtlama sınıfı hem de 'unmanaged' kısıtlaması belirtilemez ref reassignment - ref reassignment + ref yeniden ataması ref for-loop variables - ref for-loop variables + ref for-loop değişkenleri ref foreach iteration variables - ref foreach iteration variables + ref foreach yineleme değişkenleri The left-hand side of a ref assignment must be a ref local or parameter. - The left-hand side of a ref assignment must be a ref local or parameter. + ref atamasının sol tarafı, yerel ref veya parametresi olmalıdır. Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. - Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. + '{1}', '{0}' öğesinden daha dar bir kaçış kapsamı içerdiğinden '{0}' öğesine '{1}' ref ataması yapılamıyor. enum generic type constraints - enum generic type constraints + enum genel tür kısıtlamaları delegate generic type constraints - delegate generic type constraints + delegate genel tür kısıtlamaları unmanaged generic type constraints - unmanaged generic type constraints + unmanaged genel tür kısıtlamaları The 'new()' constraint cannot be used with the 'unmanaged' constraint - The 'new()' constraint cannot be used with the 'unmanaged' constraint + 'new()' kısıtlaması, 'unmanaged' kısıtlamasıyla kullanılamaz The 'unmanaged' constraint must come before any other constraints - The 'unmanaged' constraint must come before any other constraints + 'unmanaged' kısıtlaması diğer kısıtlamalardan önce gelmelidir The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' + '{0}' genel türünde veya metodunda '{1}' parametresi olarak kullanılması için '{2}' türü bir başvuru türü olamaz ya da herhangi bir iç içe geçme düzeyinde başvuru türü alanları içeremez. Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' - Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' + '{1}' tür parametresinde 'unmanaged' kısıtlaması olduğundan '{1}', '{0}' için kısıtlama olarak kullanılamaz stackalloc initializer - stackalloc initializer + stackalloc başlatıcı "Invalid rank specifier: expected ']' - "Invalid rank specifier: expected ']' + "IGeçersiz sıra belirticisi: ']' bekleniyor declaration of expression variables in member initializers and queries - declaration of expression variables in member initializers and queries + üye başlatıcılarda ve sorgularda ifade değişkenlerinin bildirimi The given expression cannot be used in a fixed statement - The given expression cannot be used in a fixed statement + Belirtilen ifade, fixed deyiminde kullanılamıyor extensible fixed statement - extensible fixed statement + genişletilebilir fixed deyimi indexing movable fixed buffers - indexing movable fixed buffers + taşınabilir sabit arabellekler dizine alınıyor Invalid object creation - Invalid object creation + Geçersiz nesne oluşturma diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf index 9ca1ad7e2ce44..80ebbee38f9cd 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf @@ -2698,7 +2698,7 @@ If such a class is used as a base class and if the deriving class defines a dest '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute - '“{0}”: 标记为 StructLayout(LayoutKind.Explicit) 的实例字段类型必须具有 FieldOffset 特性 + “{0}”: 标记为 StructLayout(LayoutKind.Explicit) 的实例字段类型必须具有 FieldOffset 特性 @@ -4142,7 +4142,7 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - “{0}”不包含“{1}”的公共定义,因此 foreach 语句不能作用于“{0}”类型的变量 + “{0}”不包含“{1}”的公共实例定义,因此 foreach 语句不能作用于“{0}”类型的变量 @@ -4387,7 +4387,7 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function - 不能在匿名方法、lambda 表达式或查询表达式中使用 ref 或 out 参数“{0}” + 不能在匿名方法、lambda 表达式、查询表达式或本地函数中使用 ref、out 或 in 参数“{0}” @@ -4657,7 +4657,7 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 - 选项“{0}”对 /platform 无效;必须是 anycpu、x86、Itanium 或 x64 + 选项“{0}”对 /platform 无效;必须是 anycpu、x86、Itanium、arm、arm64 或 x64 @@ -7346,7 +7346,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ a part of /modulename:<string> Specify the name of the source module - + Visual C# 编译器选项 - 输出文件 - @@ -7366,7 +7366,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ /doc:<file> 要生成的 XML 文档文件 /refout:<file> 要生成的引用程序集输出 /platform:<string> 限制此代码可以在其上运行的平台: x86、 - Itanium、x64、arm、anycpu32bitpreferred 或 + Itanium、x64、arm、arm64、anycpu32bitpreferred 或 anycpu。默认平台为 anycpu。 - 输入文件 - @@ -8567,167 +8567,167 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. - Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. + 带有 "in" 修饰符的参数不能用于动态调度的表达式。 Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property - Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property + 请不要使用属性的 "System.Runtime.CompilerServices.FixedBuffer" 特性 Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. - Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. + 功能“{0}”在 C# 7.3 中不可用。请使用 {1} 或更高的语言版本。 Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. - Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. + 语言版本 {0} 中不支持自动属性的字段针对特性。请使用 {1} 或更高的语言版本。 Field-targeted attributes on auto-properties are not supported in this version of the language. - Field-targeted attributes on auto-properties are not supported in this version of the language. + 此语言版本中不支持自动属性的字段针对特性。 ref conditional expression - ref conditional expression + ref 条件表达式 '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter - '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter + “{0}”无法在类型“{2}”中实现接口成员“{1}”,因为它具有 __arglist 参数 tuple equality - tuple equality + 元组相等 Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. - Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. + 用作 == 或 != 运算符的操作数的元组类型必须具有匹配的基数。但此运算符的基数的元组类型左侧为 {0},右侧为 {1}。 Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + 无效的哈希算法名称:“{0}” An expression tree may not contain a tuple == or != operator - An expression tree may not contain a tuple == or != operator + 表达式树不能包含元组 == 或 != 运算符 The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + 由于元组 == 或 != 运算符的另一侧指定了其他名称或未指定名称,因此元组元素名称“{0}”被忽略。 The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + 由于元组 == 或 != 运算符的另一侧指定了其他名称或未指定名称,因此元组元素名称被忽略。 '{0}': cannot specify both a constraint class and the 'unmanaged' constraint - '{0}': cannot specify both a constraint class and the 'unmanaged' constraint + “{0}”: 不能既指定约束类又指定 “unmanaged” 约束 ref reassignment - ref reassignment + ref 赋值 ref for-loop variables - ref for-loop variables + ref for 循环变量 ref foreach iteration variables - ref foreach iteration variables + ref foreach 迭代变量 The left-hand side of a ref assignment must be a ref local or parameter. - The left-hand side of a ref assignment must be a ref local or parameter. + ref 赋值左侧必须为 ref 本地函数或参数。 Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. - Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. + 无法将“{1}”重新赋值为“{0}”,因为“{1}”具有比“{0}”更窄的转义范围。 enum generic type constraints - enum generic type constraints + 枚举泛型类型约束 delegate generic type constraints - delegate generic type constraints + 委托泛型类型约束 unmanaged generic type constraints - unmanaged generic type constraints + 非托管泛型类型约束 The 'new()' constraint cannot be used with the 'unmanaged' constraint - The 'new()' constraint cannot be used with the 'unmanaged' constraint + "new()" 约束不能与 "unmanaged" 约束一起使用 The 'unmanaged' constraint must come before any other constraints - The 'unmanaged' constraint must come before any other constraints + "unmanaged" 约束必须在其他任何约束之前 The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' + 类型“{2}”不能为引用类型,或包含任何嵌套级别的引用类型字段,以将其用作泛型类型或方法“{0}”中的参数“{1}” Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' - Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' + 类型参数“{1}”具有 "unmanaged" 约束,因此“{1}”不能用作“{0}”的约束 stackalloc initializer - stackalloc initializer + stackalloc 初始值设定项 "Invalid rank specifier: expected ']' - "Invalid rank specifier: expected ']' + “无效的秩说明符: 应为“]” declaration of expression variables in member initializers and queries - declaration of expression variables in member initializers and queries + 成员初始值设定项和查询中的表达式变量声明 The given expression cannot be used in a fixed statement - The given expression cannot be used in a fixed statement + 给定表达式不能用于 fixed 语句中 extensible fixed statement - extensible fixed statement + 可扩展 fixed 语句 indexing movable fixed buffers - indexing movable fixed buffers + 正在编制可移动固定缓冲区的索引 Invalid object creation - Invalid object creation + 对象创建无效 diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf index 466e4079af27a..673c4dfc2a8c8 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf @@ -2698,7 +2698,7 @@ If such a class is used as a base class and if the deriving class defines a dest '{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute - '{0}': 標記有 StructLayout(LayoutKind.Explicit) 的執行個體欄位類型,必須要有 FieldOffset 屬性。 + '{0}': 標記有 StructLayout(LayoutKind.Explicit) 之類型的執行個體欄位,必須要有 FieldOffset 屬性 @@ -4142,7 +4142,7 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - foreach 陳述式不可用在類型 '{0}' 的變數上,因為 '{0}' 未包含 '{1}' 的公用定義。 + foreach 陳述式不可用在類型 '{0}' 的變數上,因為 '{0}' 未包含 '{1}' 的公用執行個體定義 @@ -4387,7 +4387,7 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function - 無法在匿名方法、Lambda 運算式或查詢運算式內使用 ref 或 out 參數 '{0}'。 + 無法在匿名方法、Lambda 運算式、查詢運算式或區域函式中使用 ref、out 或 in 參數 '{0}' @@ -4657,7 +4657,7 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64 - /platform 的 '{0}' 選項無效; 必須是 anycpu、x86、Itanium 或 x64。 + /platform 的 '{0}' 選項無效; 必須是 anycpu、x86、Itanium、arm、arm64 或 x64 @@ -7346,7 +7346,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ a part of /modulename:<string> Specify the name of the source module - + Visual C# 編譯器選項 - 輸出檔案 - @@ -7366,7 +7366,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ /doc:<檔案> 要產生的 XML 文件檔案 /refout:<檔案> 要產生的參考組件輸出 /platform:<字串> 限制此程式碼可執行的平台: x86、 - Itanium、x64、arm、anycpu32bitpreferred 或 + Itanium、x64、arm、arm64、anycpu32bitpreferred 或 anycpu。預設為 anycpu。 - 輸入檔案 - @@ -8567,167 +8567,167 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. - Arguments with 'in' modifier cannot be used in dynamically dispatched expessions. + 具有 'in' 修飾詞的引數不得用於動態分派的運算式。 Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property - Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property + 請勿在屬性 (property) 上使用 'System.Runtime.CompilerServices.FixedBuffer' 屬性 (attribute) Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. - Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater. + 在 C# 7.3 中無法使用 '{0}' 功能。請使用語言版本 {1} 或更高的版本。 Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. - Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater. + 語言版本 {0} 不支援自動屬性 (property) 上以欄位為目標的屬性 (attribute)。請使用語言版本 {1} 或更高的版本。 Field-targeted attributes on auto-properties are not supported in this version of the language. - Field-targeted attributes on auto-properties are not supported in this version of the language. + 此語言版本不支援自動屬性 (property) 上以欄位為目標的屬性 (attribute)。 ref conditional expression - ref conditional expression + 參考條件運算式 '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter - '{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter + 因為介面成員 '{1}' 包含 __arglist 參數,所以 '{0}' 無法在類型 '{2}' 中實作此介面成員 tuple equality - tuple equality + 元組相等 Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. - Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right. + 作為 == 或 != 運算子之運算元使用的元組類型,必須具有相符的基數。但此運算子在左側的元組類型為基數 {0},在右側則為 {1}。 Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + 雜湊演算法名稱無效: '{0}' An expression tree may not contain a tuple == or != operator - An expression tree may not contain a tuple == or != operator + 運算式樹狀架構不得包含元組 == 或 != 運算子。 The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + 因為元組 == 或 != 運算子的另一端指定了不同的名稱或未指定名稱,所以會忽略元組元素名稱 '{0}'。 The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. - The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. + 因為元組 == 或 != 運算子的另一端指定了不同的名稱或未指定名稱,所以會忽略元組元素名稱。 '{0}': cannot specify both a constraint class and the 'unmanaged' constraint - '{0}': cannot specify both a constraint class and the 'unmanaged' constraint + '{0}': 不可在指定條件約束類型的同時,又指定 'unmanaged' 條件約束 ref reassignment - ref reassignment + 參考重新指派 ref for-loop variables - ref for-loop variables + 參考 for 迴圈變數 ref foreach iteration variables - ref foreach iteration variables + 參考 foreach 反覆運算變數 The left-hand side of a ref assignment must be a ref local or parameter. - The left-hand side of a ref assignment must be a ref local or parameter. + 參考指派的左側必須為參考本機或參數。 Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. - Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'. + 不能將 '{1}' 參考指派至 '{0}',因為 '{1}' 的逸出範圍比 '{0}' 還要窄。 enum generic type constraints - enum generic type constraints + 列舉泛型類型條件約束 delegate generic type constraints - delegate generic type constraints + 委派泛型類型條件約束 unmanaged generic type constraints - unmanaged generic type constraints + Unmanaged 泛型類型條件約束 The 'new()' constraint cannot be used with the 'unmanaged' constraint - The 'new()' constraint cannot be used with the 'unmanaged' constraint + new()' 條件約束不能和 'unmanaged' 條件約束一起使用 The 'unmanaged' constraint must come before any other constraints - The 'unmanaged' constraint must come before any other constraints + 'unmanaged' 條件約束必須在所有其他條件約束之前 The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' + 類型 '{2}' 不能是參考類型,或在任何巢狀層級包含參考類型欄位,才能將它作為參數 '{1}' 用於泛型類型或方法 '{0}' Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' - Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}' + 類型參數 '{1}' 有 'unmanaged' 條件約束,因此 '{1}' 不可作為 '{0}' 的條件約束 stackalloc initializer - stackalloc initializer + stackalloc 初始設定式 "Invalid rank specifier: expected ']' - "Invalid rank specifier: expected ']' + "陣序規範無效: 必須是 ']' declaration of expression variables in member initializers and queries - declaration of expression variables in member initializers and queries + 成員初始設定式及查詢中之運算式變數的宣告 The given expression cannot be used in a fixed statement - The given expression cannot be used in a fixed statement + 指定運算式無法用於 fixed 陳述式中 extensible fixed statement - extensible fixed statement + 可延伸 fixed 陳述式 indexing movable fixed buffers - indexing movable fixed buffers + 對可移動的固定緩衝區編製索引 Invalid object creation - Invalid object creation + 無效的物件建立 diff --git a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.cs.xlf b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.cs.xlf index 09c0664ccf0dc..db273597feefc 100644 --- a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.cs.xlf +++ b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.cs.xlf @@ -121,22 +121,22 @@ {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' - {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' + {0} obsahuje duplicitní položky {1} s konfliktními metadaty {2}: {3} a {4} {0} paths are required to end with a slash or backslash: '{1}' - {0} paths are required to end with a slash or backslash: '{1}' + Cesty {0} musí končit lomítkem nebo zpětným lomítkem: {1} {0} items must include at least one top-level (not nested) item when {1} is true - {0} items must include at least one top-level (not nested) item when {1} is true + Položky {0} musí zahrnovat nejméně jednu položku nejvyšší úrovně (nevnořenou), pokud {1} má hodnotu true. The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' - The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' + Hodnota {0} nebyla v položkách {1} nalezena nebo odpovídající položka není zdrojový kořen nejvyšší úrovně: {2} diff --git a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.de.xlf b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.de.xlf index 702e1d904d8f4..0c14e8412d8f8 100644 --- a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.de.xlf +++ b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.de.xlf @@ -121,22 +121,22 @@ {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' - {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' + "{0}" enthält doppelte Elemente "{1}" mit widersprüchlichen Metadaten "{2}": "{3}" und "{4}". {0} paths are required to end with a slash or backslash: '{1}' - {0} paths are required to end with a slash or backslash: '{1}' + {0}-Pfade müssen mit einem Schrägstrich oder einem umgekehrten Schrägstrich enden: '{1}' {0} items must include at least one top-level (not nested) item when {1} is true - {0} items must include at least one top-level (not nested) item when {1} is true + {0}-Elemente müssen mindestens ein Element der obersten Ebene (nicht geschachtelt) enthalten, wenn "{1}" auf TRUE festgelegt ist. The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' - The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' + Der Wert von "{0}" wurde in {1} Elementen nicht gefunden, oder das entsprechende Element ist kein Quellstamm der obersten Ebene: {2} diff --git a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.es.xlf b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.es.xlf index 62f92ba44cbe3..0994dcd667aff 100644 --- a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.es.xlf +++ b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.es.xlf @@ -121,22 +121,22 @@ {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' - {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' + {0} contiene elementos duplicados "{1}" con metadatos en conflicto "{2}": "{3}" y "{4}" {0} paths are required to end with a slash or backslash: '{1}' - {0} paths are required to end with a slash or backslash: '{1}' + Se requiere que las rutas {0} finalicen con una barra diagonal o una barra diagonal inversa: "{1}" {0} items must include at least one top-level (not nested) item when {1} is true - {0} items must include at least one top-level (not nested) item when {1} is true + Los elementos {0} deben incluir al menos un elemento de nivel superior (no anidado) cuando {1} es verdadero The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' - The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' + El valor de {0} no se encontró en elementos de {1}, o el elemento correspondiente no es una raíz de origen de nivel superior: "{2}" diff --git a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.fr.xlf b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.fr.xlf index 52d97a7a0a79a..be679abc4e747 100644 --- a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.fr.xlf +++ b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.fr.xlf @@ -121,22 +121,22 @@ {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' - {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' + {0} contient des éléments dupliqués '{1}' avec des métadonnées en conflit '{2}' : '{3}' et '{4}' {0} paths are required to end with a slash or backslash: '{1}' - {0} paths are required to end with a slash or backslash: '{1}' + Les chemins {0} doivent finir par une barre oblique ou une barre oblique inverse : '{1}' {0} items must include at least one top-level (not nested) item when {1} is true - {0} items must include at least one top-level (not nested) item when {1} is true + Les éléments {0} doivent inclure au moins un élément de niveau supérieur (non imbriqué) quand {1} a la valeur true The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' - The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' + La valeur de {0} est introuvable dans les éléments {1}, ou l'élément correspondant n'est pas une racine source de niveau supérieur : '{2}' diff --git a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.it.xlf b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.it.xlf index eda0cf48940df..83eeac215f75a 100644 --- a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.it.xlf +++ b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.it.xlf @@ -121,22 +121,22 @@ {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' - {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' + {0} contiene elementi duplicati '{1}' con metadati in conflitto '{2}': '{3}' e '{4}' {0} paths are required to end with a slash or backslash: '{1}' - {0} paths are required to end with a slash or backslash: '{1}' + {0} percorsi devono terminare con una barra o una barra rovesciata: '{1}' {0} items must include at least one top-level (not nested) item when {1} is true - {0} items must include at least one top-level (not nested) item when {1} is true + {0} elementi devono includere almeno un elemento di primo livello (non annidato) quando {1} è true The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' - The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' + Il valore di {0} non è stato trovato negli elementi {1} oppure l'elemento corrispondente non è una radice di origine di primo livello: '{2}' diff --git a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.ja.xlf b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.ja.xlf index f5dcc28a92b40..17479188aaccd 100644 --- a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.ja.xlf +++ b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.ja.xlf @@ -121,22 +121,22 @@ {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' - {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' + {0} には重複した項目 '{1}' が含まれており、メタデータ '{2}' の '{3}' と '{4}' が競合しています {0} paths are required to end with a slash or backslash: '{1}' - {0} paths are required to end with a slash or backslash: '{1}' + {0} パスの最後はスラッシュまたはバックスラッシュでなければなりません: '{1}' {0} items must include at least one top-level (not nested) item when {1} is true - {0} items must include at least one top-level (not nested) item when {1} is true + {1} が true の場合、{0} 項目には (入れ子になっていない) 最上位項目が少なくとも 1 つ必要です The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' - The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' + 値 {0} が {1} 項目にないか、対応する項目が最上位ソース ルートではありません: '{2}' diff --git a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.ko.xlf b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.ko.xlf index 44cd09e75789d..df5d18b5f320e 100644 --- a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.ko.xlf +++ b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.ko.xlf @@ -121,22 +121,22 @@ {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' - {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' + 충돌 메타데이터 '{2}'이(가) 있는 중복 항목 '{1}'이(가) {0}에 포함되어 있습니다. '{3}' 및 '{4}' {0} paths are required to end with a slash or backslash: '{1}' - {0} paths are required to end with a slash or backslash: '{1}' + {0} 경로는 슬래시 또는 백슬래시로 끝나야 합니다. '{1}' {0} items must include at least one top-level (not nested) item when {1} is true - {0} items must include at least one top-level (not nested) item when {1} is true + {0} 항목은 {1}이(가) true인 경우 최상위(중첩되지 않은) 항목을 하나 이상 포함해야 합니다. The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' - The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' + {1} 항목에서 {0}의 값을 찾을 수 없거나 해당 항목이 최상위 소스 루트가 아닙니다. '{2}' diff --git a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.pl.xlf b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.pl.xlf index 48a1393c1be5f..1a2fde4430fd0 100644 --- a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.pl.xlf +++ b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.pl.xlf @@ -121,22 +121,22 @@ {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' - {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' + Element {0} zawiera zduplikowane elementy „{1}” z metadanymi powodującymi konflikt „{2}”: „{3}” i „{4}” {0} paths are required to end with a slash or backslash: '{1}' - {0} paths are required to end with a slash or backslash: '{1}' + Ścieżki {0} muszą kończyć się ukośnikiem lub ukośnikiem odwrotnym: „{1}” {0} items must include at least one top-level (not nested) item when {1} is true - {0} items must include at least one top-level (not nested) item when {1} is true + Elementy {0} muszą zawierać co najmniej jeden niezagnieżdżony element najwyższego poziomu, gdy właściwość {1} ma wartość true The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' - The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' + Nie odnaleziono wartości {0} w elementach {1} bądź odpowiadający element nie jest źródłowym elementem głównym najwyższego poziomu: „{2}” diff --git a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.pt-BR.xlf b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.pt-BR.xlf index 76c1421ade960..b3537acf1e379 100644 --- a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.pt-BR.xlf +++ b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.pt-BR.xlf @@ -121,22 +121,22 @@ {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' - {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' + {0} contém itens duplicados '{1}' com metadados conflitantes'{2}': '{3}' e '{4}' {0} paths are required to end with a slash or backslash: '{1}' - {0} paths are required to end with a slash or backslash: '{1}' + {0} caminhos precisam ser terminados com uma barra ou uma barra invertida: '{1}' {0} items must include at least one top-level (not nested) item when {1} is true - {0} items must include at least one top-level (not nested) item when {1} is true + {0} itens precisam incluir pelo menos um item de nível superior (não aninhado) quando {1} é verdadeiro The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' - The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' + Valor de {0} não encontrado em {1} itens ou o item correspondente não é uma raiz de origem de nível superior: '{2}' diff --git a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.ru.xlf b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.ru.xlf index def998dd93757..ab4723bbf5f54 100644 --- a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.ru.xlf +++ b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.ru.xlf @@ -121,22 +121,22 @@ {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' - {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' + {0} содержит повторяющиеся элементы "{1}" с конфликтующими метаданными "{2}": "{3}" и "{4}" {0} paths are required to end with a slash or backslash: '{1}' - {0} paths are required to end with a slash or backslash: '{1}' + Пути {0} должны заканчиваться прямой или обратной косой чертой: "{1}" {0} items must include at least one top-level (not nested) item when {1} is true - {0} items must include at least one top-level (not nested) item when {1} is true + Элементы {0} должны включать по меньшей мере один элемент верхнего уровня (невложенный), когда {1} имеет значение "true" The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' - The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' + Значение объекта {0} не найдено в элементах {1}, либо соответствующий элемент не является исходным корнем верхнего уровня: "{2}" diff --git a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.tr.xlf b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.tr.xlf index aac132e5409d6..68cbbee12ee73 100644 --- a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.tr.xlf +++ b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.tr.xlf @@ -121,22 +121,22 @@ {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' - {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' + {0}, çakışan '{2}' meta verileriyle birlikte yinelenen '{1}' öğelerini içeriyor: '{3}' ve '{4}' {0} paths are required to end with a slash or backslash: '{1}' - {0} paths are required to end with a slash or backslash: '{1}' + {0} yolunun sonunda eğik çizgi veya ters eğik çizgi olması gerekir: '{1}' {0} items must include at least one top-level (not nested) item when {1} is true - {0} items must include at least one top-level (not nested) item when {1} is true + {1} true olduğunda {0} öğe en az bir üst düzey (iç içe geçmemiş) öğe içermelidir The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' - The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' + {0} değeri, {1} öğede bulunamadı veya karşılık gelen öğe, üst düzey kaynak kökü değil: '{2}' diff --git a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.zh-Hans.xlf b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.zh-Hans.xlf index 892a4bf9b5e6f..7cee36546fe1a 100644 --- a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.zh-Hans.xlf +++ b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.zh-Hans.xlf @@ -121,22 +121,22 @@ {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' - {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' + {0} 包含重复项“{1}”和冲突元数据“{2}”:“{3}”和“{4}” {0} paths are required to end with a slash or backslash: '{1}' - {0} paths are required to end with a slash or backslash: '{1}' + 要求“{0}”路径以斜杠或反斜杠结尾:“{1}” {0} items must include at least one top-level (not nested) item when {1} is true - {0} items must include at least one top-level (not nested) item when {1} is true + 当 {1} 为 true,{0} 项必须包括至少一个顶级(未嵌套)项 The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' - The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' + 未在 {1} 项中找到值 {0},或者对应项不是顶级源根目录:“{2}” diff --git a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.zh-Hant.xlf b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.zh-Hant.xlf index 3f93014e8ef73..034bd1d9e8ada 100644 --- a/src/Compilers/Core/MSBuildTask/xlf/ErrorString.zh-Hant.xlf +++ b/src/Compilers/Core/MSBuildTask/xlf/ErrorString.zh-Hant.xlf @@ -121,22 +121,22 @@ {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' - {0} contains duplicate items '{1}' with conflicting metadata '{2}': '{3}' and '{4}' + {0} 包含具衝突中繼資料 '{2}' 的重複項目 '{1}': '{3}' 和 '{4}' {0} paths are required to end with a slash or backslash: '{1}' - {0} paths are required to end with a slash or backslash: '{1}' + {0} 個路徑必須以斜線或反斜線作為結尾: '{1}' {0} items must include at least one top-level (not nested) item when {1} is true - {0} items must include at least one top-level (not nested) item when {1} is true + 在 {1} 為 true 的情況下,{0} 個項目必須包含至少一個高層級 (非巢狀) 項目 The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' - The value of {0} not found in {1} items, or the corresponding item is not a top-level source root: '{2}' + {1} 個項目中找不到 {0} 的值,或相對應項目不是高階層來源根目錄: '{2}' diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.cs.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.cs.xlf index 93ae405a41a20..a2a8ddd495c8d 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.cs.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.cs.xlf @@ -8395,7 +8395,7 @@ /vbruntime:<file> Compile with the alternate Visual Basic runtime in <file>. - Parametry kompilátoru Visual Basic + Parametry kompilátoru Visual Basic - VÝSTUPNÍ SOUBOR - /out:<soubor> Určuje název výstupního souboru. @@ -8539,7 +8539,7 @@ Určuje mapování pro výstup zdrojových názvů cest kompilátorem. /platform:<řetězec> Omezuje platformy, na kterých se dá tento kód - spustit: x86, x64, Itanium, arm, + spustit: x86, x64, Itanium, arm, arm64, AnyCPU32BitPreferred nebo anycpu (výchozí). /preferreduilang Určuje název upřednostňovaného výstupního jazyka. /sdkpath:<cesta> Umístění adresáře s .NET Framework SDK @@ -9078,12 +9078,12 @@ Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Neplatný název algoritmu hash: {0} interpolated strings - interpolated strings + interpolované řetězce diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.de.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.de.xlf index 1f06a60f9e3b7..670811a445c25 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.de.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.de.xlf @@ -8395,7 +8395,7 @@ /vbruntime:<file> Compile with the alternate Visual Basic runtime in <file>. - Visual Basic-Compileroptionen + Visual Basic-Compileroptionen - AUSGABEDATEI - /out:<Datei> Gibt den Ausgabedateinamen an. @@ -8539,7 +8539,7 @@ Gibt eine Zuordnung für die Ausgabe der Quellpfadnamen durch den Compiler an. /platform:<Zeichenfolge> Schränkt die Plattformen ein, auf denen dieser Code ausgeführt werden kann; - gültige Werte sind x86, x64, Itanium, arm, + gültige Werte sind x86, x64, Itanium, arm, arm64, AnyCPU32BitPreferred oder anycpu (Standard). /preferreduilang Gibt den Namen der bevorzugten Ausgabesprache an. /sdkpath:<Pfad> Der Speicherort des .NET Framework SDK-Verzeichnisses @@ -9078,12 +9078,12 @@ Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Ungültiger Name für Hashalgorithmus: "{0}" interpolated strings - interpolated strings + Interpolierte Zeichenfolgen diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.es.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.es.xlf index 6f0bb4f991706..84d2cc666786b 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.es.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.es.xlf @@ -8395,7 +8395,7 @@ /vbruntime:<file> Compile with the alternate Visual Basic runtime in <file>. - Opciones del compilador de Visual Basic + Opciones del compilador de Visual Basic - ARCHIVO DE SALIDA - /out:<archivo> Especificar nombre del archivo de salida. @@ -8539,7 +8539,7 @@ Especificar una asignación para los nombres de ruta de acceso de origen producidos por el compilador. /platform:<cadena> Limitar en qué plataformas se puede ejecutar este código. - Debe ser x86, x64, Itanium, arm, + Debe ser x86, x64, Itanium, arm, arm64, AnyCPU32BitPreferred o anycpu (valor predeterminado). /preferreduilang Especificar el nombre del lenguaje de salida preferido. /sdkpath:<ruta de acceso> Ubicación del directorio de .NET Framework SDK @@ -9078,12 +9078,12 @@ Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Nombre de algoritmo hash no válido: "{0}" interpolated strings - interpolated strings + cadenas interpoladas diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.fr.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.fr.xlf index eee949d69d5d7..5c4fced06a43e 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.fr.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.fr.xlf @@ -8395,7 +8395,7 @@ /vbruntime:<file> Compile with the alternate Visual Basic runtime in <file>. - Options du compilateur Visual Basic + Options du compilateur Visual Basic - FICHIER DE SORTIE - /out:<fichier> Spécifie le nom du fichier de sortie. @@ -8539,7 +8539,7 @@ Spécifier un mappage pour les noms de chemins sources sortis par le compilateur. /platform:<chaîne> Limiter les plateformes sur lesquelles ce code peut s'exécuter ; - doit correspondre à x86, x64, Itanium, arm, + doit correspondre à x86, x64, Itanium, arm, arm64, AnyCPU32BitPreferred ou anycpu (par défaut). /preferreduilang Spécifier le nom du langage de sortie préféré. /sdkpath:<chemin> Emplacement du répertoire du SDK .NET Framework @@ -9078,12 +9078,12 @@ Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Nom d'algorithme de hachage non valide : '{0}' interpolated strings - interpolated strings + chaînes interpolées diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.it.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.it.xlf index cc3914b6660e5..489531fb0e2e4 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.it.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.it.xlf @@ -8395,7 +8395,7 @@ /vbruntime:<file> Compile with the alternate Visual Basic runtime in <file>. - Opzioni del compilatore Visual Basic + Opzioni del compilatore Visual Basic - FILE DI OUTPUT - /out:<file> Consente di specificare il nome del file di output. @@ -8539,7 +8539,7 @@ Consente di specificare un mapping per i nomi di percorso di origine visualizzati dal compilatore. /platform:<stringa> Limita le piattaforme su cui è possibile seguire questo codice. - Il valore deve essere x86, x64, Itanium, arm, + Il valore deve essere x86, x64, Itanium, arm, arm64, AnyCPU32BitPreferred o anycpu (impostazione predefinita). /preferreduilang Consente di specificare il nome del linguaggio di output preferito. /sdkpath:<percorso> Percorso della directory di .NET Framework SDK @@ -9078,12 +9078,12 @@ Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Il nome dell'algoritmo hash non è valido: '{0}' interpolated strings - interpolated strings + stringhe interpolate diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.ja.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.ja.xlf index 58a70702a6414..eafb29dbf651d 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.ja.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.ja.xlf @@ -8395,7 +8395,7 @@ /vbruntime:<file> Compile with the alternate Visual Basic runtime in <file>. - Visual Basic コンパイラのオプション + Visual Basic コンパイラのオプション - 出力ファイル - /out:<file> 出力ファイル名を指定します。 @@ -8539,7 +8539,7 @@ コンパイラが出力するソース パス名のマッピングを 指定します。 /platform:<string> このコードを実行できるプラットフォームは - x86、x64、Itanium、arm、 + x86、x64、Itanium、arm、arm64、 AnyCPU32BitPreferred、anycpu (既定) でなければなりません。 /preferreduilang 出力用の言語名を指定します。 /sdkpath:<path> .NET Framework SDK ディレクトリ (mscorlib.dll) @@ -9078,12 +9078,12 @@ Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + 無効なハッシュ アルゴリズム名: '{0}' interpolated strings - interpolated strings + 挿入文字列 diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.ko.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.ko.xlf index d5a8390f20efc..3e005837e32f7 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.ko.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.ko.xlf @@ -8395,7 +8395,7 @@ /vbruntime:<file> Compile with the alternate Visual Basic runtime in <file>. - Visual Basic 컴파일러 옵션 + Visual Basic 컴파일러 옵션 - 출력 파일 - /out:<file> 출력 파일 이름을 지정합니다. @@ -8539,7 +8539,7 @@ 컴파일러에서 소스 경로 이름 출력에 대한 매핑을 지정합니다. /platform:<string> 이 코드를 실행할 수 있는 플랫폼을 - x86, x64, Itanium, arm, + x86, x64, Itanium, arm, arm64, AnyCPU32BitPreferred 또는 anycpu(기본값)로 제한합니다. /preferreduilang 기본 출력 언어 이름을 지정합니다. /sdkpath:<path> .NET Framework SDK 디렉터리의 @@ -9078,12 +9078,12 @@ Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + 잘못된 해시 알고리즘 이름: '{0}' interpolated strings - interpolated strings + 보간된 문자열 diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.pl.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.pl.xlf index e98748ad7ff96..440d803ad1f39 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.pl.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.pl.xlf @@ -8395,7 +8395,7 @@ /vbruntime:<file> Compile with the alternate Visual Basic runtime in <file>. - Opcje kompilatora Visual Basic + Opcje kompilatora Visual Basic - PLIK WYJŚCIOWY - /out:<plik> Określa nazwę pliku wyjściowego. @@ -8539,7 +8539,7 @@ Określ mapowanie nazw ścieżek źródłowych wyprowadzanych przez kompilator. /platform:<ciąg> Ogranicz platformy, na jakich można uruchomić ten kod; - dozwolone wartości: x86, x64, Itanium, arm, + dozwolone wartości: x86, x64, Itanium, arm, arm64, AnyCPU32BitPreferred lub anycpu (wartość domyślna). /preferreduilang Określ nazwę preferowanego języka wyjściowego. /sdkpath:<ścieżka> Lokalizacja katalogu zestawu .NET Framework SDK @@ -9078,12 +9078,12 @@ Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Nieprawidłowa nazwa algorytmu wyznaczania wartości skrótu: „{0}” interpolated strings - interpolated strings + ciągi interpolowane diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.pt-BR.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.pt-BR.xlf index 59bf361c143c4..e5f90e76abe36 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.pt-BR.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.pt-BR.xlf @@ -8395,7 +8395,7 @@ /vbruntime:<file> Compile with the alternate Visual Basic runtime in <file>. - Opções do Compilador do Visual Basic + Opções do Compilador do Visual Basic – ARQUIVO DE SAÍDA – /out:<file> Especifica o nome do arquivo de saída. @@ -8539,7 +8539,7 @@ Especificar um mapeamento para nomes de caminhos de origem produzidos pelo compilador. /platform:<string> Limitar em quais plataformas o código pode ser executado; - deve ser x86, x64, Itanium, arm, + deve ser x86, x64, Itanium, arm, arm64, AnyCPU32BitPreferred ou anycpu (padrão). /preferreduilang Especificar o nome da linguagem de saída preferencial. /sdkpath:<path> Localização do diretório do SDK do .NET Framework @@ -9078,12 +9078,12 @@ Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Nome de algoritmo de hash inválido: '{0}' interpolated strings - interpolated strings + cadeias de caracteres interpoladas diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.ru.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.ru.xlf index 5da3894c25a98..39b226f71574c 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.ru.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.ru.xlf @@ -8395,7 +8395,7 @@ /vbruntime:<file> Compile with the alternate Visual Basic runtime in <file>. - Параметры компилятора Visual Basic + Параметры компилятора Visual Basic - ВЫХОДНОЙ ФАЙЛ - /out:<файл> Задает имя выходного файла. @@ -8539,7 +8539,7 @@ Указать сопоставление для выходных данных имен исходного пути по компилятору. /platform:<строка> Ограничить платформы, на которых может выполняться этот код: - x86, x64, Itanium, arm, + x86, x64, Itanium, arm, arm64, AnyCPU32BitPreferred или anycpu (по умолчанию). /preferreduilang Указать имя предпочтительного языка вывода. /sdkpath:<путь> Расположение каталога пакета SDK .NET Framework @@ -9078,12 +9078,12 @@ Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Недопустимое имя хэш-алгоритма: "{0}" interpolated strings - interpolated strings + интерполированные строки diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.tr.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.tr.xlf index 1341be48244a0..6163cd48ec189 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.tr.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.tr.xlf @@ -8395,7 +8395,7 @@ /vbruntime:<file> Compile with the alternate Visual Basic runtime in <file>. - Visual Basic Derleyici Seçenekleri + Visual Basic Derleyici Seçenekleri - ÇIKIŞ DOSYASI - /out:<file> Çıkış dosyası adını belirtir. @@ -8539,7 +8539,7 @@ Derleyici tarafından kaynak yolu adları çıkışı için bir eşleme belirt. /platform:<string> Bu kodun çalışabileceği platformları sınırla; - x86, x64, Itanium, arm, AnyCPU32BitPreferred + x86, x64, Itanium, arm, arm64, AnyCPU32BitPreferred veya anycpu (varsayılan) olmalıdır. /preferreduilang Tercih edilen çıkış dilini belirt. /sdkpath:<path> .NET Framework SDK (mscorlib.dll) dizininin @@ -9078,12 +9078,12 @@ Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + Geçersiz karma algoritması adı: '{0}' interpolated strings - interpolated strings + aradeğerlendirme dizeleri diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hans.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hans.xlf index f502a5981c84d..3b6e9fa6f62fe 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hans.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hans.xlf @@ -8395,7 +8395,7 @@ /vbruntime:<file> Compile with the alternate Visual Basic runtime in <file>. - Visual Basic 编译器选项 + Visual Basic 编译器选项 - 输出文件 - /out:<file> 指定输出文件名称。 @@ -8539,7 +8539,7 @@ 按编译器指定源路径名称输出的 映射。 /platform:<string> 限制此代码可以在其上运行的平台; - 必须是 x86、x64、Itanium、arm、 + 必须是 x86、x64、Itanium、arm、arm64、 AnyCPU32BitPreferred 或 anycpu (默认)。 /preferreduilang 指定首选输出语言名称。 /sdkpath:<path> .NET Framework SDK 目录的位置 @@ -9078,12 +9078,12 @@ Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + 无效的哈希算法名称:“{0}” interpolated strings - interpolated strings + 插补的字符串 diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hant.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hant.xlf index 55e4610f0750f..95702d25b5810 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hant.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hant.xlf @@ -8395,7 +8395,7 @@ /vbruntime:<file> Compile with the alternate Visual Basic runtime in <file>. - Visual Basic 編譯器選項 + Visual Basic 編譯器選項 - 輸出檔案 - /out:<檔案> 指定輸出檔案名稱。 @@ -8539,7 +8539,7 @@ 為編譯器輸出的來源路徑名稱 指定對應。 /platform:<字串> 限制這個程式碼可以在哪些平台執行; - 必須是 x86、x64、Itanium、arm、 + 必須是 x86、x64、Itanium、arm、arm64、 AnyCPU32BitPreferred 或 anycpu (預設)。 /preferreduilang 指定慣用的輸出語言名稱。 /sdkpath:<路徑> .NET Framework SDK 目錄的位置 @@ -9078,12 +9078,12 @@ Invalid hash algorithm name: '{0}' - Invalid hash algorithm name: '{0}' + 雜湊演算法名稱無效: '{0}' interpolated strings - interpolated strings + 內插字串 diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf index f8761d71a9d41..929afb307c51d 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf @@ -624,22 +624,22 @@ Add parentheses - Add parentheses + Přidat závorky Convert to 'switch' - Convert to 'switch' + Převést na switch Convert to 'foreach' - Convert to 'foreach' + Převést na foreach Convert to 'for' - Convert to 'for' + Převést na for diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf index 32411ec4fc6a6..6b7ac5fde90cd 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf @@ -624,22 +624,22 @@ Add parentheses - Add parentheses + Klammern hinzufügen Convert to 'switch' - Convert to 'switch' + In "switch" konvertieren Convert to 'foreach' - Convert to 'foreach' + In "foreach" konvertieren Convert to 'for' - Convert to 'for' + In "for" konvertieren diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf index ab75cbb73bd4d..c3d8b76fd3120 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf @@ -624,22 +624,22 @@ Add parentheses - Add parentheses + Agregar paréntesis Convert to 'switch' - Convert to 'switch' + Convertir a "switch" Convert to 'foreach' - Convert to 'foreach' + Convertir a "foreach" Convert to 'for' - Convert to 'for' + Convertir a "for" diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf index 03ea42f302e91..2bae79e83ea44 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf @@ -624,22 +624,22 @@ Add parentheses - Add parentheses + Ajouter des parenthèses Convert to 'switch' - Convert to 'switch' + Convertir en 'switch' Convert to 'foreach' - Convert to 'foreach' + Convertir en 'foreach' Convert to 'for' - Convert to 'for' + Convertir en 'for' diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf index 767ba00660194..29febf2a1b1cb 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf @@ -624,22 +624,22 @@ Add parentheses - Add parentheses + Aggiungi parentesi Convert to 'switch' - Convert to 'switch' + Converti in 'switch' Convert to 'foreach' - Convert to 'foreach' + Converti in 'foreach' Convert to 'for' - Convert to 'for' + Converti in 'for' diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf index 3d40a2169b5a7..2e55629cea018 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf @@ -624,22 +624,22 @@ Add parentheses - Add parentheses + 括弧を追加します Convert to 'switch' - Convert to 'switch' + 'switch' に変換する Convert to 'foreach' - Convert to 'foreach' + 'foreach' に変換する Convert to 'for' - Convert to 'for' + 'for' に変換する diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf index 341cd5e07858a..ae64eb0d2ff8b 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf @@ -624,22 +624,22 @@ Add parentheses - Add parentheses + 괄호 추가 Convert to 'switch' - Convert to 'switch' + 'switch'로 변환 Convert to 'foreach' - Convert to 'foreach' + 'foreach'로 변환 Convert to 'for' - Convert to 'for' + 'for'로 변환 diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf index 30e151bfa70e5..ec5707f747bcb 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf @@ -624,22 +624,22 @@ Add parentheses - Add parentheses + Dodaj nawiasy Convert to 'switch' - Convert to 'switch' + Konwertuj na wyrażenie „switch” Convert to 'foreach' - Convert to 'foreach' + Konwertuj na wyrażenie „foreach” Convert to 'for' - Convert to 'for' + Konwertuj na wyrażenie „for” diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf index f2e5bd3ed4aa7..4af1c264a9fb1 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf @@ -624,22 +624,22 @@ Add parentheses - Add parentheses + Adicionar parênteses Convert to 'switch' - Convert to 'switch' + Converter em 'switch' Convert to 'foreach' - Convert to 'foreach' + Converter em 'foreach' Convert to 'for' - Convert to 'for' + Converter em 'for' diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf index 50b203cf632df..ca08510298044 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf @@ -624,22 +624,22 @@ Add parentheses - Add parentheses + Добавить скобки Convert to 'switch' - Convert to 'switch' + Преобразовать в "switch" Convert to 'foreach' - Convert to 'foreach' + Преобразовать в "foreach" Convert to 'for' - Convert to 'for' + Преобразовать в "for" diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf index 575fe250f0fbc..d2ddc66c72de2 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf @@ -624,22 +624,22 @@ Add parentheses - Add parentheses + Parantez ekle Convert to 'switch' - Convert to 'switch' + 'switch' deyimine dönüştür Convert to 'foreach' - Convert to 'foreach' + 'foreach' deyimine dönüştür Convert to 'for' - Convert to 'for' + 'for' deyimine dönüştür diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf index 05c36f2a656ac..c13ff0836958f 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf @@ -624,22 +624,22 @@ Add parentheses - Add parentheses + 添加括号 Convert to 'switch' - Convert to 'switch' + 转换为 “switch Convert to 'foreach' - Convert to 'foreach' + 转换为“foreach” Convert to 'for' - Convert to 'for' + 转换为“for” diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf index ff4ec49a7202a..91a3e4f75fed6 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf @@ -624,22 +624,22 @@ Add parentheses - Add parentheses + 新增括弧 Convert to 'switch' - Convert to 'switch' + 轉換為 'switch' Convert to 'foreach' - Convert to 'foreach' + 轉換為 'foreach' Convert to 'for' - Convert to 'for' + 轉換為 'for' diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf index 6f5ce26175f9f..78e5ef9a81f4e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf @@ -1987,32 +1987,32 @@ Tato verze se používá zde: {2}. Alias ambiguous type '{0}' - Alias ambiguous type '{0}' + Alias nejednoznačného typu {0} Warning: Collection was modified during iteration. - Warning: Collection was modified during iteration. + Upozornění: Během iterace se kolekce změnila. Warning: Iteration variable crossed function boundary. - Warning: Iteration variable crossed function boundary. + Upozornění: Proměnná iterace překročila hranici funkce. Warning: Collection may be modified during iteration. - Warning: Collection may be modified during iteration. + Upozornění: Během iterace se kolekce může změnit. Add readonly modifier - Add readonly modifier + Přidat modifikátor jen pro čtení Make field readonly - Make field readonly + Nastavit pole jen pro čtení diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf index e872d449a2f98..f7724125c3299 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf @@ -1987,32 +1987,32 @@ Diese Version wird verwendet in: {2} Alias ambiguous type '{0}' - Alias ambiguous type '{0}' + Nicht eindeutiger Aliastyp "{0}" Warning: Collection was modified during iteration. - Warning: Collection was modified during iteration. + Warnung: Die Sammlung wurde bei der Iteration geändert. Warning: Iteration variable crossed function boundary. - Warning: Iteration variable crossed function boundary. + Warnung: Die Iterationsvariable hat die Funktionsgrenze überschritten. Warning: Collection may be modified during iteration. - Warning: Collection may be modified during iteration. + Warnung: Die Sammlung wird bei der Iteration möglicherweise geändert. Add readonly modifier - Add readonly modifier + Modifizierer "readonly" hinzufügen Make field readonly - Make field readonly + Schreibschutz für Feld festlegen diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf index 45af4bc870eb5..64730279977ba 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf @@ -1987,32 +1987,32 @@ Esta versión se utiliza en: {2} Alias ambiguous type '{0}' - Alias ambiguous type '{0}' + Tipo de alias ambiguo "{0}" Warning: Collection was modified during iteration. - Warning: Collection was modified during iteration. + Advertencia: la colección se modificó durante la iteración. Warning: Iteration variable crossed function boundary. - Warning: Iteration variable crossed function boundary. + Advertencia: límite de función cruzada de variable de iteración. Warning: Collection may be modified during iteration. - Warning: Collection may be modified during iteration. + Advertencia: es posible que la colección se modifique durante la iteración. Add readonly modifier - Add readonly modifier + Agregar modificador de solo lectura Make field readonly - Make field readonly + Hacer el archivo de solo lectura diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf index b3d4607dc5206..844a5de29a74f 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf @@ -1987,32 +1987,32 @@ Version utilisée dans : {2} Alias ambiguous type '{0}' - Alias ambiguous type '{0}' + Alias de type ambigu : '{0}' Warning: Collection was modified during iteration. - Warning: Collection was modified during iteration. + Avertissement : La collection a été modifiée durant l'itération. Warning: Iteration variable crossed function boundary. - Warning: Iteration variable crossed function boundary. + Avertissement : La variable d'itération a traversé la limite de fonction. Warning: Collection may be modified during iteration. - Warning: Collection may be modified during iteration. + Avertissement : La collection risque d'être modifiée durant l'itération. Add readonly modifier - Add readonly modifier + Ajouter un modificateur readonly Make field readonly - Make field readonly + Rendre le champ readonly diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf index bce358c5cbfda..630a3d1b17283 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf @@ -1987,32 +1987,32 @@ Questa versione è usata {2} Alias ambiguous type '{0}' - Alias ambiguous type '{0}' + Tipo di alias '{0}' ambiguo Warning: Collection was modified during iteration. - Warning: Collection was modified during iteration. + Avviso: la raccolta è stata modificata durante l'iterazione. Warning: Iteration variable crossed function boundary. - Warning: Iteration variable crossed function boundary. + Avviso: la variabile di iterazione ha superato il limite della funzione. Warning: Collection may be modified during iteration. - Warning: Collection may be modified during iteration. + Avviso: è possibile che la raccolta venga modificata durante l'iterazione. Add readonly modifier - Add readonly modifier + Aggiungi modificatore readonly Make field readonly - Make field readonly + Imposta il campo come di sola lettura diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf index d13db4469ddc6..f26cfe267d180 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf @@ -1987,32 +1987,32 @@ This version used in: {2} Alias ambiguous type '{0}' - Alias ambiguous type '{0}' + エイリアスのあいまいな型 '{0}' Warning: Collection was modified during iteration. - Warning: Collection was modified during iteration. + 警告: 反復処理中にコレクションが変更されました。 Warning: Iteration variable crossed function boundary. - Warning: Iteration variable crossed function boundary. + 警告: 繰り返し変数が関数の境界を超えました。 Warning: Collection may be modified during iteration. - Warning: Collection may be modified during iteration. + 警告: 反復処理中にコレクションが変更される可能性があります。 Add readonly modifier - Add readonly modifier + 読み取り専用修飾子を追加します Make field readonly - Make field readonly + フィールドを読み取り専用にします diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf index c4fb8ae61b942..c9bdfdade540a 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf @@ -1987,32 +1987,32 @@ This version used in: {2} Alias ambiguous type '{0}' - Alias ambiguous type '{0}' + 별칭 모호한 형식 '{0}' Warning: Collection was modified during iteration. - Warning: Collection was modified during iteration. + 경고: 반복 중 컬렉션이 수정되었습니다. Warning: Iteration variable crossed function boundary. - Warning: Iteration variable crossed function boundary. + 경고: 반복 변수가 함수 경계를 벗어났습니다. Warning: Collection may be modified during iteration. - Warning: Collection may be modified during iteration. + 경고: 반복 계산 중 컬렉션이 수정될 수 있습니다. Add readonly modifier - Add readonly modifier + 읽기 전용 한정자 추가 Make field readonly - Make field readonly + 필드를 읽기 전용으로 만들기 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf index 0dab9643b4646..8dcf685341b5e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf @@ -1987,32 +1987,32 @@ Ta wersja jest używana wersja: {2} Alias ambiguous type '{0}' - Alias ambiguous type '{0}' + Niejednoznaczny typ aliasu „{0}” Warning: Collection was modified during iteration. - Warning: Collection was modified during iteration. + Ostrzeżenie: kolekcja została zmodyfikowana podczas iteracji. Warning: Iteration variable crossed function boundary. - Warning: Iteration variable crossed function boundary. + Ostrzeżenie: zmienna iteracji przekroczyła granicę funkcji. Warning: Collection may be modified during iteration. - Warning: Collection may be modified during iteration. + Ostrzeżenie: kolekcja mogła zostać zmodyfikowana podczas iteracji. Add readonly modifier - Add readonly modifier + Dodaj modyfikator tylko do odczytu Make field readonly - Make field readonly + Ustaw pole jako tylko do odczytu diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf index 2f46cd49df4c5..762079f5db242 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf @@ -1987,32 +1987,32 @@ Essa versão é usada no: {2} Alias ambiguous type '{0}' - Alias ambiguous type '{0}' + Tipo de alias ambíguo '{0}' Warning: Collection was modified during iteration. - Warning: Collection was modified during iteration. + Aviso: a coleção foi modificada durante a iteração. Warning: Iteration variable crossed function boundary. - Warning: Iteration variable crossed function boundary. + Aviso: a variável de iteração passou o limite da função. Warning: Collection may be modified during iteration. - Warning: Collection may be modified during iteration. + Aviso: a coleção pode ser modificada durante a iteração. Add readonly modifier - Add readonly modifier + Adicionar modificador somente leitura Make field readonly - Make field readonly + Tornar campo somente leitura diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf index 13d6e0367c50b..163b4896ccd21 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf @@ -1987,32 +1987,32 @@ This version used in: {2} Alias ambiguous type '{0}' - Alias ambiguous type '{0}' + Неоднозначный тип псевдонима "{0}" Warning: Collection was modified during iteration. - Warning: Collection was modified during iteration. + Внимание! Коллекция изменена во время итерации. Warning: Iteration variable crossed function boundary. - Warning: Iteration variable crossed function boundary. + Внимание! Переменная итерации вышла за границу функции. Warning: Collection may be modified during iteration. - Warning: Collection may be modified during iteration. + Внимание! Коллекция может быть изменена во время итерации. Add readonly modifier - Add readonly modifier + Добавить модификатор только для чтения Make field readonly - Make field readonly + Сделать поле доступным только для чтения diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf index e90e3c40a7fcd..67bd88335406e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf @@ -1987,32 +1987,32 @@ Bu sürüm şurada kullanılır: {2} Alias ambiguous type '{0}' - Alias ambiguous type '{0}' + Diğer ad belirsiz '{0}' türünde Warning: Collection was modified during iteration. - Warning: Collection was modified during iteration. + Uyarı: Yineleme sırasında koleksiyon değiştirildi. Warning: Iteration variable crossed function boundary. - Warning: Iteration variable crossed function boundary. + Uyarı: Yineleme değişkeni, işlev sınırını geçti. Warning: Collection may be modified during iteration. - Warning: Collection may be modified during iteration. + Uyarı: Yineleme sırasında koleksiyon değiştirilebilir. Add readonly modifier - Add readonly modifier + Salt okunur değiştirici ekle Make field readonly - Make field readonly + Alanı salt okunur yap diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf index 632e5c89c0674..631a3bc035733 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf @@ -1987,32 +1987,32 @@ This version used in: {2} Alias ambiguous type '{0}' - Alias ambiguous type '{0}' + 别名多义类型“{0}” Warning: Collection was modified during iteration. - Warning: Collection was modified during iteration. + 警告: 迭代期间已修改集合。 Warning: Iteration variable crossed function boundary. - Warning: Iteration variable crossed function boundary. + 警告: 迭代变量跨函数边界。 Warning: Collection may be modified during iteration. - Warning: Collection may be modified during iteration. + 警告: 迭代期间可能修改集合。 Add readonly modifier - Add readonly modifier + 添加只读修饰符 Make field readonly - Make field readonly + 将字段设置为只读 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf index 7b983eef037c1..8f83a976ba05d 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf @@ -1987,32 +1987,32 @@ This version used in: {2} Alias ambiguous type '{0}' - Alias ambiguous type '{0}' + 別名不明確類型 '{0}' Warning: Collection was modified during iteration. - Warning: Collection was modified during iteration. + 警告: 集合已於反覆運算期間被修改 Warning: Iteration variable crossed function boundary. - Warning: Iteration variable crossed function boundary. + 警告: 反覆運算變數已跨越函式界線 Warning: Collection may be modified during iteration. - Warning: Collection may be modified during iteration. + 警告: 集合可能於反覆運算期間被修改 Add readonly modifier - Add readonly modifier + 新增唯讀修飾詞 Make field readonly - Make field readonly + 使欄位唯讀 diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.cs.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.cs.xlf index e0dbe7ad1723f..016f2aa5517bb 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.cs.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.cs.xlf @@ -1814,17 +1814,17 @@ Sub(<seznam_parametrů>) <výraz> Convert to 'Select Case' - Convert to 'Select Case' + Převést na Select Case Convert to 'For Each' - Convert to 'For Each' + Převést na For Each Convert to 'For' - Convert to 'For' + Převést na For diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.de.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.de.xlf index 92b344108b09c..cb6dc844d224e 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.de.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.de.xlf @@ -1814,17 +1814,17 @@ Sub(<Parameterliste>) <Ausdruck> Convert to 'Select Case' - Convert to 'Select Case' + In "Select Case" konvertieren Convert to 'For Each' - Convert to 'For Each' + In "For Each" konvertieren Convert to 'For' - Convert to 'For' + In "For" konvertieren diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.es.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.es.xlf index dfe5663a817a6..6d793a7fc68be 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.es.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.es.xlf @@ -1814,17 +1814,17 @@ Sub(<listaDeParámetros>) <instrucción> Convert to 'Select Case' - Convert to 'Select Case' + Convertir a "Select Case" Convert to 'For Each' - Convert to 'For Each' + Convertir a "For Each" Convert to 'For' - Convert to 'For' + Convertir a "For" diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.fr.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.fr.xlf index 58be65b9d111c..7c18ab050e8ed 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.fr.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.fr.xlf @@ -1814,17 +1814,17 @@ Sub(<parameterList>) <statement> Convert to 'Select Case' - Convert to 'Select Case' + Convertir en 'Select Case' Convert to 'For Each' - Convert to 'For Each' + Convertir en 'For Each' Convert to 'For' - Convert to 'For' + Convertir en 'For' diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.it.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.it.xlf index 9c7cf80e29821..acd6427c20b80 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.it.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.it.xlf @@ -1814,17 +1814,17 @@ Sub(<elencoParametri>) <istruzione> Convert to 'Select Case' - Convert to 'Select Case' + Converti in 'Select Case' Convert to 'For Each' - Convert to 'For Each' + Converti in 'For Each' Convert to 'For' - Convert to 'For' + Converti in 'For' diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ja.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ja.xlf index 8dd9d5eaa0104..02fa27382bc31 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ja.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ja.xlf @@ -1813,17 +1813,17 @@ Sub(<parameterList>) <statement> Convert to 'Select Case' - Convert to 'Select Case' + 'Select Case' に変換する Convert to 'For Each' - Convert to 'For Each' + 'For Each' に変換する Convert to 'For' - Convert to 'For' + 'For' に変換する diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ko.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ko.xlf index 6f8a382862f06..ceb01c61d86b0 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ko.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ko.xlf @@ -1814,17 +1814,17 @@ Sub(<parameterList>) <statement> Convert to 'Select Case' - Convert to 'Select Case' + 'Select Case'로 변환 Convert to 'For Each' - Convert to 'For Each' + 'For Each'로 변환 Convert to 'For' - Convert to 'For' + 'For'로 변환 diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pl.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pl.xlf index 8e0ac037420f0..473b30a44ef72 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pl.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pl.xlf @@ -1814,17 +1814,17 @@ Sub(<listaParametrów>) <instrukcja> Convert to 'Select Case' - Convert to 'Select Case' + Konwertuj na wyrażenie „Select Case” Convert to 'For Each' - Convert to 'For Each' + Konwertuj na wyrażenie „For Each” Convert to 'For' - Convert to 'For' + Konwertuj na wyrażenie „For” diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pt-BR.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pt-BR.xlf index 0880f129090a6..ed230d8c12021 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pt-BR.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pt-BR.xlf @@ -1814,17 +1814,17 @@ Sub(<parameterList>) <statement> Convert to 'Select Case' - Convert to 'Select Case' + Converter em 'Select Case' Convert to 'For Each' - Convert to 'For Each' + Converter em 'For Each' Convert to 'For' - Convert to 'For' + Converter em 'For' diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ru.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ru.xlf index bb1f6ace4df87..fdf84e5610b9d 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ru.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ru.xlf @@ -1814,17 +1814,17 @@ Sub(<parameterList>) <statement> Convert to 'Select Case' - Convert to 'Select Case' + Преобразовать в "Select Case" Convert to 'For Each' - Convert to 'For Each' + Преобразовать в "For Each" Convert to 'For' - Convert to 'For' + Преобразовать в "For" diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.tr.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.tr.xlf index 161958c5c1b68..1c94f25701318 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.tr.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.tr.xlf @@ -1814,17 +1814,17 @@ Sub(<parameterList>) <statement> Convert to 'Select Case' - Convert to 'Select Case' + 'Select Case' deyimine dönüştür Convert to 'For Each' - Convert to 'For Each' + 'For Each' deyimine dönüştür Convert to 'For' - Convert to 'For' + 'For' deyimine dönüştür diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hans.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hans.xlf index f98fb4e21bdfc..404d497c3604f 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hans.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hans.xlf @@ -1814,17 +1814,17 @@ Sub(<parameterList>) <statement> Convert to 'Select Case' - Convert to 'Select Case' + 转换为“Select Case” Convert to 'For Each' - Convert to 'For Each' + 转换为“For Each” Convert to 'For' - Convert to 'For' + 转换为“For” diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hant.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hant.xlf index e219785543500..15f2d4026061d 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hant.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hant.xlf @@ -1814,17 +1814,17 @@ Sub(<parameterList>) <statement> Convert to 'Select Case' - Convert to 'Select Case' + 轉換為 'Select Case' Convert to 'For Each' - Convert to 'For Each' + 轉換為 'For Each' Convert to 'For' - Convert to 'For' + 轉換為 'For' diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index 6e8919c8ed415..e140d3062e283 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -1498,19 +1498,19 @@ Souhlasím se všemi výše uvedenými podmínkami: Can't apply changes -- unexpected error: '{0}' - - Manage naming styles - Manage naming styles - - Field preferences: - Field preferences: + Předvolby pole: Prefer readonly - Prefer readonly + Upřednostnit jen pro čtení + + + + Manage naming styles + Manage naming styles diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index 12821fc5c596b..61b89a20942e2 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -1498,19 +1498,19 @@ Ich stimme allen vorstehenden Bedingungen zu: Can't apply changes -- unexpected error: '{0}' - - Manage naming styles - Manage naming styles - - Field preferences: - Field preferences: + Feldeinstellungen: Prefer readonly - Prefer readonly + Schreibgeschützte vorziehen + + + + Manage naming styles + Manage naming styles diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index 7cbf1f677bb8f..6e8c0a410a0c6 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -1498,19 +1498,19 @@ Estoy de acuerdo con todo lo anterior: Can't apply changes -- unexpected error: '{0}' - - Manage naming styles - Manage naming styles - - Field preferences: - Field preferences: + Preferencias de campo: Prefer readonly - Prefer readonly + Preferir solo lectura + + + + Manage naming styles + Manage naming styles diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index e2eb4a3d024ef..c60b06129f054 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -1498,19 +1498,19 @@ Je suis d'accord avec tout ce qui précède : Can't apply changes -- unexpected error: '{0}' - - Manage naming styles - Manage naming styles - - Field preferences: - Field preferences: + Préférences de champ : Prefer readonly - Prefer readonly + Préférer readonly + + + + Manage naming styles + Manage naming styles diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index e9f260f4c9a2b..acd371ab95f1c 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -1498,19 +1498,19 @@ L'utente accetta le condizioni sopra riportate: Can't apply changes -- unexpected error: '{0}' - - Manage naming styles - Manage naming styles - - Field preferences: - Field preferences: + Preferenze campi: Prefer readonly - Prefer readonly + Preferisci readonly + + + + Manage naming styles + Manage naming styles diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index 9c7693dac21c1..15006f66d0d4e 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -1498,19 +1498,19 @@ I agree to all of the foregoing: Can't apply changes -- unexpected error: '{0}' - - Manage naming styles - Manage naming styles - - Field preferences: - Field preferences: + フィールド設定: Prefer readonly - Prefer readonly + 読み取り専用を優先する + + + + Manage naming styles + Manage naming styles diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index 90f3ec5b49870..6aac710bcf2df 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -1498,19 +1498,19 @@ I agree to all of the foregoing: Can't apply changes -- unexpected error: '{0}' - - Manage naming styles - Manage naming styles - - Field preferences: - Field preferences: + 필드 기본 설정: Prefer readonly - Prefer readonly + 읽기 전용 기본 사용 + + + + Manage naming styles + Manage naming styles diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index ad76cf51963ed..246ccc147e5d1 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -1498,19 +1498,19 @@ Wyrażam zgodę na wszystkie następujące postanowienia: Can't apply changes -- unexpected error: '{0}' - - Manage naming styles - Manage naming styles - - Field preferences: - Field preferences: + Preferencje pola: Prefer readonly - Prefer readonly + Preferuj tylko do odczytu + + + + Manage naming styles + Manage naming styles diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index 11eedcb789b68..734453f3aa556 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -1498,19 +1498,19 @@ Eu concordo com todo o conteúdo supracitado: Can't apply changes -- unexpected error: '{0}' - - Manage naming styles - Manage naming styles - - Field preferences: - Field preferences: + Preferências de campo: Prefer readonly - Prefer readonly + Preferir somente leitura + + + + Manage naming styles + Manage naming styles diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index 6c22f78380501..8a798d068ed6f 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -1498,19 +1498,19 @@ I agree to all of the foregoing: Can't apply changes -- unexpected error: '{0}' - - Manage naming styles - Manage naming styles - - Field preferences: - Field preferences: + Предпочтения для полей: Prefer readonly - Prefer readonly + Предпочитать только для чтения + + + + Manage naming styles + Manage naming styles diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index 4d324b9f12caa..4f6e3f5211424 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -1498,19 +1498,19 @@ Aşağıdakilerin tümünü onaylıyorum: Can't apply changes -- unexpected error: '{0}' - - Manage naming styles - Manage naming styles - - Field preferences: - Field preferences: + Alan tercihleri: Prefer readonly - Prefer readonly + Salt okunur özelliğini tercih et + + + + Manage naming styles + Manage naming styles diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index 15a4fa5a06a64..26757af1982cd 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -1498,19 +1498,19 @@ I agree to all of the foregoing: Can't apply changes -- unexpected error: '{0}' - - Manage naming styles - Manage naming styles - - Field preferences: - Field preferences: + 字段首选项: Prefer readonly - Prefer readonly + 首选只读 + + + + Manage naming styles + Manage naming styles diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index 149647cb95680..36a63693efd15 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -1498,19 +1498,19 @@ I agree to all of the foregoing: Can't apply changes -- unexpected error: '{0}' - - Manage naming styles - Manage naming styles - - Field preferences: - Field preferences: + 欄位喜好設定: Prefer readonly - Prefer readonly + 偏好唯讀 + + + + Manage naming styles + Manage naming styles diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf index 9b89c605bdbcc..92f1e2dfb509e 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf @@ -799,7 +799,7 @@ Variables captured: - Variables captured: + Zachycené proměnné: diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf index f03d1482a03f0..d08d0641c00c6 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf @@ -799,7 +799,7 @@ Variables captured: - Variables captured: + Erfasste Variablen: diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf index f6d4b2cda19ec..453c56a7027ce 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf @@ -799,7 +799,7 @@ Variables captured: - Variables captured: + Variables capturadas: diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf index 55e9e200dab08..86e876e15b415 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf @@ -799,7 +799,7 @@ Variables captured: - Variables captured: + Variables capturées : diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf index 573cce32ba000..98356795f2404 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf @@ -799,7 +799,7 @@ Variables captured: - Variables captured: + Variabili acquisite: diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf index c962e1f563bc8..90310c17b4fc7 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf @@ -799,7 +799,7 @@ Variables captured: - Variables captured: + キャプチャされた変数: diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf index 9b4366aaef710..34b91d971c0f8 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf @@ -799,7 +799,7 @@ Variables captured: - Variables captured: + 캡처된 변수: diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf index c4927dc46c26a..757392fe54de6 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf @@ -799,7 +799,7 @@ Variables captured: - Variables captured: + Przechwycone zmienne: diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf index e0d6ff96f78b2..668bf6698c45b 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf @@ -799,7 +799,7 @@ Variables captured: - Variables captured: + Variáveis capturadas: diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf index 368c9db2b9261..66c6cd2723170 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf @@ -799,7 +799,7 @@ Variables captured: - Variables captured: + Записанные переменные: diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf index e15436682817a..6f2fe04e95a06 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf @@ -799,7 +799,7 @@ Variables captured: - Variables captured: + Toplanan değişkenler: diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf index fc8060d2f44f8..9220b88041cb4 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf @@ -799,7 +799,7 @@ Variables captured: - Variables captured: + 已捕获变量: diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf index 77f65e5f66866..b880785ee64c6 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf @@ -799,7 +799,7 @@ Variables captured: - Variables captured: + 已擷取的變數: From 1c33035b415858dadb812f44b7d6a058a0da8bb3 Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Thu, 12 Apr 2018 18:37:17 -0700 Subject: [PATCH 38/43] Localize error messages in test --- src/Compilers/Core/MSBuildTaskTests/MapSourceRootTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Compilers/Core/MSBuildTaskTests/MapSourceRootTests.cs b/src/Compilers/Core/MSBuildTaskTests/MapSourceRootTests.cs index c2d3f1419eb6e..a270bff727366 100644 --- a/src/Compilers/Core/MSBuildTaskTests/MapSourceRootTests.cs +++ b/src/Compilers/Core/MSBuildTaskTests/MapSourceRootTests.cs @@ -135,9 +135,9 @@ public void SourceRootPaths_EndWithSeparator() }; bool result = task.Execute(); - AssertEx.AssertEqualToleratingWhitespaceDifferences(@" -ERROR : SourceRoot paths are required to end with a slash or backslash: 'C:' -ERROR : SourceRoot paths are required to end with a slash or backslash: 'C' + AssertEx.AssertEqualToleratingWhitespaceDifferences($@" +ERROR : {string.Format(ErrorString.MapSourceRoots_PathMustEndWithSlashOrBackslash, "SourceRoot", "C:")} +ERROR : {string.Format(ErrorString.MapSourceRoots_PathMustEndWithSlashOrBackslash, "SourceRoot", "C")} ", engine.Log); Assert.False(result); From 31b2765f4f0aab2e4e34497154273b48576cd175 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Mon, 16 Apr 2018 15:11:49 -0700 Subject: [PATCH 39/43] Fix publish error --- src/Tools/MicroBuild/publish-assets.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tools/MicroBuild/publish-assets.ps1 b/src/Tools/MicroBuild/publish-assets.ps1 index 4fee9902b1c10..364a92d4d3ccb 100644 --- a/src/Tools/MicroBuild/publish-assets.ps1 +++ b/src/Tools/MicroBuild/publish-assets.ps1 @@ -40,7 +40,7 @@ function Publish-NuGet([string]$packageDir, [string]$uploadUrl) { try { Write-Host "Publishing $(Split-Path -leaf $packageDir) to $uploadUrl" $apiKey = Get-PublishKey $uploadUrl - foreach ($package in *.nupkg) { + foreach ($package in Get-ChildItem *.nupkg) { $nupkg = Split-Path -Leaf $package Write-Host " Publishing $nupkg" if (-not (Test-Path $nupkg)) { From c1452f14172b605057ebbd9d720e8d95985a8301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Thu, 19 Apr 2018 16:47:11 -0700 Subject: [PATCH 40/43] Fixes mapping of active statement when changing ctor body from block to expression (#26216) * Fixes mapping of active statement when changing ctor body from block to expression * Fix GetAllAddedSymbolsAsync. - Recover from unexpected exceptions. - Ignore documents that do not belong to the project being emitted during EnC (these could be e.g. speculative documents created by code fix preview). Change fields of DocumentAnalysisResults to properties to workaround a bug in the VIL that causes evaluation to fail on them, thus making it hard to see the values while debugging Roslyn. --- .../Portable/InternalUtilities/FatalError.cs | 15 ++++++ .../ActiveStatementTests.Methods.cs | 52 +++++++++++++++++++ .../CSharpEditAndContinueAnalyzer.cs | 2 +- .../DocumentAnalysisResults.cs | 10 ++-- .../Portable/EditAndContinue/EditSession.cs | 52 ++++++++++++------- 5 files changed, 106 insertions(+), 25 deletions(-) diff --git a/src/Compilers/Core/Portable/InternalUtilities/FatalError.cs b/src/Compilers/Core/Portable/InternalUtilities/FatalError.cs index 806915fc5b018..d672714ad617e 100644 --- a/src/Compilers/Core/Portable/InternalUtilities/FatalError.cs +++ b/src/Compilers/Core/Portable/InternalUtilities/FatalError.cs @@ -158,6 +158,21 @@ public static bool ReportWithoutCrashAndPropagate(Exception exception) return false; } + /// + /// Report a non-fatal error like but propagates the exception. + /// + /// False to propagate the exception. + [DebuggerHidden] + public static bool ReportWithoutCrashUnlessCanceledAndPropagate(Exception exception) + { + if (!(exception is OperationCanceledException)) + { + Report(exception, s_nonFatalHandler); + } + + return false; + } + private static object s_reportedMarker = new object(); private static void Report(Exception exception, Action handler) diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.Methods.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.Methods.cs index d143ba7799935..cf92ca145fc4f 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.Methods.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.Methods.cs @@ -435,6 +435,58 @@ static void Main(string[] args) #endregion + #region Constuctors + + [Fact] + public void Constructor_ExpressionBodyToBlockBody1() + { + var src1 = "class C { int x; C() => x = 1; }"; + var src2 = "class C { int x; C() { x = 1; } }"; + + var edits = GetTopEdits(src1, src2); + var active = GetActiveStatements(src1, src2); + + edits.VerifyRudeDiagnostics(active); + } + + [Fact] + public void Constructor_BlockBodyToExpressionBody1() + { + var src1 = "class C { int x; C() { x = 1; } }"; + var src2 = "class C { int x; C() => x = 1; }"; + + var edits = GetTopEdits(src1, src2); + var active = GetActiveStatements(src1, src2); + + edits.VerifyRudeDiagnostics(active); + } + + [Fact] + public void Constructor_BlockBodyToExpressionBody2() + { + var src1 = "class C { int x; C() { x = 1; } }"; + var src2 = "class C { int x; C() => x = 1; }"; + + var edits = GetTopEdits(src1, src2); + var active = GetActiveStatements(src1, src2); + + edits.VerifyRudeDiagnostics(active); + } + + [Fact] + public void Constructor_BlockBodyToExpressionBody3() + { + var src1 = "class C { int x; C() : base() { x = 1; } }"; + var src2 = "class C { int x; C() => x = 1; }"; + + var edits = GetTopEdits(src1, src2); + var active = GetActiveStatements(src1, src2); + + edits.VerifyRudeDiagnostics(active); + } + + #endregion + #region Properties [Fact] diff --git a/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs b/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs index 72bc6642b1a52..73a8c4bf11522 100644 --- a/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs +++ b/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs @@ -566,7 +566,7 @@ protected override bool TryMatchActiveStatement( case SyntaxKind.ThisConstructorInitializer: case SyntaxKind.BaseConstructorInitializer: case SyntaxKind.ConstructorDeclaration: - var newConstructor = (ConstructorDeclarationSyntax)newBody.Parent; + var newConstructor = (ConstructorDeclarationSyntax)(newBody.Parent.IsKind(SyntaxKind.ArrowExpressionClause) ? newBody.Parent.Parent : newBody.Parent); newStatement = (SyntaxNode)newConstructor.Initializer ?? newConstructor; return true; diff --git a/src/Features/Core/Portable/EditAndContinue/DocumentAnalysisResults.cs b/src/Features/Core/Portable/EditAndContinue/DocumentAnalysisResults.cs index 74226fbf00d34..5cbc9bbf2866c 100644 --- a/src/Features/Core/Portable/EditAndContinue/DocumentAnalysisResults.cs +++ b/src/Features/Core/Portable/EditAndContinue/DocumentAnalysisResults.cs @@ -13,19 +13,19 @@ internal sealed class DocumentAnalysisResults /// /// Spans of active statements in the document, or null if the document has syntax errors. /// - public readonly ImmutableArray ActiveStatements; + public ImmutableArray ActiveStatements { get; } /// /// Diagnostics for rude edits in the document, or null if the document is unchanged or has syntax errors. /// If the compilation has semantic errors only syntactic rude edits are calculated. /// - public readonly ImmutableArray RudeEditErrors; + public ImmutableArray RudeEditErrors { get; } /// /// Edits made in the document, or null if the document is unchanged, has syntax errors, has rude edits, /// or if the compilation has semantic errors. /// - public readonly ImmutableArray SemanticEdits; + public ImmutableArray SemanticEdits { get; } /// /// Exception regions -- spans of catch and finally handlers that surround the active statements. @@ -48,7 +48,7 @@ internal sealed class DocumentAnalysisResults /// try { } |finally { try { } catch { ... AS ... } }| /// try { try { } |finally { ... AS ... }| } |catch { } catch { } finally { }| /// - public readonly ImmutableArray> ExceptionRegions; + public ImmutableArray> ExceptionRegions { get; } /// /// Line edits in the document, or null if the document has syntax errors or rude edits, @@ -57,7 +57,7 @@ internal sealed class DocumentAnalysisResults /// /// Sorted by /// - public readonly ImmutableArray LineEdits; + public ImmutableArray LineEdits { get; } /// /// The compilation has compilation errors (syntactic or semantic), diff --git a/src/Features/Core/Portable/EditAndContinue/EditSession.cs b/src/Features/Core/Portable/EditAndContinue/EditSession.cs index 1777a85ee2208..117bed0999b15 100644 --- a/src/Features/Core/Portable/EditAndContinue/EditSession.cs +++ b/src/Features/Core/Portable/EditAndContinue/EditSession.cs @@ -281,33 +281,47 @@ internal bool HasProject(ProjectId id) return result; } - private async Task> GetAllAddedSymbols(CancellationToken cancellationToken) + private async Task> GetAllAddedSymbolsAsync(Project project, CancellationToken cancellationToken) { - Analysis[] analyses; - lock (_analysesGuard) + try { - analyses = _analyses.Values.ToArray(); - } + Analysis[] analyses; + lock (_analysesGuard) + { + analyses = _analyses.Values.ToArray(); + } - HashSet addedSymbols = null; - foreach (var analysis in analyses) - { - var results = await analysis.Results.GetValueAsync(cancellationToken).ConfigureAwait(false); - foreach (var edit in results.SemanticEdits) + HashSet addedSymbols = null; + foreach (var analysis in analyses) { - if (edit.Kind == SemanticEditKind.Insert) + // Only consider analyses for documents that belong the currently analyzed project. + if (analysis.Document.Project == project) { - if (addedSymbols == null) + var results = await analysis.Results.GetValueAsync(cancellationToken).ConfigureAwait(false); + if (!results.HasChangesAndErrors) { - addedSymbols = new HashSet(); + foreach (var edit in results.SemanticEdits) + { + if (edit.Kind == SemanticEditKind.Insert) + { + if (addedSymbols == null) + { + addedSymbols = new HashSet(); + } + + addedSymbols.Add(edit.NewSymbol); + } + } } - - addedSymbols.Add(edit.NewSymbol); } } - } - return addedSymbols; + return addedSymbols; + } + catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceledAndPropagate(e)) + { + throw ExceptionUtilities.Unreachable; + } } public AsyncLazy GetDocumentAnalysis(Document document) @@ -473,7 +487,7 @@ private async Task GetProjectChangesAsync(Project project, Cance return new ProjectChanges(allEdits.ToImmutableAndFree(), allLineEdits.ToImmutableAndFree(), allActiveStatements.ToImmutableAndFree()); } - catch (Exception e) when (FatalError.ReportUnlessCanceled(e)) + catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceledAndPropagate(e)) { throw ExceptionUtilities.Unreachable; } @@ -487,7 +501,7 @@ public async Task EmitProjectDeltaAsync(Project project, EmitBaseline ba var projectChanges = await GetProjectChangesAsync(project, cancellationToken).ConfigureAwait(false); var currentCompilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); - var allAddedSymbols = await GetAllAddedSymbols(cancellationToken).ConfigureAwait(false); + var allAddedSymbols = await GetAllAddedSymbolsAsync(project, cancellationToken).ConfigureAwait(false); var baseActiveStatements = await BaseActiveStatements.GetValueAsync(cancellationToken).ConfigureAwait(false); var baseActiveExceptionRegions = await BaseActiveExceptionRegions.GetValueAsync(cancellationToken).ConfigureAwait(false); From 689cba79871e67f96f3f8b3143cd829b0087fd15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbyn=C4=9Bk=20Sailer?= Date: Thu, 26 Apr 2018 14:07:19 +0200 Subject: [PATCH 41/43] LOC CHECKIN | dotnet/roslyn dev15.7.x-vs-deps | 20180426 --- .../Portable/xlf/CSharpResources.cs.xlf | 2 +- .../Portable/xlf/CSharpResources.de.xlf | 2 +- .../Portable/xlf/CSharpResources.es.xlf | 2 +- .../Portable/xlf/CSharpResources.fr.xlf | 2 +- .../Portable/xlf/CSharpResources.it.xlf | 2 +- .../Portable/xlf/CSharpResources.ja.xlf | 204 +++++++++--------- .../Portable/xlf/CSharpResources.ko.xlf | 4 +- .../Portable/xlf/CSharpResources.pl.xlf | 4 +- .../Portable/xlf/CSharpResources.pt-BR.xlf | 2 +- .../Portable/xlf/CSharpResources.ru.xlf | 2 +- .../Portable/xlf/CSharpResources.tr.xlf | 2 +- .../Portable/xlf/CSharpResources.zh-Hans.xlf | 2 +- .../Portable/xlf/CSharpResources.zh-Hant.xlf | 2 +- .../Core/xlf/EditorFeaturesResources.cs.xlf | 26 +-- .../Core/xlf/EditorFeaturesResources.de.xlf | 26 +-- .../Core/xlf/EditorFeaturesResources.es.xlf | 26 +-- .../Core/xlf/EditorFeaturesResources.fr.xlf | 26 +-- .../Core/xlf/EditorFeaturesResources.it.xlf | 26 +-- .../Core/xlf/EditorFeaturesResources.ja.xlf | 26 +-- .../Core/xlf/EditorFeaturesResources.ko.xlf | 26 +-- .../Core/xlf/EditorFeaturesResources.pl.xlf | 26 +-- .../xlf/EditorFeaturesResources.pt-BR.xlf | 26 +-- .../Core/xlf/EditorFeaturesResources.ru.xlf | 26 +-- .../Core/xlf/EditorFeaturesResources.tr.xlf | 26 +-- .../xlf/EditorFeaturesResources.zh-Hans.xlf | 26 +-- .../xlf/EditorFeaturesResources.zh-Hant.xlf | 26 +-- .../VisualBasic/xlf/VBEditorResources.cs.xlf | 2 +- .../VisualBasic/xlf/VBEditorResources.de.xlf | 2 +- .../VisualBasic/xlf/VBEditorResources.es.xlf | 2 +- .../VisualBasic/xlf/VBEditorResources.fr.xlf | 2 +- .../VisualBasic/xlf/VBEditorResources.it.xlf | 2 +- .../VisualBasic/xlf/VBEditorResources.ja.xlf | 2 +- .../VisualBasic/xlf/VBEditorResources.ko.xlf | 2 +- .../VisualBasic/xlf/VBEditorResources.pl.xlf | 2 +- .../xlf/VBEditorResources.pt-BR.xlf | 2 +- .../VisualBasic/xlf/VBEditorResources.ru.xlf | 2 +- .../VisualBasic/xlf/VBEditorResources.tr.xlf | 2 +- .../xlf/VBEditorResources.zh-Hans.xlf | 2 +- .../xlf/VBEditorResources.zh-Hant.xlf | 2 +- .../CSharp/Impl/xlf/CSharpVSResources.cs.xlf | 2 +- .../CSharp/Impl/xlf/CSharpVSResources.de.xlf | 2 +- .../CSharp/Impl/xlf/CSharpVSResources.es.xlf | 2 +- .../CSharp/Impl/xlf/CSharpVSResources.fr.xlf | 2 +- .../CSharp/Impl/xlf/CSharpVSResources.it.xlf | 2 +- .../CSharp/Impl/xlf/CSharpVSResources.ja.xlf | 2 +- .../CSharp/Impl/xlf/CSharpVSResources.ko.xlf | 2 +- .../CSharp/Impl/xlf/CSharpVSResources.pl.xlf | 2 +- .../Impl/xlf/CSharpVSResources.pt-BR.xlf | 2 +- .../CSharp/Impl/xlf/CSharpVSResources.ru.xlf | 2 +- .../CSharp/Impl/xlf/CSharpVSResources.tr.xlf | 2 +- .../Impl/xlf/CSharpVSResources.zh-Hans.xlf | 2 +- .../Impl/xlf/CSharpVSResources.zh-Hant.xlf | 2 +- .../Core/Def/xlf/ServicesVSResources.cs.xlf | 8 +- .../Core/Def/xlf/ServicesVSResources.de.xlf | 10 +- .../Core/Def/xlf/ServicesVSResources.es.xlf | 8 +- .../Core/Def/xlf/ServicesVSResources.fr.xlf | 8 +- .../Core/Def/xlf/ServicesVSResources.it.xlf | 8 +- .../Core/Def/xlf/ServicesVSResources.ja.xlf | 8 +- .../Core/Def/xlf/ServicesVSResources.ko.xlf | 8 +- .../Core/Def/xlf/ServicesVSResources.pl.xlf | 8 +- .../Def/xlf/ServicesVSResources.pt-BR.xlf | 8 +- .../Core/Def/xlf/ServicesVSResources.ru.xlf | 8 +- .../Core/Def/xlf/ServicesVSResources.tr.xlf | 8 +- .../Def/xlf/ServicesVSResources.zh-Hans.xlf | 8 +- .../Def/xlf/ServicesVSResources.zh-Hant.xlf | 8 +- 65 files changed, 364 insertions(+), 364 deletions(-) diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf index faab716986998..840ca65d955a0 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf @@ -8687,7 +8687,7 @@ Pokud chcete odstranit toto varování, můžete místo toho použít /reference The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - Typ {2} nesmí být typ odkazu a ani v žádné úrovni vnoření nesmí obsahovat pole typu odkazu, aby se dal použít jako parametr {1} v obecném typu nebo metodě {0}. + Typ {2} nesmí být typ, který povoluje hodnotu null, ani nesmí v žádné úrovni vnoření obsahovat pole, které by ji povolovalo, aby se dal použít jako parametr {1} v obecném typu nebo metodě {0}. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf index db21aee2ce182..0c0802f96616b 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf @@ -8687,7 +8687,7 @@ Um die Warnung zu beheben, können Sie stattdessen /reference verwenden (Einbett The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - Der Typ "{2}" kann kein Verweistyp sein oder Verweistypfelder auf einer beliebigen Schachtelungsebene enthalten, damit er als Parameter "{1}" im generischen Typ oder der Methode "{0}" verwendet werden kann. + Der Typ "{2}" darf, ebenso wie sämtliche Felder auf jeder Schachtelungsebene, keine NULL-Werte zulassen, wenn er als {1}-Parameter im generischen Typ oder in der generischen Methode "{0}" verwendet werden soll. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf index 627f0eebc282c..eed962a0bd5ac 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf @@ -8687,7 +8687,7 @@ Para eliminar la advertencia puede usar /reference (establezca la propiedad Embe The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - El tipo "{2}" no puede ser un tipo de referencia ni contener campos de un tipo de referencia a cualquier nivel de anidado, a fin de usarlo como parámetro "{1}" en el tipo o método genérico "{0}" + "{2}" debe ser un tipo de valor que no acepta valores NULL, junto con todos los campos de cualquier nivel de anidamiento, para poder usarlo como parámetro "{1}" en el tipo o método genérico "{0}" diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf index ebf7bcdfe6cf2..1d13d92e331ff 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf @@ -8687,7 +8687,7 @@ Pour supprimer l'avertissement, vous pouvez utiliser la commande /reference (dé The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - Le type '{2}' ne doit pas être un type référence, ou contenir des champs de type référence à l'un des niveaux d'imbrication, pour pouvoir être utilisé en tant que paramètre '{1}' dans le type ou la méthode générique '{0}' + Le type '{2}' ne doit pas être un type valeur Nullable, ainsi que l'ensemble des champs à tous les niveaux d'imbrication, pour pouvoir être utilisé en tant que paramètre '{1}' dans le type ou la méthode générique '{0}' diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf index af2c9f2eff72f..61152e0396cc1 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf @@ -8687,7 +8687,7 @@ Per rimuovere l'avviso, è invece possibile usare /reference (impostare la propr The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - Il tipo '{2}' non può essere un tipo riferimento o contenere campi di tipo riferimento a qualsiasi livello di annidamento per poterlo usare come parametro '{1}' nel metodo o nel tipo generico '{0}' + Il tipo '{2}' deve essere un tipo valore non nullable, unitamente a tutti i campi a ogni livello di annidamento, per poter essere usato come parametro '{1}' nel tipo o metodo generico '{0}' diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf index 133c9de8de951..828ac18075822 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf @@ -1444,12 +1444,12 @@ A field initializer cannot reference the non-static field, method, or property '{0}' - フィールド初期化子は、静的でないフィールド、メソッド、またはプロパティ '{0}' を参照できません + フィールド初期化子は、静的でないフィールド、メソッド、プロパティ '{0}' を参照できません '{0}' cannot be sealed because it is not an override - 'override ではないため、'{0}' をシールドにすることはできません。 + override ではないため、'{0}' をシールドにすることはできません。 @@ -1464,17 +1464,17 @@ The Conditional attribute is not valid on '{0}' because it is an override method - 条件付き属性はオーバーライド メソッドであるため、 '{0}' では無効です + 条件付き属性はオーバーライド メソッドであるため、'{0}' では無効です Neither 'is' nor 'as' is valid on pointer types - is' と 'as' のどちらもポインター型では無効です + 'is' と 'as' のどちらもポインター型では無効です Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available. - デストラクター と object.Finalize を直接呼び出すことはできません。使用可能であれば IDisposable.Dispose を呼び出してください。 + デストラクターと object.Finalize を直接呼び出すことはできません。使用可能であれば IDisposable.Dispose を呼び出してください。 @@ -1554,27 +1554,27 @@ Partial declarations of '{0}' must be all classes, all structs, or all interfaces - {0}' の partial 宣言は、すべてのクラス、すべての構造体、またはすべてのインターフェイスにする必要があります。 + '{0}' の partial 宣言は、すべてのクラス、すべての構造体、すべてのインターフェイスにする必要があります。 Partial declarations of '{0}' have conflicting accessibility modifiers - {0}' の partial 宣言には競合するアクセシビリティ修飾子が含まれています。 + '{0}' の partial 宣言には競合するアクセシビリティ修飾子が含まれています。 Partial declarations of '{0}' must not specify different base classes - {0}' の partial 宣言では、異なる基底クラスを指定してはいけません。 + '{0}' の partial 宣言では、異なる基底クラスを指定してはなりません。 Partial declarations of '{0}' must have the same type parameter names in the same order - {0}' の partial 宣言では、同じ型パラメーター名を同じ順序で指定しなければなりません。 + '{0}' の partial 宣言では、同じ型パラメーター名を同じ順序で指定しなければなりません。 Partial declarations of '{0}' have inconsistent constraints for type parameter '{1}' - {0}' の partial 宣言には、型パラメーター '{1}' に対して矛盾する制約が含まれています。 + '{0}' の partial 宣言には、型パラメーター '{1}' に対して矛盾する制約が含まれています。 @@ -1584,7 +1584,7 @@ The 'partial' modifier can only appear immediately before 'class', 'struct', 'interface', or 'void' - partial' 識別子は、'class'、'struct'、'interface'、または 'void' の直前にのみ指定できます + 'partial' 識別子は、'class'、'struct'、'interface'、'void' の直前にのみ指定できます @@ -1614,7 +1614,7 @@ The accessibility modifier of the '{0}' accessor must be more restrictive than the property or indexer '{1}' - {0}' アクセサーのアクセシビリティ修飾子は、プロパティまたはインデクサー '{1}' よりも制限されていなければなりません。 + '{0}' アクセサーのアクセシビリティ修飾子は、プロパティまたはインデクサー '{1}' よりも制限されていなければなりません。 @@ -1799,7 +1799,7 @@ Ref mismatch between '{0}' and delegate '{1}' - {0}' とデリゲート '{1}' で参照が一致しません + '{0}' とデリゲート '{1}' で参照が一致しません @@ -1834,7 +1834,7 @@ The '{0}' attribute is valid only on an indexer that is not an explicit interface member declaration - {0}' 属性は、明示的なインターフェイス メンバー宣言ではないインデクサー上でのみ有効です。 + '{0}' 属性は、明示的なインターフェイス メンバー宣言ではないインデクサー上でのみ有効です。 @@ -1854,7 +1854,7 @@ Ambiguous reference in cref attribute: '{0}'. Assuming '{1}', but could have also matched other overloads including '{2}'. - {0}' は cref 属性内のあいまいな参照です。'{1}' を仮定しますが、'{2}' を含む別のオーバーロードに一致した可能性もあります。 + '{0}' は cref 属性内のあいまいな参照です。'{1}' を仮定しますが、'{2}' を含む別のオーバーロードに一致した可能性もあります。 @@ -1879,7 +1879,7 @@ Since '{1}' has the ComImport attribute, '{0}' must be extern or abstract - {1}' は ComImport 属性を含むため、'{0}' は extern または abstract にする必要があります。 + '{1}' は ComImport 属性を含むため、'{0}' は extern または abstract にする必要があります。 @@ -1929,12 +1929,12 @@ The namespace '{1}' in '{0}' conflicts with the type '{3}' in '{2}' - {0}' の名前空間 '{1}' が '{2}' の型 '{3}' と競合しています。 + '{0}' の名前空間 '{1}' が '{2}' の型 '{3}' と競合しています。 The namespace '{1}' in '{0}' conflicts with the imported type '{3}' in '{2}'. Using the namespace defined in '{0}'. - {0}' の名前空間 '{1}' は、'{2}' のインポートされた型 '{3}' と競合しています。'{0}' で定義された名前空間を使用しています。 + '{0}' の名前空間 '{1}' は、'{2}' のインポートされた型 '{3}' と競合しています。'{0}' で定義された名前空間を使用しています。 @@ -1944,7 +1944,7 @@ The type '{1}' in '{0}' conflicts with the imported type '{3}' in '{2}'. Using the type defined in '{0}'. - {0}' の型 '{1}' は、'{2}' のインポートされた型 '{3}' と競合しています。'{0}' で定義された型を使用しています。 + '{0}' の型 '{1}' は、'{2}' のインポートされた型 '{3}' と競合しています。'{0}' で定義された型を使用しています。 @@ -1954,7 +1954,7 @@ The type '{1}' in '{0}' conflicts with the imported namespace '{3}' in '{2}'. Using the type defined in '{0}'. - {0}' の型 '{1}' は、'{2}' のインポートされた名前空間 '{3}' と競合しています。'{0}' で定義された型を使用しています。 + '{0}' の型 '{1}' は、'{2}' のインポートされた名前空間 '{3}' と競合しています。'{0}' で定義された型を使用しています。 @@ -1964,7 +1964,7 @@ The type '{1}' in '{0}' conflicts with the namespace '{3}' in '{2}' - {0}' の型 '{1}' が '{2}' の名前空間 '{3}' と競合しています。 + '{0}' の型 '{1}' が '{2}' の名前空間 '{3}' と競合しています。 @@ -2039,7 +2039,7 @@ Circular constraint dependency involving '{0}' and '{1}' - {0}' と '{1}' を含む、循環制約の依存関係です。 + '{0}' と '{1}' を含む、循環制約の依存関係です。 @@ -2054,7 +2054,7 @@ Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}' - {2}' から '{3}' へ変換するときの、あいまいなユーザー定義の変換 '{0}' および '{1}' です + '{2}' から '{3}' へ変換するときの、あいまいなユーザー定義の変換 '{0}' および '{1}' です @@ -3703,7 +3703,7 @@ If such a class is used as a base class and if the deriving class defines a dest Cannot use more than one type in a for, using, fixed, or declaration statement - for、using、fixed または declaration ステートメント に 1 つ以上の型を使用することはできません。 + for、using、fixed または declaration ステートメントに 1 つ以上の型を使用することはできません。 @@ -3927,12 +3927,12 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Invalid expression term '{0}' - {0}' は無効です。 + '{0}' は無効です。 A new expression requires (), [], or {} after type - new 式は型の後に丸かっこ ()、角かっこ []、または 波かっこ {} を必要とします。 + new 式は型の後に丸かっこ ()、角かっこ []、または波かっこ {} を必要とします。 @@ -3972,7 +3972,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Cannot access protected member '{0}' via a qualifier of type '{1}'; the qualifier must be of type '{2}' (or derived from it) - {1}' 型の修飾子をとおしてプロテクト メンバー '{0}' にアクセスすることはできません。修飾子は '{2}' 型、またはそれから派生したものでなければなりません + '{1}' 型の修飾子をとおしてプロテクト メンバー '{0}' にアクセスすることはできません。修飾子は '{2}' 型、またはそれから派生したものでなければなりません @@ -4017,7 +4017,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 '{0}' specified for Main method must be a valid non-generic class or struct - 'Main メソッドに指定された '{0}' は有効な非ジェネリックのクラスか構造体でなければなりません。 + Main メソッドに指定された '{0}' は有効な非ジェネリックのクラスか構造体でなければなりません。 @@ -4027,7 +4027,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Cannot use '{0}' for Main method because it is imported - {0}' はインポートされているため、Main メソッドに対して使うことはできません。 + '{0}' はインポートされているため、Main メソッドに対して使うことはできません。 @@ -4047,7 +4047,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Error reading resource '{0}' -- '{1}' - リソース '{0}' を読み込み中にエラーが発生しました -- '{1}' + リソース '{0}' を読み取り中にエラーが発生しました -- '{1}' @@ -4087,7 +4087,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 XML comment on '{1}' has a paramref tag for '{0}', but there is no parameter by that name - {1}' の XML コメントで、'{0}' の paramref タグが存在しますが、その名前に相当するパラメーターはありません。 + '{1}' の XML コメントで、'{0}' の paramref タグが存在しますが、その名前に相当するパラメーターはありません。 @@ -4167,7 +4167,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Error reading Win32 resources -- {0} - Win32 リソースの読み込み中にエラーが発生しました -- {0} + Win32 リソースの読み取り中にエラーが発生しました -- {0} @@ -4277,7 +4277,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Cannot use '{0}' as a ref or out value because it is read-only - {0}' は読み取り専用なので、ref 値または out 値として使用できません + '{0}' は読み取り専用なので、ref 値または out 値として使用できません @@ -4337,7 +4337,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Cannot create delegate with '{0}' because it or a method it overrides has a Conditional attribute - {0}' またはオーバーライドされるメソッドは条件付き属性なので、この属性でデリゲートを作成できません。 + '{0}' またはオーバーライドされるメソッドは条件付き属性なので、この属性でデリゲートを作成できません。 @@ -4367,7 +4367,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 The body of '{0}' cannot be an iterator block because '{1}' is not an iterator interface type - {1}' は反復子インターフェイス型ではないため、'{0}' の本体は反復子ブロックにできません。 + '{1}' は反復子インターフェイス型ではないため、'{0}' の本体は反復子ブロックにできません。 @@ -4452,7 +4452,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 foreach statement cannot operate on variables of type '{0}' because it implements multiple instantiations of '{1}'; try casting to a specific interface instantiation - {1}' の複数のインスタンスを実装するため、foreach ステートメントは、型 '{0}' の変数では操作できません。特定のインターフェイスのインスタンス化にキャストしてください。 + '{1}' の複数のインスタンスを実装するため、foreach ステートメントは、型 '{0}' の変数では操作できません。特定のインターフェイスのインスタンス化にキャストしてください。 @@ -4547,22 +4547,22 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Cannot modify members of '{0}' because it is a '{1}' - {0}' のメンバーは '{1}' であるため変更できません + '{0}' のメンバーは '{1}' であるため変更できません Cannot use fields of '{0}' as a ref or out value because it is a '{1}' - {0}' は '{1}' であるため、そのフィールドを ref 値または out 値として使用することはできません + '{0}' は '{1}' であるため、そのフィールドを ref 値または out 値として使用することはできません Cannot assign to '{0}' because it is a '{1}' - {0}' は '{1}' であるため、これに割り当てることはできません。 + '{0}' は '{1}' であるため、これに割り当てることはできません。 Cannot use '{0}' as a ref or out value because it is a '{1}' - {0}' は '{1}' であるため、ref 値または out 値として使用することはできません + '{0}' は '{1}' であるため、ref 値または out 値として使用することはできません @@ -4632,7 +4632,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Invalid search path '{0}' specified in '{1}' -- '{2}' - {1}' で指定された無効な検索パス '{0}' です -- '{2}' + '{1}' で指定された無効な検索パス '{0}' です -- '{2}' @@ -4822,7 +4822,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Different checksum values given for '{0}' - {0}' に異なるチェックサム値が指定されています。 + '{0}' に異なるチェックサム値が指定されています。 @@ -4847,7 +4847,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Assuming assembly reference '{0}' used by '{1}' matches identity '{2}' of '{3}', you may need to supply runtime policy - {1}' によって使用されるアセンブリ参照 '{0}' が '{3}' の ID '{2}' と一致すると仮定して、実行時ポリシーを指定する必要がある可能性があります。 + '{1}' によって使用されるアセンブリ参照 '{0}' が '{3}' の ID '{2}' と一致すると仮定して、実行時ポリシーを指定する必要がある可能性があります。 @@ -4862,7 +4862,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Assuming assembly reference '{0}' used by '{1}' matches identity '{2}' of '{3}', you may need to supply runtime policy - {1}' によって使用されるアセンブリ参照 '{0}' が '{3}' の ID '{2}' と一致すると仮定して、実行時ポリシーを指定する必要がある可能性があります。 + '{1}' によって使用されるアセンブリ参照 '{0}' が '{3}' の ID '{2}' と一致すると仮定して、実行時ポリシーを指定する必要がある可能性があります。 @@ -4917,7 +4917,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 XML comment on '{1}' has a typeparamref tag for '{0}', but there is no type parameter by that name - {1}' の XML コメントで、'{0}' の typeparamref タグがありますが、その名前に相当するパラメーターはありません。 + '{1}' の XML コメントで、'{0}' の typeparamref タグがありますが、その名前に相当するパラメーターはありません。 @@ -4972,12 +4972,12 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 Expression will always cause a System.NullReferenceException because the default value of '{0}' is null - {0}' の既定値が Null であるため、式は常に System.NullReferenceException になります。 + '{0}' の既定値が Null であるため、式は常に System.NullReferenceException になります。 Expression will always cause a System.NullReferenceException because the type's default value is null - 型の規定値が null であるため、式は常に System.NullReferenceException になります + 型の既定値が null であるため、式は常に System.NullReferenceException になります @@ -5102,7 +5102,7 @@ AssemblyInfo.cs ファイルで RuntimeCompatibilityAttribute が false に設 The best overloaded method match for '{0}' has wrong signature for the initializer element. The initializable Add must be an accessible instance method. - {0}' に最も適しているオーバーロード メソッドには、初期化子要素の正しくないシグネチャが含まれます。初期化可能な Add は、アクセス可能なインスタンス メソッドでなければなりません。 + '{0}' に最も適しているオーバーロード メソッドには、初期化子要素の正しくないシグネチャが含まれます。初期化可能な Add は、アクセス可能なインスタンス メソッドでなければなりません。 @@ -5315,12 +5315,12 @@ C# では out と ref を区別しますが、CLR では同じと認識します Missing file specification for '{0}' option - {0}' オプションのファイルが指定されていません。 + '{0}' オプションのファイルが指定されていません。 Command-line syntax error: Missing '{0}' for '{1}' option - コマンドラインの構文エラー: オプション '{1}' の '{0}' がありません。 + コマンドラインの構文エラー: オプション '{1}' の '{0}' がありません。 @@ -5400,7 +5400,7 @@ C# では out と ref を区別しますが、CLR では同じと認識します Invalid file section alignment '{0}' - {0}' は無効なファイル セクションの配置です。 + '{0}' は無効なファイル セクションの配置です。 @@ -5485,7 +5485,7 @@ C# では out と ref を区別しますが、CLR では同じと認識します Return type of '{0}' is not CLS-compliant - {0}' の戻り値の型は CLS に準拠していません。 + '{0}' の戻り値の型は CLS に準拠していません。 @@ -5495,7 +5495,7 @@ C# では out と ref を区別しますが、CLR では同じと認識します Type of '{0}' is not CLS-compliant - {0}' の型は CLS に準拠していません。 + '{0}' の型は CLS に準拠していません。 @@ -5505,7 +5505,7 @@ C# では out と ref を区別しますが、CLR では同じと認識します A public, protected, or protected internal variable must be of a type that is compliant with the Common Language Specification (CLS). - public、protected、または protected internal 変数は、 共通言語仕様 (CLS) に準拠した型である必要があります。 + public、protected、または protected internal 変数は、共通言語仕様 (CLS) に準拠した型である必要があります。 @@ -5610,7 +5610,7 @@ C# では out と ref を区別しますが、CLR では同じと認識します '{0}' cannot be marked as CLS-compliant because the assembly does not have a CLSCompliant attribute - 'アセンブリには属性 CLSCompliant がないため、'{0}' をCLS 準拠として設定できません。 + アセンブリには属性 CLSCompliant がないため、'{0}' を CLS 準拠として設定できません。 @@ -5660,7 +5660,7 @@ C# では out と ref を区別しますが、CLR では同じと認識します CLS compliance checking will not be performed on '{0}' because it is not visible from outside this assembly - {0}' はこのアセンブリの外から認識できないため、CLS 準拠の確認は実行されません。 + '{0}' はこのアセンブリの外から認識できないため、CLS 準拠の確認は実行されません。 @@ -5670,7 +5670,7 @@ C# では out と ref を区別しますが、CLR では同じと認識します '{0}' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute - 'アセンブリには属性 CLSCompliant がないため、'{0}' に属性 CLSCompliant は不要です。 + アセンブリには属性 CLSCompliant がないため、'{0}' に属性 CLSCompliant は不要です。 @@ -5720,7 +5720,7 @@ C# では out と ref を区別しますが、CLR では同じと認識します '{0}' is not CLS-compliant because base interface '{1}' is not CLS-compliant - '基底インターフェイス '{1}' が CLS 準拠でないため、'{0}' は CLS に準拠していません + 基底インターフェイス '{1}' が CLS 準拠でないため、'{0}' は CLS に準拠していません @@ -5735,7 +5735,7 @@ C# では out と ref を区別しますが、CLR では同じと認識します Cannot await '{0}' - {0}' を待機することができません + '{0}' を待機することができません @@ -5750,12 +5750,12 @@ C# では out と ref を区別しますが、CLR では同じと認識します Cannot await 'void' - void' を待機することができません + 'void' を待機することができません 'await' cannot be used as an identifier within an async method or lambda expression - '非同期メソッドまたはラムダ式の内部で 'await' を識別子として使用することはできません。 + 非同期メソッドまたはラムダ式の内部で 'await' を識別子として使用することはできません。 @@ -5765,7 +5765,7 @@ C# では out と ref を区別しますが、CLR では同じと認識します Since '{0}' is an async method that returns 'Task', a return keyword must not be followed by an object expression. Did you intend to return 'Task<T>'? - {0}' は 'Task' を返す非同期メソッドであるため、キーワード return の後にオブジェクト式を指定することはできません。'Task<T>' を返すメソッドを指定したつもりでしたか? + '{0}' は 'Task' を返す非同期メソッドであるため、キーワード return の後にオブジェクト式を指定することはできません。'Task<T>' を返すメソッドを指定したつもりでしたか? @@ -5775,7 +5775,7 @@ C# では out と ref を区別しますが、CLR では同じと認識します Cannot return an expression of type 'void' - void' 型の式を返すことはできません + 'void' 型の式を返すことはできません @@ -5800,22 +5800,22 @@ C# では out と ref を区別しますが、CLR では同じと認識します The 'await' operator can only be used when contained within a method or lambda expression marked with the 'async' modifier - await' 演算子は、'async' 修飾子が指定されているメソッドまたはラムダ式に含まれている場合にのみ使用できます + 'await' 演算子は、'async' 修飾子が指定されているメソッドまたはラムダ式に含まれている場合にのみ使用できます The 'await' operator can only be used within an async {0}. Consider marking this {0} with the 'async' modifier. - await' 演算子は、非同期の {0} でのみ使用できます。この {0} を 'async' 修飾子でマークすることを検討してください。 + 'await' 演算子は、非同期の {0} でのみ使用できます。この {0} を 'async' 修飾子でマークすることを検討してください。 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task<{0}>'. - await' 演算子は、非同期メソッド内でのみ使用できます。このメソッドを 'async' 修飾子でマークし、戻り値の型を 'Task<{0}>' に変更することを検討してください。 + 'await' 演算子は、非同期メソッド内でのみ使用できます。このメソッドを 'async' 修飾子でマークし、戻り値の型を 'Task<{0}>' に変更することを検討してください。 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. - await' 演算子は、非同期メソッド内でのみ使用できます。このメソッドに 'async' 修飾子を指定し、戻り値の型を 'Task' に変更することを検討してください。 + 'await' 演算子は、非同期メソッド内でのみ使用できます。このメソッドに 'async' 修飾子を指定し、戻り値の型を 'Task' に変更することを検討してください。 @@ -5840,7 +5840,7 @@ C# では out と ref を区別しますが、CLR では同じと認識します The 'await' operator cannot be used in a static script variable initializer. - await' 演算子は、静的なスクリプト変数初期化子では使用できません。 + 'await' 演算子は、静的なスクリプト変数初期化子では使用できません。 @@ -5850,17 +5850,17 @@ C# では out と ref を区別しますが、CLR では同じと認識します The 'async' modifier can only be used in methods that have a body. - async' 修飾子は、本体があるメソッドでのみ使用できます。 + 'async' 修飾子は、本体があるメソッドでのみ使用できます。 Parameters or locals of type '{0}' cannot be declared in async methods or lambda expressions. - {0}' 型のパラメーターまたはローカルは、非同期メソッドまたはラムダ式で宣言することができません。 + '{0}' 型のパラメーターまたはローカルは、非同期メソッドまたはラムダ式で宣言することができません。 foreach statement cannot operate on enumerators of type '{0}' in async or iterator methods because '{0}' is a ref struct. - {0}' は ref 構造体であるため、非同期または反復子のメソッド内で型 '{0}' の列挙子に対して foreach ステートメントは機能しません。 + '{0}' は ref 構造体であるため、非同期または反復子のメソッド内で型 '{0}' の列挙子に対して foreach ステートメントは機能しません。 @@ -5875,7 +5875,7 @@ C# では out と ref を区別しますが、CLR では同じと認識します The 'await' operator may only be used in a query expression within the first collection expression of the initial 'from' clause or within the collection expression of a 'join' clause - await' 演算子は、最初の 'from' 句の最初のコレクション式、または 'join' 句のコレクション式に含まれるクエリ式でのみ使用できます。 + 'await' 演算子は、最初の 'from' 句の最初のコレクション式、または 'join' 句のコレクション式に含まれるクエリ式でのみ使用できます。 @@ -6062,7 +6062,7 @@ You should consider suppressing the warning only if you're sure that you don't w Partial declarations of '{0}' must have the same type parameter names and variance modifiers in the same order - {0}' の partial 宣言では、同じ型パラメーター名と分散修飾子を同じ順序で指定しなければなりません。 + '{0}' の partial 宣言では、同じ型パラメーター名と分散修飾子を同じ順序で指定しなければなりません。 @@ -6107,17 +6107,17 @@ You should consider suppressing the warning only if you're sure that you don't w 'extern alias' is not valid in this context - 'このコンテキストでは 'extern エイリアス' は無効です。 + このコンテキストでは 'extern エイリアス' は無効です。 Using '{0}' to test compatibility with '{1}' is essentially identical to testing compatibility with '{2}' and will succeed for all non-null values - {1}' との互換性をテストするために '{0}' を使用することは、 '{2}' との互換性をテストすることと実質的に同じであり、null 以外のすべての値で成功します + '{1}' との互換性をテストするために '{0}' を使用することは、'{2}' との互換性をテストすることと実質的に同じであり、null 以外のすべての値で成功します Using 'is' to test compatibility with 'dynamic' is essentially identical to testing compatibility with 'Object' - is' を 'dynamic' との互換性をテストするために使用することは、'Object' との互換性をテストすることと実質的に同じです + 'is' を 'dynamic' との互換性をテストするために使用することは、'Object' との互換性をテストすることと実質的に同じです @@ -6152,7 +6152,7 @@ You should consider suppressing the warning only if you're sure that you don't w The second operand of an 'is' or 'as' operator may not be static type '{0}' - is' または 'as' 演算子の 2 番目のオペランドはスタティック型 '{0}' にすることはできません。 + 'is' または 'as' 演算子の 2 番目のオペランドはスタティック型 '{0}' にすることはできません。 @@ -6172,7 +6172,7 @@ You should consider suppressing the warning only if you're sure that you don't w The best overload for '{0}' does not have a parameter named '{1}' - {0}' に最も適しているオーバーロードには '{1}' という名前のパラメーターがありません + '{0}' に最も適しているオーバーロードには '{1}' という名前のパラメーターがありません @@ -6182,7 +6182,7 @@ You should consider suppressing the warning only if you're sure that you don't w Named argument '{0}' cannot be specified multiple times - {0}' という名前付き引数が複数指定されました + '{0}' という名前付き引数が複数指定されました @@ -6202,7 +6202,7 @@ You should consider suppressing the warning only if you're sure that you don't w Default parameter value for '{0}' must be a compile-time constant - {0}' の既定のパラメーター値は、コンパイル時の定数である必要があります。 + '{0}' の既定のパラメーター値は、コンパイル時の定数である必要があります。 @@ -6212,7 +6212,7 @@ You should consider suppressing the warning only if you're sure that you don't w Cannot specify a default value for the 'this' parameter - this' パラメーターには既定値を指定できません + 'this' パラメーターには既定値を指定できません @@ -6227,7 +6227,7 @@ You should consider suppressing the warning only if you're sure that you don't w A value of type '{0}' cannot be used as default parameter for nullable parameter '{1}' because '{0}' is not a simple type - {0}' は単純型ではないため、型 '{0}' の値を Null 許容パラメーター '{1}' の既定のパラメーターとして使用することはできません。 + '{0}' は単純型ではないため、型 '{0}' の値を Null 許容パラメーター '{1}' の既定のパラメーターとして使用することはできません。 @@ -6337,7 +6337,7 @@ You should consider suppressing the warning only if you're sure that you don't w There is no argument given that corresponds to the required formal parameter '{0}' of '{1}' - {1}' の必要な仮パラメーター '{0}' に対応する特定の引数がありません。 + '{1}' の必要な仮パラメーター '{0}' に対応する特定の引数がありません。 @@ -6700,7 +6700,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Module name '{0}' stored in '{1}' must match its filename. - {1}' に格納されているモジュール名 '{0}' はファイル名と一致する必要があります。 + '{1}' に格納されているモジュール名 '{0}' はファイル名と一致する必要があります。 @@ -6710,7 +6710,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Invalid '{0}' value: '{1}'. - {0}' の値 '{1}' は無効です。 + '{0}' の値 '{1}' は無効です。 @@ -6815,7 +6815,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Reference to '{0}' netmodule missing. - {0}' netmodule への参照がありません。 + '{0}' netmodule への参照がありません。 @@ -7512,7 +7512,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Async lambda expression converted to a 'Task' returning delegate cannot return a value. Did you intend to return 'Task<T>'? - Task' に変換されてデリゲートを返す非同期のラムダ式は、値を返すことができません。'Task<T>' を返すメソッドを指定したつもりでしたか? + 'Task' に変換されてデリゲートを返す非同期のラムダ式は、値を返すことができません。'Task<T>' を返すメソッドを指定したつもりでしたか? @@ -7552,12 +7552,12 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Error reading ruleset file {0} - {1} - 規則セット ファイル {0} を読み込み中にエラーが発生しました - {1} + 規則セット ファイル {0} を読み取り中にエラーが発生しました - {1} Error reading debug information for '{0}' - {0}' のデバッグ情報の読み取りエラー + '{0}' のデバッグ情報の読み取りエラー @@ -7647,7 +7647,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Missing close delimiter '}' for interpolated expression started with '{'. - {' で始まる挿入式の終了区切り文字 '}' がありません。 + '{' で始まる挿入式の終了区切り文字 '}' がありません。 @@ -7872,7 +7872,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ The body of '{0}' cannot be an iterator block because '{0}' returns by reference - {0}' は参照渡しで返すため、'{0}' の本文を反復子ブロックにすることはできません。 + '{0}' は参照渡しで返すため、'{0}' の本文を反復子ブロックにすることはできません。 @@ -7892,12 +7892,12 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Cannot return '{0}' by reference because it was initialized to a value that cannot be returned by reference - {0}' は参照渡しで返せない値に初期化されたため、参照渡しで返すことができません + '{0}' は参照渡しで返せない値に初期化されたため、参照渡しで返すことができません Cannot return by reference a member of '{0}' because it was initialized to a value that cannot be returned by reference - {0}' のメンバーは参照渡しで返せない値に初期化されたため、参照渡しで返すことができません + '{0}' のメンバーは参照渡しで返せない値に初期化されたため、参照渡しで返すことができません @@ -7912,12 +7912,12 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Cannot return '{0}' by reference because it is a '{1}' - {1}' であるため、'{0}' を参照渡しで返すことはできません + '{1}' であるため、'{0}' を参照渡しで返すことはできません Cannot return fields of '{0}' by reference because it is a '{1}' - {1}' であるため、'{0}' のフィールドを参照渡しで返すことはできません + '{1}' であるため、'{0}' のフィールドを参照渡しで返すことはできません @@ -8037,7 +8037,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ 'await' cannot be used in an expression containing a call to '{0}' because it returns by reference - '参照渡しで返すため、'{0}' の呼び出しが含まれる式では 'await' を使用することができません + 参照渡しで返すため、'{0}' の呼び出しが含まれる式では 'await' を使用することができません @@ -8062,7 +8062,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Cannot pass argument with dynamic type to params parameter '{0}' of local function '{1}'. - 動的な型の引数をローカル 関数 '{1}' の params パラメーター '{0}' に渡すことはできません。 + 動的な型の引数をローカル関数 '{1}' の params パラメーター '{0}' に渡すことはできません。 @@ -8187,7 +8187,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Cannot deconstruct a tuple of '{0}' elements into '{1}' variables. - {0}' 要素のタプルを '{1}' 変数に分解することはできません。 + '{0}' 要素のタプルを '{1}' 変数に分解することはできません。 @@ -8472,7 +8472,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Do not use '{0}'. This is reserved for compiler usage. - {0}' は使用しないでください。コンパイラの使用のために予約されています。 + '{0}' は使用しないでください。コンパイラの使用のために予約されています。 @@ -8482,7 +8482,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ The first parameter of an 'in' extension method '{0}' must be a value type. - in' 拡張メソッド '{0}' の最初のパラメーターは値型でなければなりません。 + 'in' 拡張メソッド '{0}' の最初のパラメーターは値型でなければなりません。 @@ -8512,7 +8512,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ The first parameter of a 'ref' extension method '{0}' must be a value type or a generic type constrained to struct. - ref' 拡張メソッド '{0}' の最初のパラメーターは、値型または構造体に制限されたジェネリック型でなければなりません。 + 'ref' 拡張メソッド '{0}' の最初のパラメーターは、値型または構造体に制限されたジェネリック型でなければなりません。 @@ -8687,7 +8687,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - 型 '{2}' は、ジェネリック型またはメソッド '{0}' のパラメーター '{1}' として使用するために、参照型にすることも、入れ子のどのレベルに参照型フィールドを含めることもできません + 型 '{2}' と、入れ子になっているあらゆるレベルのすべてのフィールドは、ジェネリック型またはメソッド '{0}' のパラメーター '{1}' として使用するために、Null 非許容の値型でなければなりません diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf index c7e2e732becba..f235afc90f9a4 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf @@ -4142,7 +4142,7 @@ catch (System.Exception e) 블록 뒤의 catch() 블록은 RuntimeCompatibilityA foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance definition for '{1}' - '{0}' 형식 변수에서 foreach 문을 수행할 수 없습니다. ‘{0}’에는 '{1}'에 대한 공용 인스턴스 정의가 없기 때문입니다. + '{0}' 형식 변수에서 foreach 문을 수행할 수 없습니다. '{0}'에는 '{1}'에 대한 공용 인스턴스 정의가 없기 때문입니다. @@ -8687,7 +8687,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - '{2}' 형식은 제네릭 형식 또는 메서드 '{0}'에서 '{1}' 매개 변수로 사용하려면 참조 형식이 아니거나 어느 중첩 수준에서도 참조 형식 필드를 포함하지 않아야 합니다. + 제네릭 형식 또는 메서드 '{0}'에서 모든 중첩 수준의 모든 필드와 함께 '{2}' 형식을 '{1}' 매개 변수로 사용하려면 해당 형식이 null을 허용하지 않는 값 형식이어야 합니다. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf index 61749375a3ca8..17002149095d8 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf @@ -7365,7 +7365,7 @@ Aby usunąć ostrzeżenie, możesz zamiast tego użyć opcji /reference (ustaw w przeznaczony dla narzędzia WinMDExp (krótka wersja: /t:winmdobj) /doc:<plik> Plik dokumentacji XML do wygenerowania /refout:<plik> Dane wyjściowe zestawu odwołania do wygenerowania - /platform:<ciąg> Ogranicz platformy, na których można uruchamiać ten kod: x86, + /platform:<ciąg> Ogranicz platformy, na których można uruchamiać ten kod: x86, Itanium, x64, arm, arm64, anycpu32bitpreferred lub anycpu. Wartość domyślna to anycpu. @@ -8687,7 +8687,7 @@ Aby usunąć ostrzeżenie, możesz zamiast tego użyć opcji /reference (ustaw w The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - Typ „{2}” nie może być typem referencyjnym ani zawierać pól typów odwołania na jakimkolwiek poziomie zagnieżdżenia, aby można było używać go jako parametru „{1}” w typie ogólnym lub metodzie ogólnej „{0}” + Typ „{2}” musi być typem wartości niedopuszczającym wartości null (podobnie jak wszystkie pola na wszystkich poziomach zagnieżdżenia), aby można było używać go jako parametru „{1}” w typie ogólnym lub metodzie ogólnej „{0}” diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf index 55b7d89740d34..dff8341df32c1 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf @@ -8687,7 +8687,7 @@ Para incorporar informações de tipo de interoperabilidade para os dois assembl The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - O tipo '{2}' não pode ser um tipo de referência nem conter campos de tipo de referência em nenhum nível de aninhamento, para usá-lo como um parâmetro '{1}' no tipo genérico ou no método '{0}' + O tipo '{2}' precisa ser um tipo de valor que não permite valor nulo, juntamente com todos os campos em qualquer nível de aninhamento, para ser usado como um parâmetro '{1}' no tipo genérico ou no método '{0}' diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf index 8f44f10eede0b..2b346c215e566 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf @@ -8687,7 +8687,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - Тип "{2}" не может быть ссылочным или содержать поля типов ссылок на любом уровне вложения, чтобы его можно было использовать в качестве параметра "{1}" в универсальном типе или методе "{0}". + Чтобы тип "{2}" можно было использовать как параметр "{1}" в универсальном типе метода "{0}", он должен быть типом значения, который, как и все поля на любом уровне вложения, не допускает значения NULL. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf index c7845fe207ea9..4a1198377cb59 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf @@ -8687,7 +8687,7 @@ Uyarıyı kaldırmak için, /reference kullanabilirsiniz (Birlikte Çalışma T The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - '{0}' genel türünde veya metodunda '{1}' parametresi olarak kullanılması için '{2}' türü bir başvuru türü olamaz ya da herhangi bir iç içe geçme düzeyinde başvuru türü alanları içeremez. + '{0}' genel türü veya yönteminde '{1}' parametresi olarak kullanılabilmesi için '{2}' türünün, herhangi bir iç içe geçme düzeyindeki tüm alanlarla birlikte null yapılamayan bir değer türü olması gerekir diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf index 80ebbee38f9cd..18cb48a05fbb5 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf @@ -8687,7 +8687,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - 类型“{2}”不能为引用类型,或包含任何嵌套级别的引用类型字段,以将其用作泛型类型或方法“{0}”中的参数“{1}” + 类型“{2}”必须是不可以为 null 值的类型,且包括任何嵌套级别的所有字段,才能用作泛型类型或方法“{0}”中的参数“{1}” diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf index 673c4dfc2a8c8..6ec269cb4112e 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf @@ -8687,7 +8687,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}' - 類型 '{2}' 不能是參考類型,或在任何巢狀層級包含參考類型欄位,才能將它作為參數 '{1}' 用於泛型類型或方法 '{0}' + 類型 '{2}' 及任何巢狀層級的所有欄位必須是不可為 null 的值類型,如此才能在泛型型別或方法 '{0}' 中將其用為參數 '{1}' diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf index 21fb24e8d3801..61b22ca26b37a 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf @@ -1086,67 +1086,67 @@ Chcete pokračovat? Block Comment Editing - Block Comment Editing + Blokovat úpravy komentářů Comment/Uncomment Selection - Comment/Uncomment Selection + Okomentovat/odkomentovat výběr Code Completion - Code Completion + Dokončování kódu Execute In Interactive - Execute In Interactive + Provést v Interactive Extract Interface - Extract Interface + Extrahovat rozhraní Go To Adjacent Member - Go To Adjacent Member + Přejít na sousední člen Interactive - Interactive + Interactive Navigate To Highlighted Reference - Navigate To Highlighted Reference + Přejít na zvýrazněný odkaz Outlining - Outlining + Sbalení Rename Tracking Cancellation - Rename Tracking Cancellation + Zrušení sledování přejmenování Signature Help - Signature Help + Nápověda k signatuře Smart Token Formatter - Smart Token Formatter + Inteligentní formátování tokenů Paste in Interactive - Paste in Interactive + Vložit do Interactive diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf index ecae09763d8b3..02fd40055913e 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf @@ -1086,67 +1086,67 @@ Möchten Sie fortfahren? Block Comment Editing - Block Comment Editing + Blockkommentarbearbeitung Comment/Uncomment Selection - Comment/Uncomment Selection + Auswahl auskommentieren/Auskommentierung aufheben Code Completion - Code Completion + Codevervollständigung Execute In Interactive - Execute In Interactive + In interaktivem Fenster ausführen Extract Interface - Extract Interface + Schnittstelle extrahieren Go To Adjacent Member - Go To Adjacent Member + Zu angrenzendem Member wechseln Interactive - Interactive + Interaktiv Navigate To Highlighted Reference - Navigate To Highlighted Reference + Zu hervorgehobenem Verweis navigieren Outlining - Outlining + Gliederung Rename Tracking Cancellation - Rename Tracking Cancellation + Abbruch der Umbenennungsnachverfolgung Signature Help - Signature Help + Signaturhilfe Smart Token Formatter - Smart Token Formatter + Intelligente Tokenformatierung Paste in Interactive - Paste in Interactive + In interaktivem Fenster einfügen diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf index 2d4e274fed789..868dc818f9244 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf @@ -1086,67 +1086,67 @@ Do you want to proceed? Block Comment Editing - Block Comment Editing + Bloquear la edición de comentarios Comment/Uncomment Selection - Comment/Uncomment Selection + Poner/Quitar marca de comentario a la selección Code Completion - Code Completion + Finalización de código Execute In Interactive - Execute In Interactive + Ejecutar en modo interactivo Extract Interface - Extract Interface + Extraer interfaz Go To Adjacent Member - Go To Adjacent Member + Ir a miembro adyacente Interactive - Interactive + Interactivo Navigate To Highlighted Reference - Navigate To Highlighted Reference + Navegar a referencia resaltada Outlining - Outlining + Esquematización Rename Tracking Cancellation - Rename Tracking Cancellation + Cancelación de seguimiento de cambio de nombre Signature Help - Signature Help + Ayuda de signatura Smart Token Formatter - Smart Token Formatter + Formateador de token inteligente Paste in Interactive - Paste in Interactive + Pegar en interactivo diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf index 3718ebdc61287..cbff767e5e6b4 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf @@ -1086,67 +1086,67 @@ Voulez-vous continuer ? Block Comment Editing - Block Comment Editing + Bloquer la modification des commentaires Comment/Uncomment Selection - Comment/Uncomment Selection + Commenter/décommenter la sélection Code Completion - Code Completion + Complétion de code Execute In Interactive - Execute In Interactive + Exécuter en mode interactif Extract Interface - Extract Interface + Extraire l'interface Go To Adjacent Member - Go To Adjacent Member + Atteindre le membre adjacent Interactive - Interactive + Interactif Navigate To Highlighted Reference - Navigate To Highlighted Reference + Naviguer vers la référence en surbrillance Outlining - Outlining + Mode plan Rename Tracking Cancellation - Rename Tracking Cancellation + Annulation du suivi de renommage Signature Help - Signature Help + Aide sur les signatures Smart Token Formatter - Smart Token Formatter + Formateur de jeton intelligent Paste in Interactive - Paste in Interactive + Coller en mode interactif diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf index 006b70f98f141..412c15dfbd68d 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf @@ -1086,67 +1086,67 @@ Continuare? Block Comment Editing - Block Comment Editing + Blocca modifica dei commenti Comment/Uncomment Selection - Comment/Uncomment Selection + Aggiungi/Rimuovi commento selezione Code Completion - Code Completion + Completamento codice Execute In Interactive - Execute In Interactive + Esegui in finestra interattiva Extract Interface - Extract Interface + Estrai interfaccia Go To Adjacent Member - Go To Adjacent Member + Vai al membro adiacente Interactive - Interactive + Finestra interattiva Navigate To Highlighted Reference - Navigate To Highlighted Reference + Passa al riferimento evidenziato Outlining - Outlining + Struttura Rename Tracking Cancellation - Rename Tracking Cancellation + Annullamento verifica ridenominazione Signature Help - Signature Help + Guida per la firma Smart Token Formatter - Smart Token Formatter + Formattatore di token intelligente Paste in Interactive - Paste in Interactive + Incolla in finestra interattiva diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf index 8be4d8fea6394..28a32f8c39741 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf @@ -1086,67 +1086,67 @@ Do you want to proceed? Block Comment Editing - Block Comment Editing + コメント編集のブロック Comment/Uncomment Selection - Comment/Uncomment Selection + 選択範囲のコメント/コメント解除 Code Completion - Code Completion + コード補完 Execute In Interactive - Execute In Interactive + 対話形式で実行 Extract Interface - Extract Interface + インターフェイスの抽出 Go To Adjacent Member - Go To Adjacent Member + 隣接するメンバーに移動 Interactive - Interactive + 対話型 Navigate To Highlighted Reference - Navigate To Highlighted Reference + 強調表示された参照へ移動 Outlining - Outlining + アウトライン Rename Tracking Cancellation - Rename Tracking Cancellation + 名前変更の追跡取り消し Signature Help - Signature Help + シグネチャ ヘルプ Smart Token Formatter - Smart Token Formatter + スマート トークン フォーマッタ Paste in Interactive - Paste in Interactive + 対話形式で貼り付け diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf index 39ed8d06af448..a64c23e13ffc1 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf @@ -1086,67 +1086,67 @@ Do you want to proceed? Block Comment Editing - Block Comment Editing + 주석 편집 차단 Comment/Uncomment Selection - Comment/Uncomment Selection + 선택 영역 주석 처리/주석 처리 제거 Code Completion - Code Completion + 코드 완성 Execute In Interactive - Execute In Interactive + 대화형으로 실행 Extract Interface - Extract Interface + 인터페이스 추출 Go To Adjacent Member - Go To Adjacent Member + 인접 멤버로 이동 Interactive - Interactive + 대화형 Navigate To Highlighted Reference - Navigate To Highlighted Reference + 강조 표시 참조로 이동 Outlining - Outlining + 개요 Rename Tracking Cancellation - Rename Tracking Cancellation + 추적 이름 바꾸기 취소 Signature Help - Signature Help + 시그니처 도움말 Smart Token Formatter - Smart Token Formatter + 스마트 토큰 포맷터 Paste in Interactive - Paste in Interactive + 대화형으로 붙여넣기 diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf index c0836d59ffd07..3ede525bc7938 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf @@ -1086,67 +1086,67 @@ Czy chcesz kontynuować? Block Comment Editing - Block Comment Editing + Edytowanie komentarzy blokowych Comment/Uncomment Selection - Comment/Uncomment Selection + Zakomentuj/odkomentuj zaznaczenie Code Completion - Code Completion + Uzupełnianie kodu Execute In Interactive - Execute In Interactive + Wykonaj w trybie interaktywnym Extract Interface - Extract Interface + Wyodrębnij interfejs Go To Adjacent Member - Go To Adjacent Member + Przejdź do sąsiadującej składowej Interactive - Interactive + Interaktywne Navigate To Highlighted Reference - Navigate To Highlighted Reference + Przejdź do wyróżnionego odwołania Outlining - Outlining + Konspekt Rename Tracking Cancellation - Rename Tracking Cancellation + Anulowanie śledzenia zmiany nazw Signature Help - Signature Help + Pomoc dotycząca sygnatury Smart Token Formatter - Smart Token Formatter + Inteligentny element formatujący tokeny Paste in Interactive - Paste in Interactive + Wklej w trybie interaktywnym diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf index 97a9e9385fb72..662e8d757d5ff 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf @@ -1086,67 +1086,67 @@ Deseja continuar? Block Comment Editing - Block Comment Editing + Bloquear Edição de Comentário Comment/Uncomment Selection - Comment/Uncomment Selection + Comentar/Remover Marca de Comentário da Seleção Code Completion - Code Completion + Conclusão de Código Execute In Interactive - Execute In Interactive + Executar em Interativo Extract Interface - Extract Interface + Extrair Interface Go To Adjacent Member - Go To Adjacent Member + Ir para Membro Adjacente Interactive - Interactive + Interativo Navigate To Highlighted Reference - Navigate To Highlighted Reference + Navegar para Referência Realçada Outlining - Outlining + Estrutura de Tópicos Rename Tracking Cancellation - Rename Tracking Cancellation + Renomear Cancelamento de Acompanhamento Signature Help - Signature Help + Ajuda da Assinatura Smart Token Formatter - Smart Token Formatter + Formatador de Token Inteligente Paste in Interactive - Paste in Interactive + Colar em Interativo diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf index 2823ea8687367..f078e5663d354 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf @@ -1086,67 +1086,67 @@ Do you want to proceed? Block Comment Editing - Block Comment Editing + Изменение блочных комментариев Comment/Uncomment Selection - Comment/Uncomment Selection + Закомментировать/раскомментировать выбранный фрагмент Code Completion - Code Completion + Завершение кода Execute In Interactive - Execute In Interactive + Выполнять в интерактивном режиме Extract Interface - Extract Interface + Извлечь интерфейс Go To Adjacent Member - Go To Adjacent Member + Перейти к смежному элементу Interactive - Interactive + Интерактивный режим Navigate To Highlighted Reference - Navigate To Highlighted Reference + Перейти к выделенной ссылке Outlining - Outlining + Структура Rename Tracking Cancellation - Rename Tracking Cancellation + Отмена отслеживания переименования Signature Help - Signature Help + Справка по сигнатурам Smart Token Formatter - Smart Token Formatter + Средство форматирования смарт-токена Paste in Interactive - Paste in Interactive + Вставить в интерактивном режиме diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf index 53e53e23d8d22..5fa9cc3b033f1 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf @@ -1086,67 +1086,67 @@ Devam etmek istiyor musunuz? Block Comment Editing - Block Comment Editing + Açıklama Düzenlemeyi Engelle Comment/Uncomment Selection - Comment/Uncomment Selection + Seçimi Açıklama Satırı Yap/Seçimin Açıklamasını Kaldır Code Completion - Code Completion + Kod Tamamlama Execute In Interactive - Execute In Interactive + Etkileşimli Pencerede Yürüt Extract Interface - Extract Interface + Arabirimi Ayıkla Go To Adjacent Member - Go To Adjacent Member + Bitişik Üyeye Git Interactive - Interactive + Etkileşimli Navigate To Highlighted Reference - Navigate To Highlighted Reference + Vurgulanan Başvuruya Git Outlining - Outlining + Ana Hat Rename Tracking Cancellation - Rename Tracking Cancellation + İzleme İptal Etmeyi Yeniden Adlandır Signature Help - Signature Help + İmza Yardımı Smart Token Formatter - Smart Token Formatter + Akıllı Belirteç Biçimlendirici Paste in Interactive - Paste in Interactive + Etkileşimli Pencereye Yapıştır diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf index e645bfa8d3441..127bd579b714a 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf @@ -1086,67 +1086,67 @@ Do you want to proceed? Block Comment Editing - Block Comment Editing + 阻止注释编辑 Comment/Uncomment Selection - Comment/Uncomment Selection + 注释/取消注释选定内容 Code Completion - Code Completion + 代码完成 Execute In Interactive - Execute In Interactive + 交互执行 Extract Interface - Extract Interface + 提取接口 Go To Adjacent Member - Go To Adjacent Member + 转到相邻成员 Interactive - Interactive + 交互 Navigate To Highlighted Reference - Navigate To Highlighted Reference + 导航到突出显示引用 Outlining - Outlining + 大纲 Rename Tracking Cancellation - Rename Tracking Cancellation + 重命名跟踪取消 Signature Help - Signature Help + 签名帮助 Smart Token Formatter - Smart Token Formatter + 智能令牌格式化程序 Paste in Interactive - Paste in Interactive + 交互粘贴 diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf index ae7422cb6f468..abaebd9a7f10d 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf @@ -1086,67 +1086,67 @@ Do you want to proceed? Block Comment Editing - Block Comment Editing + 區塊註解編輯 Comment/Uncomment Selection - Comment/Uncomment Selection + 註解/取消註解選取範圍 Code Completion - Code Completion + 程式碼完成 Execute In Interactive - Execute In Interactive + 以互動方式執行 Extract Interface - Extract Interface + 擷取介面 Go To Adjacent Member - Go To Adjacent Member + 移至相鄰成員 Interactive - Interactive + 互動式 Navigate To Highlighted Reference - Navigate To Highlighted Reference + 巡覽至反白顯示的參考 Outlining - Outlining + 大綱 Rename Tracking Cancellation - Rename Tracking Cancellation + 重新命名追蹤取消 Signature Help - Signature Help + 簽章說明 Smart Token Formatter - Smart Token Formatter + 智慧權杖格式器 Paste in Interactive - Paste in Interactive + 以互動方式貼上 diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.cs.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.cs.xlf index a631e41c61da7..da43530ab889b 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.cs.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.cs.xlf @@ -109,7 +109,7 @@ Implement Abstract Class Or Interface - Implement Abstract Class Or Interface + Implementovat abstraktní třídu nebo rozhraní diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.de.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.de.xlf index 775c0515f1e39..afac4399287fc 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.de.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.de.xlf @@ -109,7 +109,7 @@ Implement Abstract Class Or Interface - Implement Abstract Class Or Interface + Abstrakte Klasse oder Schnittstelle implementieren diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.es.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.es.xlf index 1ff39d61622a2..a97a02b41fdcb 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.es.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.es.xlf @@ -109,7 +109,7 @@ Implement Abstract Class Or Interface - Implement Abstract Class Or Interface + Implementar interfaz o clase abstracta diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.fr.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.fr.xlf index f387d97bd7d2c..94c5848d56dbe 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.fr.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.fr.xlf @@ -109,7 +109,7 @@ Implement Abstract Class Or Interface - Implement Abstract Class Or Interface + Implémenter une interface ou une classe abstraite diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.it.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.it.xlf index 3414e733b8185..342ef0aaeece0 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.it.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.it.xlf @@ -109,7 +109,7 @@ Implement Abstract Class Or Interface - Implement Abstract Class Or Interface + Implementa interfaccia o classe astratta diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ja.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ja.xlf index 8b1892443c683..8e7a3b1f99c19 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ja.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ja.xlf @@ -109,7 +109,7 @@ Implement Abstract Class Or Interface - Implement Abstract Class Or Interface + 抽象クラスまたはインターフェイスの実装 diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ko.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ko.xlf index a097e7223f0e6..6c547f7d7a6c3 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ko.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ko.xlf @@ -109,7 +109,7 @@ Implement Abstract Class Or Interface - Implement Abstract Class Or Interface + 추상 클래스 또는 인터페이스 구현 diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pl.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pl.xlf index bfa1305e66466..95eaa5507bfa6 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pl.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pl.xlf @@ -109,7 +109,7 @@ Implement Abstract Class Or Interface - Implement Abstract Class Or Interface + Implementuj klasę abstrakcyjną lub interfejs diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pt-BR.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pt-BR.xlf index 08550419b0b82..a44041a5bd413 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pt-BR.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.pt-BR.xlf @@ -109,7 +109,7 @@ Implement Abstract Class Or Interface - Implement Abstract Class Or Interface + Implementar Classe Abstrata ou Interface diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ru.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ru.xlf index c2cc620bf887b..0d0a3220d2da1 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ru.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.ru.xlf @@ -109,7 +109,7 @@ Implement Abstract Class Or Interface - Implement Abstract Class Or Interface + Реализовать абстрактный класс или интерфейс diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.tr.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.tr.xlf index e6df38b81c564..c830159f6cfac 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.tr.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.tr.xlf @@ -109,7 +109,7 @@ Implement Abstract Class Or Interface - Implement Abstract Class Or Interface + Abstract Sınıfını veya Interface Uygula diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hans.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hans.xlf index ca091ca56e572..205ae02a73ce1 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hans.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hans.xlf @@ -109,7 +109,7 @@ Implement Abstract Class Or Interface - Implement Abstract Class Or Interface + 实现抽象类或接口 diff --git a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hant.xlf b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hant.xlf index 0d92e09ff28ff..90bdb1ff4edaa 100644 --- a/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hant.xlf +++ b/src/EditorFeatures/VisualBasic/xlf/VBEditorResources.zh-Hant.xlf @@ -109,7 +109,7 @@ Implement Abstract Class Or Interface - Implement Abstract Class Or Interface + 實作抽象類別或介面 diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.cs.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.cs.xlf index d3c7e8b325e74..31162c9f16ba2 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.cs.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.cs.xlf @@ -694,7 +694,7 @@ Generate Event Subscription - Generate Event Subscription + Generovat odběr událostí diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.de.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.de.xlf index dd541f92187e5..bc5cfbcceeb74 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.de.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.de.xlf @@ -694,7 +694,7 @@ Generate Event Subscription - Generate Event Subscription + Ereignisabonnement erstellen diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.es.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.es.xlf index 7d91be6f1e8b1..d1333f3ccc375 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.es.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.es.xlf @@ -694,7 +694,7 @@ Generate Event Subscription - Generate Event Subscription + Generar suscripción de eventos diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.fr.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.fr.xlf index 9cc8ac1995051..c5ce8a0096a4b 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.fr.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.fr.xlf @@ -694,7 +694,7 @@ Generate Event Subscription - Generate Event Subscription + Générer un abonnement à des événements diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.it.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.it.xlf index 61a5627d1ca4b..3555734d805f5 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.it.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.it.xlf @@ -694,7 +694,7 @@ Generate Event Subscription - Generate Event Subscription + Genera sottoscrizione di eventi diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ja.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ja.xlf index a909aaade748f..3895c57a3a5ae 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ja.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ja.xlf @@ -694,7 +694,7 @@ Generate Event Subscription - Generate Event Subscription + イベント サブスクリプションの生成 diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ko.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ko.xlf index 962d5b078f013..17aa2854a72cc 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ko.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ko.xlf @@ -694,7 +694,7 @@ Generate Event Subscription - Generate Event Subscription + 이벤트 구독 생성 diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pl.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pl.xlf index 896591657188a..062d4deed064c 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pl.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pl.xlf @@ -694,7 +694,7 @@ Generate Event Subscription - Generate Event Subscription + Generuj subskrypcję zdarzenia diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pt-BR.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pt-BR.xlf index 8f9de8d72d18a..16f478b42a85b 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pt-BR.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pt-BR.xlf @@ -694,7 +694,7 @@ Generate Event Subscription - Generate Event Subscription + Gerar Assinatura de Evento diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ru.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ru.xlf index f9927d291e36b..f4565a2f5b6ec 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ru.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ru.xlf @@ -694,7 +694,7 @@ Generate Event Subscription - Generate Event Subscription + Создать подписку на события diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.tr.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.tr.xlf index b11c3f7518ea2..34d9add84b496 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.tr.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.tr.xlf @@ -694,7 +694,7 @@ Generate Event Subscription - Generate Event Subscription + Olay Aboneliği Oluştur diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hans.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hans.xlf index b6d1f62d22699..bdf73a776490c 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hans.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hans.xlf @@ -694,7 +694,7 @@ Generate Event Subscription - Generate Event Subscription + 生成事件订阅 diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hant.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hant.xlf index c07c4064b9b13..b4faee744a677 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hant.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hant.xlf @@ -694,7 +694,7 @@ Generate Event Subscription - Generate Event Subscription + 產生事件訂閱 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index e140d3062e283..dd9b5b4e1b1d8 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -1424,7 +1424,7 @@ Pro aktuální řešení je povolené zjednodušené načtení řešení. Jeho z Error while reading file '{0}': {1} - Chyba při čtení souboru + Při čtení souboru {0} došlo k chybě: {1} @@ -1490,12 +1490,12 @@ Souhlasím se všemi výše uvedenými podmínkami: Sync Class View - Sync Class View + Synchronizovat Zobrazení tříd Can't apply changes -- unexpected error: '{0}' - Can't apply changes -- unexpected error: '{0}' + Změny nelze použít – neočekávaná chyba: {0} @@ -1510,7 +1510,7 @@ Souhlasím se všemi výše uvedenými podmínkami: Manage naming styles - Manage naming styles + Spravovat styly pojmenování diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index 61b89a20942e2..c23ad22b03296 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -1135,7 +1135,7 @@ Zusätzliche Informationen: {1} Collapse #regions when collapsing to definitions - #regions beim Reduzieren auf Definitionen ausblenden + #regions beim Reduzieren auf Definitionen zuklappen @@ -1424,7 +1424,7 @@ Für die aktuelle Projektmappe ist die Option "Lightweight-Ladevorgang für Proj Error while reading file '{0}': {1} - Fehler beim Lesen einer Datei. + Fehler beim Lesen der Datei "{0}": {1} @@ -1490,12 +1490,12 @@ Ich stimme allen vorstehenden Bedingungen zu: Sync Class View - Sync Class View + Synchronisierungsklassenansicht Can't apply changes -- unexpected error: '{0}' - Can't apply changes -- unexpected error: '{0}' + Änderungen können nicht angewendet werden -- unerwarteter Fehler: {0} @@ -1510,7 +1510,7 @@ Ich stimme allen vorstehenden Bedingungen zu: Manage naming styles - Manage naming styles + Benennungsstile verwalten diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index 6e8c0a410a0c6..88f0c495713b7 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -1424,7 +1424,7 @@ La opción "Carga de solución ligera" está habilitada para la solución actual Error while reading file '{0}': {1} - Error al leer un archivo. + Error al leer el archivo "{0}": {1} @@ -1490,12 +1490,12 @@ Estoy de acuerdo con todo lo anterior: Sync Class View - Sync Class View + Sincronizar vista de clases Can't apply changes -- unexpected error: '{0}' - Can't apply changes -- unexpected error: '{0}' + No se pueden aplicar los cambios: error inesperado "{0}" @@ -1510,7 +1510,7 @@ Estoy de acuerdo con todo lo anterior: Manage naming styles - Manage naming styles + Administrar estilos de nomenclatura diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index c60b06129f054..5ec097c6af0cf 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -1424,7 +1424,7 @@ Informations supplémentaires : {1} Error while reading file '{0}': {1} - Erreur durant la lecture d'un fichier + Erreur durant la lecture du fichier '{0}' : {1} @@ -1490,12 +1490,12 @@ Je suis d'accord avec tout ce qui précède : Sync Class View - Sync Class View + Synchroniser l'affichage de classes Can't apply changes -- unexpected error: '{0}' - Can't apply changes -- unexpected error: '{0}' + Impossible d'appliquer les changements -- Erreur inattendue : '{0}' @@ -1510,7 +1510,7 @@ Je suis d'accord avec tout ce qui précède : Manage naming styles - Manage naming styles + Gérer les styles de nommage diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index acd371ab95f1c..b0d833da26978 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -1424,7 +1424,7 @@ L'opzione 'Caricamento leggero soluzioni' è abilitata per la soluzione corrente Error while reading file '{0}': {1} - Si è verificato un errore durante la lettura di un file + Si è verificato un errore durante la lettura del file '{0}': {1} @@ -1490,12 +1490,12 @@ L'utente accetta le condizioni sopra riportate: Sync Class View - Sync Class View + Sincronizza visualizzazione classi Can't apply changes -- unexpected error: '{0}' - Can't apply changes -- unexpected error: '{0}' + Non è possibile applicare le modifiche. Errore imprevisto: '{0}' @@ -1510,7 +1510,7 @@ L'utente accetta le condizioni sopra riportate: Manage naming styles - Manage naming styles + Gestisci stili di denominazione diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index 15006f66d0d4e..35ebc43f859ac 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -1424,7 +1424,7 @@ Additional information: {1} Error while reading file '{0}': {1} - ファイルの読み取り中にエラーが発生しました + ファイル {0}' の読み取り中にエラーが発生しました: {1} @@ -1490,12 +1490,12 @@ I agree to all of the foregoing: Sync Class View - Sync Class View + クラス ビューの同期 Can't apply changes -- unexpected error: '{0}' - Can't apply changes -- unexpected error: '{0}' + 変更を適用できません。予期しないエラー: '{0}' @@ -1510,7 +1510,7 @@ I agree to all of the foregoing: Manage naming styles - Manage naming styles + 名前付けスタイルを管理する diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index 6aac710bcf2df..ecdddbec2d06d 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -1424,7 +1424,7 @@ Additional information: {1} Error while reading file '{0}': {1} - 파일을 읽는 동안 오류가 발생했습니다. + '{0}' 파일을 읽는 동안 오류가 발생했습니다. {1} @@ -1490,12 +1490,12 @@ I agree to all of the foregoing: Sync Class View - Sync Class View + 클래스 뷰 동기화 Can't apply changes -- unexpected error: '{0}' - Can't apply changes -- unexpected error: '{0}' + 변경 내용을 적용할 수 없음 - 예기치 않은 오류: '{0}' @@ -1510,7 +1510,7 @@ I agree to all of the foregoing: Manage naming styles - Manage naming styles + 명명 스타일 관리 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index 246ccc147e5d1..e42f385115f4d 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -1424,7 +1424,7 @@ Funkcja „Uproszczone ładowanie rozwiązania” jest włączona dla bieżąceg Error while reading file '{0}': {1} - Błąd podczas odczytu pliku + Błąd podczas odczytywania pliku „{0}”: {1} @@ -1490,12 +1490,12 @@ Wyrażam zgodę na wszystkie następujące postanowienia: Sync Class View - Sync Class View + Synchronizuj widok klasy Can't apply changes -- unexpected error: '{0}' - Can't apply changes -- unexpected error: '{0}' + Nie można zastosować zmian — nieoczekiwany błąd: „{0}” @@ -1510,7 +1510,7 @@ Wyrażam zgodę na wszystkie następujące postanowienia: Manage naming styles - Manage naming styles + Zarządzaj stylami nazewnictwa diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index 734453f3aa556..c0b5dfd1be654 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -1424,7 +1424,7 @@ O 'Carregamento da solução leve' está habilitado para a solução atual. Desa Error while reading file '{0}': {1} - Erro durante a leitura de um arquivo + Erro ao ler o arquivo '{0}': {1} @@ -1490,12 +1490,12 @@ Eu concordo com todo o conteúdo supracitado: Sync Class View - Sync Class View + Sincronizar Modo de Exibição de Classe Can't apply changes -- unexpected error: '{0}' - Can't apply changes -- unexpected error: '{0}' + Não é possível aplicar as alterações – erro inesperado: '{0}' @@ -1510,7 +1510,7 @@ Eu concordo com todo o conteúdo supracitado: Manage naming styles - Manage naming styles + Gerenciar estilos de nomenclatura diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index 8a798d068ed6f..55bac7c6154f7 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -1424,7 +1424,7 @@ Additional information: {1} Error while reading file '{0}': {1} - Ошибка при чтении файла + Ошибка при чтении файла "{0}": {1} @@ -1490,12 +1490,12 @@ I agree to all of the foregoing: Sync Class View - Sync Class View + Синхронизировать представление классов Can't apply changes -- unexpected error: '{0}' - Can't apply changes -- unexpected error: '{0}' + Не удается применить изменения, так как возникла непредвиденная ошибка: "{0}" @@ -1510,7 +1510,7 @@ I agree to all of the foregoing: Manage naming styles - Manage naming styles + Управление стилями именования diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index 4f6e3f5211424..0017ba17ff0bf 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -1424,7 +1424,7 @@ Geçerli durum için 'basit çözüm yükü' etkin. Hata ayıklama başlatıldı Error while reading file '{0}': {1} - Dosya okunurken hata oluştu + '{0}' dosyası okunurken hata: {1} @@ -1490,12 +1490,12 @@ Aşağıdakilerin tümünü onaylıyorum: Sync Class View - Sync Class View + Sınıf Görünümünü Eşitle Can't apply changes -- unexpected error: '{0}' - Can't apply changes -- unexpected error: '{0}' + Değişiklikler uygulanamıyor - beklenmeyen hata: '{0}' @@ -1510,7 +1510,7 @@ Aşağıdakilerin tümünü onaylıyorum: Manage naming styles - Manage naming styles + Adlandırma stillerini yönetme diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index 26757af1982cd..ec498685a2386 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -1424,7 +1424,7 @@ Additional information: {1} Error while reading file '{0}': {1} - 读取文件时出错 + 读取文件“{0}”时出错: {1} @@ -1490,12 +1490,12 @@ I agree to all of the foregoing: Sync Class View - Sync Class View + 同步类视图 Can't apply changes -- unexpected error: '{0}' - Can't apply changes -- unexpected error: '{0}' + 无法应用更改 - 意外错误:“{0}” @@ -1510,7 +1510,7 @@ I agree to all of the foregoing: Manage naming styles - Manage naming styles + 管理命名样式 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index 36a63693efd15..88c9b1e1a35b9 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -1424,7 +1424,7 @@ Additional information: {1} Error while reading file '{0}': {1} - 讀取檔案時發生錯誤 + 讀取檔案 '{0}' 時發生錯誤: {1} @@ -1490,12 +1490,12 @@ I agree to all of the foregoing: Sync Class View - Sync Class View + 同步類別檢視 Can't apply changes -- unexpected error: '{0}' - Can't apply changes -- unexpected error: '{0}' + 無法套用變更 -- 未預期的錯誤: '{0}' @@ -1510,7 +1510,7 @@ I agree to all of the foregoing: Manage naming styles - Manage naming styles + 管理命名樣式 From f5929441798662bdd9b4fd20575b623dd0db074d Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Mon, 30 Apr 2018 11:19:15 -0700 Subject: [PATCH 42/43] disable flaky test --- src/Scripting/CSharpTest/CommandLineRunnerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Scripting/CSharpTest/CommandLineRunnerTests.cs b/src/Scripting/CSharpTest/CommandLineRunnerTests.cs index 6f7deb10a1fb6..ce41f1ec7f90a 100644 --- a/src/Scripting/CSharpTest/CommandLineRunnerTests.cs +++ b/src/Scripting/CSharpTest/CommandLineRunnerTests.cs @@ -595,7 +595,7 @@ public void SourceSearchPaths1() ", runner.Console.Out.ToString()); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/26510")] public void ReferenceSearchPaths1() { var main = Temp.CreateFile(extension: ".csx").WriteAllText(@" From da55cf91596db355ad9de7f3f23dfdd2bd7434a7 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Mon, 30 Apr 2018 14:50:02 -0700 Subject: [PATCH 43/43] update nuget package moniker to `beta6` --- build/Targets/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Targets/Versions.props b/build/Targets/Versions.props index 3e7a18e450f7e..9301d253f7c2a 100644 --- a/build/Targets/Versions.props +++ b/build/Targets/Versions.props @@ -18,7 +18,7 @@ dev - beta4 + beta6 $(RoslynFileVersionBase)-$(RoslynNuGetMoniker)