VS2017 在加载任何项目时崩溃,并出现“FileNotFoundEx: System.Runtime.CompilerServices.Unsafe, V=4.0.4.1”

Posted

技术标签:

【中文标题】VS2017 在加载任何项目时崩溃,并出现“FileNotFoundEx: System.Runtime.CompilerServices.Unsafe, V=4.0.4.1”【英文标题】:VS2017 crashes with 'FileNotFoundEx: System.Runtime.CompilerServices.Unsafe, V=4.0.4.1' upon loading any project 【发布时间】:2021-12-26 22:12:12 【问题描述】:

抱歉冗长,但我陷入了困境 - 只是想提前提供所有细节。

本周五(2021 年 11 月 12 日)在重新启动 Visual Studio 2017 后,它在打开现有解决方案时开始崩溃,恕不另行通知。这至少在一周前工作得非常好(在 2021 年 11 月 5 日最后一次 Win10 更新 KB5006670 之后 - 然后重新启动)。尝试加载旧的解决方案(2 年多未触及)会导致完全相同的行为:您会看到“正在加载项目 ..”窗口(不确定它是否通过所有解决方案中的项目),然后 VS 主窗口突然消失了……就是这样

VStudio 的配置至少有一年没有动过。也没有明确的更新/补丁或 NuGet 包。 VS 本身会启动并显示带有通常开始页面的主窗口。 但我无法加载任何解决方案或项目

第一个相关的事件日志条目:

