VSCode启动C# DevKit扩展时持续抛出URI格式异常求助
C# DevKit启动时触发URI格式异常的解决思路
问题描述
每次启动安装了新版C# DevKit扩展的VSCode时,都会触发LimitedFunctionality异常,该异常会被重复记录3-4次,来源标注为DevKit。
异常详情
LimitedFunctionality System.AggregateException: Project system data flow 'Workspace update handler ActionBlockSlimAsync`1' closed because of an exception: Invalid URI: The format of the URI could not be determined.. (Invalid URI: The format of the URI could not be determined.) ---> (Inner Exception #0) StreamJsonRpc.RemoteInvocationException: Invalid URI: The format of the URI could not be determined. at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject) at Microsoft.VisualStudio.ProjectSystem.VSCode.LanguageServices.Workspace.<>c__DisplayClass45_1`1.<<OnProjectChangedAsync>g__ApplyInBatchAsync|1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.VisualStudio.Threading.ReentrantSemaphore.StackSemaphore.<>c__DisplayClass3_0.<<ExecuteAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.VisualStudio.Threading.ReentrantSemaphore.StackSemaphore.ExecuteAsync(Func`1 operation, CancellationToken cancellationToken) at Microsoft.VisualStudio.ProjectSystem.OnceInitializedOnceDisposedUnderLockAsync.ExecuteUnderLockCoreAsync(Func`2 action, CancellationToken cancellationToken) at Microsoft.VisualStudio.ProjectSystem.VSCode.LanguageServices.Workspace.OnBuildUpdateAsync(IProjectVersionedValue`1 update) at Microsoft.VisualStudio.ProjectSystem.VSCode.LanguageServices.Workspace.<>c__DisplayClass41_0.<<OnWorkspaceUpdateAsync>g__ApplyUpdateWithinLockAsync|1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.VisualStudio.ProjectSystem.VSCode.LanguageServices.Workspace.<>c__DisplayClass41_0.<<OnWorkspaceUpdateAsync>g__ApplyUpdateWithinLockAsync|1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.VisualStudio.ProjectSystem.VSCode.LanguageServices.Workspace.<>c__DisplayClass41_0.<<OnWorkspaceUpdateAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.VisualStudio.Threading.ReentrantSemaphore.StackSemaphore.<>c__DisplayClass3_0.<<ExecuteAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.VisualStudio.Threading.ReentrantSemaphore.StackSemaphore.ExecuteAsync(Func`1 operation, CancellationToken cancellationToken) at Microsoft.VisualStudio.ProjectSystem.OnceInitializedOnceDisposedUnderLockAsync.ExecuteUnderLockCoreAsync(Func`2 action, CancellationToken cancellationToken) at Microsoft.VisualStudio.ProjectSystem.DataReceivingBlockSlim`1.ProcessInputQueueAsync(InputDataBuffer inputQueue) <--- (Inner Exception #0)
解决思路
- 检查项目文件中的URI配置:异常提示URI格式错误,优先排查
.csproj或.sln文件中是否存在格式不正确的URI(比如缺少协议头、路径格式错误的引用),尤其是自定义的PackageReference、ProjectReference或PublishProfile中的地址。 - 重置C# DevKit扩展状态:在VSCode中禁用并重新启用C# DevKit扩展,或者删除扩展的缓存目录(路径一般为
%USERPROFILE%\.vscode\extensions\ms-dotnettools.cs-devkit-*,删除对应版本文件夹后重启VSCode)。 - 回退到C# DevKit旧版本:如果是新版扩展引入的问题,在VSCode扩展市场找到C# DevKit,点击右下角的“管理”按钮选择“安装另一个版本”,选择最近一个稳定版本尝试。
- 检查VSCode工作区配置:确认工作区的
settings.json中是否存在与C#相关的错误配置,比如omnisharp.path或dotnet.server.path设置了无效路径。 - 修复.NET SDK环境:验证本地.NET SDK是否安装完整,运行
dotnet --info检查版本和路径是否正常,必要时重新安装对应版本的SDK。
内容的提问来源于stack exchange,提问作者JayGlynn
相关产品推荐
相关产品推荐

