Error when performing namespace adjust for solution or sync namespace context menu
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
_This issue has been moved from [a ticket on Developer Community](https://developercommunity.visualstudio.com/t/Error-when-performing-namespace-adjust-f/10273294)._
---
Whenever I try to sync namespaces by either clicking the context menu on the solution or by clicking the recommendation directly on the namespace I get a few different errors but the stack is pretty much the same (file attached).
It does not work, gets disabled and I can't sync all namespaces.
It usually works after restarting VS or when I run it with admin privileges but it is been happening more frequently after the last update (17.4.4)
It's not "NEW", it happened in older versions as well
---
### Original Comments
#### Feedback Bot on 2/7/2023, 05:03 PM:
(private comment, text removed)
#### Wenwen Fan [MSFT] on 2/7/2023, 09:43 PM:
(private comment, text removed)
#### Murilo Almeida on 2/17/2023, 07:20 PM:
(private comment, text removed)
#### Feedback Bot on 2/14/2023, 10:14 PM:
(private comment, text removed)
#### Feedback Bot on 2/20/2023, 10:27 PM:
(private comment, text removed)
#### Feedback Bot on 2/21/2023, 06:38 AM:
(private comment, text removed)
#### Feedback Bot on 2/21/2023, 06:47 AM:
(private comment, text removed)
---
### Original Solutions
(no solutions)
Excemption stack from feedback ticket:
```
CSharpChangeNamespaceToMatchFolderCodeFixProvider
The solution does not contain the specified document.
at Microsoft.CodeAnalysis.Shared.Extensions.ISolutionExtensions.GetRequiredDocument(Solution solution, DocumentId documentId)
at Microsoft.CodeAnalysis.ChangeNamespace.AbstractChangeNamespaceService`3.<>c__DisplayClass26_0.b__4(IGrouping`2 refInOneDocument
)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Threading.Tasks.Task.WhenAll[TResult](IEnumerable`1 tasks)
at Microsoft.CodeAnalysis.ChangeNamespace.AbstractChangeNamespaceService`3.d__26.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(
)
at Microsoft.CodeAnalysis.ChangeNamespace.AbstractChangeNamespaceService`3.d__16.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.CodeAnalysis.ChangeNamespace.AbstractChangeNamespaceService`3.d__15.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.Rename.Renamer.SyncNamespaceDocumentAction.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet.d__9.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.CodeFixes.MatchFolderAndNamespace.AbstractChangeNamespaceToMatchFolderCodeFixProvider.d__3.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.CodeActions.CodeAction.d__25.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.CodeActions.CodeAction.d__24.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.d__26.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionWithNestedFlavors.<>c__DisplayClass11_0.<b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.d__3`1.MoveNext()
```
Contributor guide
Assessment
This issue has not been assessed yet.