**2021-Nov-12 14:13:41**
Application: devenv.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at System.Threading.Tasks.ValueTask`1.AsTask()
   at Microsoft.CodeAnalysis.Document.GetSyntaxTreeAsync(CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Host.BackgroundParser.<>c__DisplayClass20_0.<ParseDocumentAsync>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack:
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception)
   at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception, System.Action`1<System.Exception>)
   at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception)
   at Roslyn.Utilities.TaskExtensions.ReportFatalErrorWorker(System.Threading.Tasks.Task, System.Object)
   at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.Tasks.Task.ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
   at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.TaskScheduler.TryRunInline(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.TaskContinuation.InlineIfPossibleOrElseQueue(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.StandardTaskContinuation.Run(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task.FinishStageThree()
   at System.Threading.Tasks.Task.FinishStageTwo()
   at System.Threading.Tasks.Task.Finish(Boolean)
   at System.Threading.Tasks.Task`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object)
   at System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetFromTask(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].ProcessCompletedOuterTask(System.Threading.Tasks.Task)
   at System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InvokeCore(System.Threading.Tasks.Task)
   at System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Invoke(System.Threading.Tasks.Task)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task.FinishStageThree()
   at System.Threading.Tasks.Task.FinishStageTwo()
   at System.Threading.Tasks.Task.Finish(Boolean)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
   at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

后面是这3个:

1)

**2021-Nov-12 14:14:16**
Application: devenv.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at System.Threading.Tasks.ValueTask`1.AsTask()
   at Microsoft.CodeAnalysis.Document.GetSyntaxTreeAsync(CancellationToken cancellationToken)
   at Microsoft.VisualStudio.LanguageServices.Implementation.Progression.SymbolContainment.<GetContainedSyntaxNodesAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.LanguageServices.Implementation.Progression.ContainsChildrenGraphQuery.<GetGraphAsync>d__0.MoveNext()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack:
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception)
   at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception, System.Action`1<System.Exception>)
   at Microsoft.CodeAnalysis.ErrorReporting.FatalError.ReportUnlessCanceled(System.Exception)
   at Roslyn.Utilities.TaskExtensions+<>c__DisplayClass7_0`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<SafeContinueWith>g__outerFunction|0(System.Threading.Tasks.Task)
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean)
   at System.Threading.Tasks.Task`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetResultCore(Boolean)
   at System.Threading.Tasks.Task`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].get_Result()
   at Microsoft.VisualStudio.LanguageServices.Implementation.Progression.GraphQueryManager+<>c__DisplayClass14_0.<PopulateContextGraphAsync>b__1(System.Threading.Tasks.Task`1<Microsoft.VisualStudio.LanguageServices.Implementation.Progression.GraphBuilder[]>)
   at Roslyn.Utilities.TaskExtensions+<>c__DisplayClass6_0`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<SafeContinueWith>b__0(System.Threading.Tasks.Task)
   at Roslyn.Utilities.TaskExtensions+<>c__DisplayClass3_0.<SafeContinueWith>g__continuationFunction|0(System.Threading.Tasks.Task)
   at Roslyn.Utilities.TaskExtensions+<>c__DisplayClass7_0`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<SafeContinueWith>g__outerFunction|0(System.Threading.Tasks.Task)
   at System.Threading.Tasks.ContinuationResultTaskFromTask`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.Tasks.Task.ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
   at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
**2021-Nov-12 14:14:19**
Faulting application name: devenv.exe, version: 15.8.28010.2050, time stamp: 0x5bda1fc3
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0x80131623
Fault offset: 0x19a1c93a
Faulting process id: 0x3d44
Faulting application start time: 0x01d7d801d444a508
Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe
Faulting module path: unknown
Report Id: e230b637-fd72-47f8-a0d5-d2c4ccb10943
**2021-Nov-12 14:14:35**
Fault bucket 1659198495851531123, type 5
Event Name: CLR20r3
Response: Not available
Cab Id: 0

Problem signature:
P1: devenv.exe
P2: 15.8.28010.2050
P3: 5bda1fc3
P4: Microsoft.CodeAnalysis.Workspaces
P5: 2.9.0.63208
P6: f144aff0
P7: 500
P8: 41
P9: System.IO.FileNotFoundException
P10: 

当我尝试加载解决方案时,这种 3 个条目的模式具有相同的嫌疑人重复了几次。

在最后一个三元组中,它有 ServiceHub.RoslynCodeAnalysisService32.exe 作为故障应用程序:

**2021-Nov-12 14:28:05**
Application: ServiceHub.RoslynCodeAnalysisService32.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at Microsoft.CodeAnalysis.Remote.Extensions.<InvokeAsync>d__3`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Remote.ServiceHubServiceBase.<RunServiceAsync>d__25`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Remote.SnapshotService.JsonRpcAssetSource.<RequestAssetsAsync>d__2.MoveNext()
Stack:
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception)
   at Microsoft.CodeAnalysis.Remote.SnapshotService+JsonRpcAssetSource.ReportUnlessCanceled(System.Exception, System.Threading.CancellationToken)
   at Microsoft.CodeAnalysis.Remote.SnapshotService+JsonRpcAssetSource+<RequestAssetsAsync>d__2.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Microsoft.CodeAnalysis.Remote.SnapshotService+JsonRpcAssetSource+<RequestAssetsAsync>d__2.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task.FinishStageThree()
   at System.Threading.Tasks.Task.CancellationCleanupLogic()
   at System.Threading.Tasks.Task`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetCanceled(System.Threading.CancellationToken, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
   at Microsoft.CodeAnalysis.Remote.ServiceHubServiceBase+<RunServiceAsync>d__25`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task.FinishStageThree()
   at System.Threading.Tasks.Task.CancellationCleanupLogic()
   at System.Threading.Tasks.Task`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetCanceled(System.Threading.CancellationToken, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
   at Microsoft.CodeAnalysis.Remote.Extensions+<InvokeAsync>d__3`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task.FinishStageThree()
   at System.Threading.Tasks.Task.CancellationCleanupLogic()
   at System.Threading.Tasks.Task`1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetCanceled(System.Threading.CancellationToken, System.Object)
   at System.Threading.Tasks.TaskFactory`1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].FromAsyncCoreLogic(System.IAsyncResult, System.Func`2<System.IAsyncResult,System.Threading.Tasks.VoidTaskResult>, System.Action`1<System.IAsyncResult>, System.Threading.Tasks.Task`1<System.Threading.Tasks.VoidTaskResult>, Boolean)
   at System.Threading.Tasks.TaskFactory`1+<>c__DisplayClass35_0[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<FromAsyncImpl>b__0(System.IAsyncResult)
   at System.IO.Pipes.NamedPipeServerStream.AsyncWaitForConnectionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)

**2021-Nov-12 14:28:06**
Faulting application name: ServiceHub.RoslynCodeAnalysisService32.exe, version: 1.3.77.18573, time stamp: 0xdc9a59bf
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0x80131623
Fault offset: 0x0aa234ca
Faulting process id: 0x2d4c
Faulting application start time: 0x01d7d803c7d13c18
Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\ServiceHub\Hosts\ServiceHub.Host.CLR.x86\ServiceHub.RoslynCodeAnalysisService32.exe
Faulting module path: unknown

**2021-Nov-12 14:28:11**
Fault bucket 1674005537433911736, type 5
Event Name: CLR20r3
Response: Not available
Cab Id: 0

Problem signature:
P1: O5DFLQX35YXZVV3T1Q5XYRCHNTQNLFQ2
P2: 1.3.77.18573
P3: dc9a59bf
P4: mscorlib
P5: 4.8.4420.0
P6: 6109cb33
P7: 3e6d
P8: 15
P9: System.OperationCanceled
P10: 

最后一个(今天的第一个):

**2021-Nov-15 09:45:25**
Application: devenv.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at System.Threading.Tasks.ValueTask`1.AsTask()
   at Microsoft.CodeAnalysis.Document.GetSyntaxTreeAsync(CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Host.BackgroundParser.<>c__DisplayClass20_0.<ParseDocumentAsync>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack:
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception)
   at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception, System.Action`1<System.Exception>)
   at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception)
   at Roslyn.Utilities.TaskExtensions.ReportFatalErrorWorker(System.Threading.Tasks.Task, System.Object)
   at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.Tasks.Task.ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
   at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.TaskScheduler.TryRunInline(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.TaskContinuation.InlineIfPossibleOrElseQueue(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.StandardTaskContinuation.Run(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task.FinishStageThree()
   at System.Threading.Tasks.Task.FinishStageTwo()
   at System.Threading.Tasks.Task.Finish(Boolean)
   at System.Threading.Tasks.Task`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object)
   at System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetFromTask(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].ProcessCompletedOuterTask(System.Threading.Tasks.Task)
   at System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InvokeCore(System.Threading.Tasks.Task)
   at System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Invoke(System.Threading.Tasks.Task)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task.FinishStageThree()
   at System.Threading.Tasks.Task.FinishStageTwo()
   at System.Threading.Tasks.Task.Finish(Boolean)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
   at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Roslyn.Utilities.TaskExtensions.ReportFatalErrorWorker() 似乎是一个常见的故障捕捉器,所以我猜这个问题与加载解决方案时启动的后台代码分析有关。谁打破了它以及如何打破它?

搜索错误消息System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 给了我以下链接:1、2、3、4、5。 但是这些都没有描述我的情况。在我的任何项目中,我都没有对该库的任何 [已知] 依赖。直到周五我才意识到!

在尝试可能的补救措施之前,在3 接受的答案中建议(“在我为该 DLL 运行 NuGet 更新后错误消失了”),我想了解,到底发生了什么(以及如何!)?我的列表中没有此类 NuGet 包的明确条目。我最近没有安装或更改任何东西。这次惨败正是我尝试保持很少更改 [=> 已知且稳定的] 开发环境的原因。

在 HDD 上搜索 System.Runtime.CompilerServices.Unsafe.dll 会产生以下结果:

C:\>dir System.Runtime.CompilerServices.Unsafe.* /s /n

C:\Program Files\dotnet\sdk\2.1.403\DotnetTools\dotnet-sql-cache\2.1.1\tools\netcoreapp2.1\any
    2018-Sep-20  14:48            14,712

C:\Program Files\dotnet\sdk\2.1.403\DotnetTools\dotnet-user-secrets\2.1.1\tools\netcoreapp2.1\any
    2018-Sep-20  14:48            14,928

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.4.0
    2018-Nov-08  16:14            62,144 system.runtime.compilerservices.unsafe.4.4.0.nupkg

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.4.0\lib\netstandard1.0
    2018-Nov-08  16:14            21,792

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.4.0\lib\netstandard2.0
    2018-Nov-08  16:14            21,944

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.4.0\ref\netstandard1.0
    2018-Nov-08  16:14            22,968

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.4.0\ref\netstandard2.0
    2018-Nov-08  16:14            23,480

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.5.0
    2018-Nov-08  16:10            87,453 system.runtime.compilerservices.unsafe.4.5.0.nupkg

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.5.0\lib\netcoreapp2.0
    2018-Nov-08  16:10            21,648

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.5.0\lib\netstandard1.0
    2018-Nov-08  16:10            22,160

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.5.0\lib\netstandard2.0
    2018-Nov-08  16:10            22,160

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.5.0\ref\netstandard1.0
    2018-Nov-08  16:10            23,176

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.5.0\ref\netstandard2.0
    2018-Nov-08  16:10            23,696

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.5.1
    2018-Nov-08  16:10            87,219 system.runtime.compilerservices.unsafe.4.5.1.nupkg

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.5.1\lib\netcoreapp2.0
    2018-Nov-08  16:11            21,640

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.5.1\lib\netstandard1.0
    2018-Nov-08  16:11            22,160

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.5.1\lib\netstandard2.0
    2018-Nov-08  16:11            22,184

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.5.1\ref\netstandard1.0
    2018-Nov-08  16:11            23,720

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.compilerservices.unsafe\4.5.1\ref\netstandard2.0
    2018-Nov-08  16:11            24,208

C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\2.1.5
    2018-Sep-20  15:08            19,536        4.6.26919.2

C:\Program Files\dotnet\store\x64\netcoreapp2.0\system.runtime.compilerservices.unsafe\4.4.0\lib\netstandard2.0
    2017-Jul-25  00:57            17,416

C:\Program Files\WindowsApps\Microsoft.YourPhone_1.21092.149.0_x64__8wekyb3d8bbwe
    2021-Jul-01  06:45            16,768        4.6.28619.1

C:\Program Files\WindowsApps\Microsoft.YourPhone_1.21092.149.0_x64__8wekyb3d8bbwe\YourPhoneAppProxy
    2021-Oct-19  05:48            18,824        4.700.21.47101

C:\Program Files\WindowsApps\Microsoft.YourPhone_1.21092.149.0_x64__8wekyb3d8bbwe\YourPhoneServer
    2020-Jun-13  17:25            17,000        4.700.20.12001

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\001ss942.rgs
    2021-May-20  04:28            16,768        5.0.20.51904            [RedGate.SQLSearch ?]

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\ph2houvf.kuk
    2019-Sep-07  04:28            21,792        ?? no version ??        [MS VS CloudExplorer]

VStudio 的“关于”帮助显示以下版本号:

Microsoft Visual Studio Professional 2017 
Version 15.8.9
VisualStudio.15.Release/15.8.9+28010.2050
Microsoft .NET Framework
Version 4.8.04084

ASP.NET and Web Tools 2017   15.8.05085.0
ASP.NET Core Razor Language Services   15.8.31590
ASP.NET Web Frameworks and Tools 2017   5.2.60618.0
C# Tools   2.9.0-beta8-63208-01
NuGet Package Manager   4.6.0
Redgate SQL Search   3.5.5.2703
SQL Server Data Tools   15.1.61808.07020
Xamarin   4.11.0.779 (d15-8@ff915e800)
Xamarin Designer   4.15.12 (d7ff6f39c)
Xamarin Templates   1.1.118 (4217ee9)
Xamarin.android SDK   9.0.0.19 (HEAD/a8a3b0ec7)

【问题讨论】:

Windows 通常会在更新之前创建一个还原点(除非您专门将其关闭)。也许尝试恢复以查看更新是否确实导致了它? 可能是某些系统文件(如此特定文件)因意外或更新 Windows 操作系统后或其他一些操作而损坏或丢失。我猜“更新”过程修复/下载了损坏的。 感谢您的建议。问题已经解决了,我会写一个答案。 嗨@Astrogator,很高兴知道您已经找到解决此问题的解决方案!请考虑回答并接受它作为将其状态更改为已回答的答案。它还将帮助其他人解决类似的问题。见can I answer my own question..,只是一个提醒:) 很高兴知道您找到了解决此问题的解决方案!请考虑回答并接受它作为将其状态更改为已回答的答案。它还将帮助其他人解决类似的问题。 【参考方案1】:

抱歉,拖了这么久。是为了完成一个项目。

问题的根本原因原来是 ICSharpCode.CodeConverter v.8.4.1.0! 哇,在安装的所有部件中(不是那么多)..

凭直觉(因为问题出在 Visual Studio 本地),我开始查看工具和扩展,并注意到此组件上的 Date Installed 已超过最新的 Windows 更新! Automatically update this extension 复选框已选中(默认情况下?)。所以它必须在 VS 重新启动时静默更新?!

当然,更新很有用,有时甚至是必要的。 但它们也可能带来问题。自动执行更新是一回事。 但不通知用户是不好的!


这是C:\TEMP\VSIXInstaller_f0335270-1a19-4b71-b74b-e50511bcd107.log的摘录:

Initializing Uninstall...
Extension Details...
    Identifier         : 7e2a69d6-193b-4cdf-878d-3370d5931942
    Name               : Code Converter (VB - C#)
    Author             : IC#Code
    Version            : 8.4.1.0
    Description        : Convert VB.NET to C# and vice versa with this roslyn based converter
    Locale             : en-US
    MoreInfoURL        : https://github.com/icsharpcode/CodeConverter
    InstalledByMSI     : False
    SupportedFrameworkVersionRange : [4.6,)

    Supported Products : 
        Microsoft.VisualStudio.Community
            Version : [15.0,17.0)
        Microsoft.VisualStudio.Community
            Version : [17.0,18.0)

    References         : 
    Prerequisites      : 
        -------------------------------------------------------
        Identifier   : Microsoft.VisualStudio.Component.CoreEditor
        Name         : Visual Studio core editor
        Version      : [15.0.26004.1,)

我删除它后,VStudio 就可以打开/加载项目了;无需重新启动! 在它崩溃之前,甚至初始化/打开一个新的 个!

在阅读有关此转换器的文档时,我还发现了 very similar bug。

【讨论】:

以上是关于VS2017 在加载任何项目时崩溃,并出现“FileNotFoundEx: System.Runtime.CompilerServices.Unsafe, V=4.0.4.1”的主要内容,如果未能解决你的问题,请参考以下文章

故事板不加载(继续加载)Xamarin.ios VS 2017

vs2015当前不会命中断点因为还没有

VS 2017 怎样添加Windows 应用程序

Swift ViewController 在加载时崩溃

无法加载文件或程序集'System.ValueTuple'

当我尝试发布时 VS2015 崩溃