title: How to debug Unhandled Exception: System.Runtime.InteropServices.SEHException: External component has thrown an exception.?
body: <p>I'm having build errors using the <code>Debug target</code> button on the Visual Studio IDE but, I can build, run and compile my .NET application using the <code>.NET</code> CLI.</p>
  <p>Whenever I tried to Build and compile my application it outputs the following errors</p>
  <pre><code>Build started...
  1&gt;------ Build started: Project: ContosoCrafts.WebSite, Configuration: Debug Any CPU ------
  1&gt;docker exec -i 5ae2fcd24a4aea8e60d8116e279d8fae6fda5a0119c0cc227c89b679557e5fa3 /bin/sh -c &quot;if PID=$(pidof dotnet); then kill $PID; fi&quot;
  1&gt;Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
  1&gt;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(75,5): error :
  1&gt;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(75,5): error : Unhandled Exception: System.Runtime.InteropServices.SEHException: External component has thrown an exception.
  1&gt;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(75,5): error :    at Microsoft.CodeAnalysis.CSharp.CSharpCommandLineParser.Parse(IEnumerable`1 args, String baseDirectory, String sdkDirectory, String additionalReferenceDirectories)
  1&gt;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(75,5): error :    at Microsoft.CodeAnalysis.CommonCompiler..ctor(CommandLineParser parser, String responseFile, String[] args, BuildPaths buildPaths, String additionalReferenceDirectories, IAnalyzerAssemblyLoader assemblyLoader, GeneratorDriverCache driverCache)
  1&gt;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(75,5): error :    at Microsoft.CodeAnalysis.CSharp.CSharpCompiler..ctor(CSharpCommandLineParser parser, String responseFile, String[] args, BuildPaths buildPaths, String additionalReferenceDirectories, IAnalyzerAssemblyLoader assemblyLoader, GeneratorDriverCache driverCache)
  1&gt;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(75,5): error :    at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.Run(String[] args, BuildPaths buildPaths, TextWriter textWriter, IAnalyzerAssemblyLoader analyzerLoader)
  1&gt;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(75,5): error :    at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunLocalCompilation(String[] arguments, BuildPaths buildPaths, TextWriter textWriter)
  1&gt;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(75,5): error :    at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunCompilation(IEnumerable`1 originalArguments, BuildPaths buildPaths, TextWriter textWriter, String pipeName)
  1&gt;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(75,5): error :    at Microsoft.CodeAnalysis.CommandLine.BuildClient.Run(IEnumerable`1 arguments, RequestLanguage language, CompileFunc compileFunc, CompileOnServerFunc compileOnServerFunc)
  1&gt;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(75,5): error :    at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.MainCore(String[] args)
  1&gt;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(75,5): error :    at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(String[] args)
  1&gt;Done building project &quot;ContosoCrafts.WebSite.csproj&quot; -- FAILED.
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>
  <pre><code>Severity    Code    Description Project File    Line    Suppression State
  Error          at Microsoft.CodeAnalysis.CSharp.CSharpCompiler..ctor(CSharpCommandLineParser parser, String responseFile, String[] args, BuildPaths buildPaths, String additionalReferenceDirectories, IAnalyzerAssemblyLoader assemblyLoader, GeneratorDriverCache driverCache)    ContosoCrafts.WebSite   C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets    75  
  Error           ContosoCrafts.WebSite   C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets    75  
  Error       Unhandled Exception: System.Runtime.InteropServices.SEHException: External component has thrown an exception.   ContosoCrafts.WebSite   C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets    75  
  Error          at Microsoft.CodeAnalysis.CSharp.CSharpCommandLineParser.Parse(IEnumerable`1 args, String baseDirectory, String sdkDirectory, String additionalReferenceDirectories) ContosoCrafts.WebSite   C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets    75  
  Error          at Microsoft.CodeAnalysis.CommonCompiler..ctor(CommandLineParser parser, String responseFile, String[] args, BuildPaths buildPaths, String additionalReferenceDirectories, IAnalyzerAssemblyLoader assemblyLoader, GeneratorDriverCache driverCache) ContosoCrafts.WebSite   C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets    75  
  Error          at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.Run(String[] args, BuildPaths buildPaths, TextWriter textWriter, IAnalyzerAssemblyLoader analyzerLoader)    ContosoCrafts.WebSite   C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets    75  
  Error          at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunLocalCompilation(String[] arguments, BuildPaths buildPaths, TextWriter textWriter)  ContosoCrafts.WebSite   C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets    75  
  Error          at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunCompilation(IEnumerable`1 originalArguments, BuildPaths buildPaths, TextWriter textWriter, String pipeName) ContosoCrafts.WebSite   C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets    75  
  Error          at Microsoft.CodeAnalysis.CommandLine.BuildClient.Run(IEnumerable`1 arguments, RequestLanguage language, CompileFunc compileFunc, CompileOnServerFunc compileOnServerFunc)   ContosoCrafts.WebSite   C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets    75  
  Error          at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.MainCore(String[] args) ContosoCrafts.WebSite   C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets    75  
  Error          at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(String[] args) ContosoCrafts.WebSite   C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets    75  
  </code></pre>
  <pre><code>Windows cannot access the file C:\Windows\assembly\NativeImages_v4.0.30319_64\Microsoft.Cbf18da00#\d74596cb5c331cf9892003a6171f0b70\Microsoft.CodeAnalysis.ni.dll for one of the following reasons: there is a problem with the network connection, the disk that the file is stored on, or the storage drivers installed on this computer; or the disk is missing. Windows closed the program csc because of this error.
  
  Program: csc
  File: C:\Windows\assembly\NativeImages_v4.0.30319_64\Microsoft.Cbf18da00#\d74596cb5c331cf9892003a6171f0b70\Microsoft.CodeAnalysis.ni.dll
  
  The error value is listed in the Additional Data section.
  User Action
  1. Open the file again. This situation might be a temporary problem that corrects itself when the program runs again.
  2. If the file still cannot be accessed and
      - It is on the network, your network administrator should verify that there is not a problem with the network and that the server can be contacted.
      - It is on a removable disk, for example, a floppy disk or CD-ROM, verify that the disk is fully inserted into the computer.
  3. Check and repair the file system by running CHKDSK. To run CHKDSK, click Start, click Run, type CMD, and then click OK. At the command prompt, type CHKDSK /F, and then press ENTER.
  4. If the problem persists, restore the file from a backup copy.
  5. Determine whether other files on the same disk can be opened. If not, the disk might be damaged. If it is a hard disk, contact your administrator or computer hardware vendor for further assistance.
  
  Additional Data
  Error value: C000009C
  Disk type: 3
  </code></pre>
  <pre><code>Faulting application name: VBCSCompiler.exe, version: 4.100.22.16510, time stamp: 0xabc37d8b
  Faulting module name: clr.dll, version: 4.8.4470.0, time stamp: 0x61b72dcc
  Exception code: 0xc0000006
  Fault offset: 0x00000000000119b6
  Faulting process id: 0x60ec
  Faulting application start time: 0x01d8523b163e69ea
  Faulting application path: C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\VBCSCompiler.exe
  Faulting module path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
  Report Id: e81cf4dc-e1d5-4710-ba3b-1fcb459e55e6
  Faulting package full name: 
  Faulting package-relative application ID: 
  </code></pre>
  <p>What I've tried,</p>
  <ol>
  <li>Repair my Visual Studio IDE.</li>
  <li>Uninstall and Reinstaill my Visual Studio IDE</li>
  <li>Created a new ASP.NET Core Web app project and try to run it... it still gives me build error even if projects just came from templates</li>
  <li>Look into Event viewer</li>
  </ol>