UnrealHeaderTool System.AccessViolationException: Attempted to read or write protected memory

So, 5.5.4. Upgrading project from the latest 5.3.

I get random memory access errors from UHT. Sometimes all is fine, but usually all is not. Error texts and stack differ, for example:

Random error 0
Build started at 20:55...
1>------ Skipped Build: Project: UE5, Configuration: BuiltWithUnrealBuildTool Win64 ------
1>Project not selected to build for this solution configuration 
2>------ Build started: Project: Primitive, Configuration: DebugGame_Editor x64 ------
2>Using bundled DotNet SDK version: 8.0.300
2>Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" PrimitiveEditor Win64 DebugGame -Project="C:\Work\Primitive\Primitive.uproject" -WaitMutex -FromMsBuild -architecture=x64
2>Log file: C:\Users\EdelweissPC\AppData\Local\UnrealBuildTool\Log.txt
2>Using 'git status' to determine working set for adaptive non-unity build (C:\Work\Primitive).
2>Parsing headers for PrimitiveEditor
2>  Running Internal UnrealHeaderTool C:\Work\Primitive\Primitive.uproject C:\Work\Primitive\Intermediate\Build\Win64\PrimitiveEditor\DebugGame\PrimitiveEditor.uhtmanifest -WarningsAsErrors -installed
2>Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
2>   at EpicGames.Core.CityHash.WeakHashLen32WithSeeds(UInt64, UInt64, UInt64, UInt64, UInt64, UInt64)
2>   at EpicGames.Core.CityHash.WeakHashLen32WithSeeds(Byte*, UInt64, UInt64)
2>   at EpicGames.Core.CityHash.CityHash64(Byte*, UInt32)
2>   at EpicGames.Core.CityHash.CityHash64WithSeeds(Byte*, UInt32, UInt64, UInt64)
2>   at EpicGames.Core.CityHash.CityHash64WithSeed(Byte*, UInt32, UInt64)
2>   at EpicGames.UHT.Utils.UhtHash.HashText(System.ReadOnlySpan`1<Char>)
2>   at EpicGames.UHT.Utils.UhtHash.Add(System.ReadOnlySpan`1<Char>)
2>   at EpicGames.UHT.Utils.UhtHash.GenenerateTextHash(System.ReadOnlySpan`1<Char>)
2>   at EpicGames.UHT.Exporters.CodeGen.UhtHeaderCodeGeneratorCppFile.AppendFunction(System.Text.StringBuilder, EpicGames.UHT.Types.UhtFunction, Boolean)
2>   at EpicGames.UHT.Exporters.CodeGen.UhtHeaderCodeGeneratorCppFile.AppendClassFunction(System.Text.StringBuilder, EpicGames.UHT.Types.UhtClass, EpicGames.UHT.Types.UhtFunction)
2>   at EpicGames.UHT.Exporters.CodeGen.UhtHeaderCodeGeneratorCppFile.Generate(EpicGames.UHT.Utils.IUhtExportFactory)
2>   at EpicGames.UHT.Exporters.CodeGen.UhtCodeGenerator+<>c__DisplayClass24_0.<Generate>b__1(EpicGames.UHT.Utils.IUhtExportFactory)
2>   at EpicGames.UHT.Utils.UhtExportFactory+<>c__DisplayClass29_0.<CreateTask>b__4()
2>   at EpicGames.UHT.Utils.UhtSession.TryNoErrorCheck(EpicGames.UHT.Utils.IUhtMessageSource, System.Action)
2>   at EpicGames.UHT.Utils.UhtExportFactory+<>c__DisplayClass29_0.<CreateTask>b__2(System.Threading.Tasks.Task[])
2>   at System.Threading.Tasks.TaskFactory`1+<>c[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<ContinueWhenAllImpl>b__57_1(System.Threading.Tasks.Task`1<System.Threading.Tasks.Task[]>, System.Object)
2>   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].InnerInvoke()
2>   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
2>   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
2>   at System.Threading.ThreadPoolWorkQueue.Dispatch()
2>   at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command ""C:\Program Files\Epic Games\UE_5.5\Engine\Build\BatchFiles\Build.bat" PrimitiveEditor Win64 DebugGame -Project="C:\Work\Primitive\Primitive.uproject" -WaitMutex -FromMsBuild -architecture=x64" exited with code -1073741819.
2>Done building project "Primitive.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 50 up-to-date, 1 skipped ==========
========== Build completed at 20:55 and took 12,604 seconds ==========
Random error 1
Build started at 19:06...
1>------ Skipped Build: Project: UE5, Configuration: BuiltWithUnrealBuildTool Win64 ------
1>Project not selected to build for this solution configuration 
2>------ Build started: Project: Primitive, Configuration: DebugGame_Editor x64 ------
2>Using bundled DotNet SDK version: 8.0.300
2>Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" PrimitiveEditor Win64 DebugGame -Project="C:\Work\Primitive\Primitive.uproject" -WaitMutex -FromMsBuild -architecture=x64
2>Log file: C:\Users\EdelweissPC\AppData\Local\UnrealBuildTool\Log.txt
2>Using 'git status' to determine working set for adaptive non-unity build (C:\Work\Primitive).
2>Parsing headers for PrimitiveEditor
2>  Running Internal UnrealHeaderTool C:\Work\Primitive\Primitive.uproject C:\Work\Primitive\Intermediate\Build\Win64\PrimitiveEditor\DebugGame\PrimitiveEditor.uhtmanifest -WarningsAsErrors -installed
2>Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
2>   at EpicGames.Core.CityHash.Fetch32(Byte*)
2>   at EpicGames.Core.CityHash.Fetch64(Byte*)
2>   at EpicGames.Core.CityHash.HashLen33to64(Byte*, UInt32)
2>   at EpicGames.Core.CityHash.CityHash64(Byte*, UInt32)
2>   at EpicGames.Core.CityHash.CityHash64WithSeeds(Byte*, UInt32, UInt64, UInt64)
2>   at EpicGames.Core.CityHash.CityHash64WithSeed(Byte*, UInt32, UInt64)
2>   at EpicGames.UHT.Utils.UhtHash.HashText(System.ReadOnlySpan`1<Char>)
2>   at EpicGames.UHT.Utils.UhtHash.Add(System.ReadOnlySpan`1<Char>)
2>   at EpicGames.UHT.Utils.UhtHash.GenenerateTextHash(System.ReadOnlySpan`1<Char>)
2>   at EpicGames.UHT.Exporters.CodeGen.UhtHeaderCodeGeneratorCppFile.Generate(EpicGames.UHT.Utils.IUhtExportFactory)
2>   at EpicGames.UHT.Exporters.CodeGen.UhtCodeGenerator+<>c__DisplayClass24_0.<Generate>b__1(EpicGames.UHT.Utils.IUhtExportFactory)
2>   at EpicGames.UHT.Utils.UhtExportFactory+<>c__DisplayClass29_0.<CreateTask>b__4()
2>   at EpicGames.UHT.Utils.UhtSession.TryNoErrorCheck(EpicGames.UHT.Utils.IUhtMessageSource, System.Action)
2>   at EpicGames.UHT.Utils.UhtExportFactory+<>c__DisplayClass29_0.<CreateTask>b__2(System.Threading.Tasks.Task[])
2>   at System.Threading.Tasks.TaskFactory`1+<>c[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<ContinueWhenAllImpl>b__57_1(System.Threading.Tasks.Task`1<System.Threading.Tasks.Task[]>, System.Object)
2>   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].InnerInvoke()
2>   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
2>   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
2>   at System.Threading.ThreadPoolWorkQueue.Dispatch()
2>   at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command ""C:\Program Files\Epic Games\UE_5.5\Engine\Build\BatchFiles\Build.bat" PrimitiveEditor Win64 DebugGame -Project="C:\Work\Primitive\Primitive.uproject" -WaitMutex -FromMsBuild -architecture=x64" exited with code -1073741819.
2>Done building project "Primitive.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========
========== Build completed at 19:07 and took 03,030 seconds ==========
Random error 2
Build started at 20:29...
1>------ Skipped Build: Project: UE5, Configuration: BuiltWithUnrealBuildTool Win64 ------
1>Project not selected to build for this solution configuration 
2>------ Build started: Project: Primitive, Configuration: DebugGame_Editor x64 ------
2>Using bundled DotNet SDK version: 8.0.300
2>Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" PrimitiveEditor Win64 DebugGame -Project="C:\Work\Primitive\Primitive.uproject" -WaitMutex -FromMsBuild -architecture=x64
2>Log file: C:\Users\EdelweissPC\AppData\Local\UnrealBuildTool\Log.txt
2>Using 'git status' to determine working set for adaptive non-unity build (C:\Work\Primitive).
2>Parsing headers for PrimitiveEditor
2>  Running Internal UnrealHeaderTool C:\Work\Primitive\Primitive.uproject C:\Work\Primitive\Intermediate\Build\Win64\PrimitiveEditor\DebugGame\PrimitiveEditor.uhtmanifest -WarningsAsErrors -installed
2>Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
2>   at EpicGames.UHT.Tokenizer.UhtTokenBufferReader.PeekToken()
2>   at EpicGames.UHT.Tokenizer.UhtTokenBufferReader.GetToken()
2>   at EpicGames.UHT.Tokenizer.UhtTokenReaderUtilityExtensions.SkipDeclaration(EpicGames.UHT.Tokenizer.IUhtTokenReader, EpicGames.UHT.Tokenizer.UhtToken ByRef)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.ParseStatement(EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Tokenizer.UhtToken ByRef, Boolean)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.ParseStatements(Char, Char, Boolean)
2>   at EpicGames.UHT.Parsers.UhtClassParser.ParseUClass(EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Tokenizer.UhtToken ByRef)
2>   at EpicGames.UHT.Parsers.UhtClassParser.UCLASSKeyword(EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Tokenizer.UhtToken ByRef)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.DispatchKeyword(EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Tokenizer.UhtToken ByRef)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.ParseStatement(EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Tokenizer.UhtToken ByRef, Boolean)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.ParseStatements(Char, Char, Boolean)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.ParseStatements()
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.Parse(EpicGames.UHT.Types.UhtHeaderFile)
2>   at EpicGames.UHT.Utils.UhtSession+<>c.<StepParseHeaders>b__218_0(EpicGames.UHT.Types.UhtHeaderFile)
2>   at EpicGames.UHT.Utils.UhtSession.TryHeader(System.Action`1<EpicGames.UHT.Types.UhtHeaderFile>, EpicGames.UHT.Types.UhtHeaderFile)
2>   at EpicGames.UHT.Utils.UhtSession+<>c__DisplayClass187_0.<ForEachHeaderNoErrorCheck>b__0(EpicGames.UHT.Types.UhtHeaderFile)
2>   at System.Threading.Tasks.Parallel+<>c__DisplayClass19_0`2[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<ForWorker>b__1(System.Threading.Tasks.RangeWorker ByRef, Int64, Boolean ByRef)
2>   at System.Threading.Tasks.TaskReplicator+Replica.Execute()
2>   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
2>   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
2>   at System.Threading.ThreadPoolWorkQueue.Dispatch()
2>   at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command ""C:\Program Files\Epic Games\UE_5.5\Engine\Build\BatchFiles\Build.bat" PrimitiveEditor Win64 DebugGame -Project="C:\Work\Primitive\Primitive.uproject" -WaitMutex -FromMsBuild -architecture=x64" exited with code -1073741819.
2>Done building project "Primitive.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========
========== Build completed at 20:29 and took 02,522 seconds ==========
Random error 3
Build started at 20:36...
1>------ Skipped Build: Project: UE5, Configuration: BuiltWithUnrealBuildTool Win64 ------
1>Project not selected to build for this solution configuration 
2>------ Build started: Project: Primitive, Configuration: DebugGame_Editor x64 ------
2>Using bundled DotNet SDK version: 8.0.300
2>Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" PrimitiveEditor Win64 DebugGame -Project="C:\Work\Primitive\Primitive.uproject" -WaitMutex -FromMsBuild -architecture=x64
2>Log file: C:\Users\EdelweissPC\AppData\Local\UnrealBuildTool\Log.txt
2>Using 'git status' to determine working set for adaptive non-unity build (C:\Work\Primitive).
2>Invalidating makefile for PrimitiveEditor (working set of source files changed)
2>Available x64 toolchains (1):
2> * C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808
2>    (Family=14.43.34808, FamilyRank=1, Version=14.43.34809, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64)
2>Unavailable x64 toolchains (3):
2> * C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807
2>    (Family=14.40.33807, FamilyRank=1, Version=14.40.33820, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64, Error="UnrealBuildTool has banned the MSVC 14.40.33807-14.40.99999 toolchains due to compiler issues. Please install a different toolchain such as 14.38.33130 by opening the generated solution and installing recommended components or from the Visual Studio installer.")
2> * C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822
2>    (Family=14.37.32822, FamilyRank=1, Version=14.37.32826, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64, Error="UnrealBuildTool requires at minimum the MSVC 14.38.33130 toolchain. Please install a later toolchain such as 14.38.33130 from the Visual Studio installer.")
2> * C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133
2>    (Family=14.29.30133, FamilyRank=1, Version=14.29.30159, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64, Error="UnrealBuildTool requires at minimum the MSVC 14.38.33130 toolchain. Please install a later toolchain such as 14.38.33130 from the Visual Studio installer.")
2>Visual Studio 2022 compiler version 14.43.34809 is not a preferred version. Please use the latest preferred version 14.38.33130
2>Library 'Shlwapi.lib' was not resolvable to a file when used in Module 'RocksDB', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.
2>Plugin 'RealtimeMeshComponent' depends on plugin 'StructUtils' which was deprecated in 5.5 and will soon be removed. Please update your dependencies.
2>Parsing headers for PrimitiveEditor
2>  Running Internal UnrealHeaderTool C:\Work\Primitive\Primitive.uproject C:\Work\Primitive\Intermediate\Build\Win64\PrimitiveEditor\DebugGame\PrimitiveEditor.uhtmanifest -WarningsAsErrors -installed
2>Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
2>   at System.String.op_Implicit(System.String)
2>   at EpicGames.UHT.Tokenizer.UhtToken.IsValue(System.String, Boolean)
2>   at EpicGames.UHT.Tokenizer.UhtToken.IsSymbol(System.String)
2>   at EpicGames.UHT.Tokenizer.UhtTokenReaderGeneralExtensions.OptionalAttributes(EpicGames.UHT.Tokenizer.IUhtTokenReader, Boolean, System.Action`1<System.String>)
2>   at EpicGames.UHT.Parsers.UhtEnumParser+<>c__DisplayClass1_0.<ParseUEnum>b__0()
2>   at EpicGames.UHT.Tokenizer.UhtTokenReaderFlowControlExtensions.RequireList(EpicGames.UHT.Tokenizer.IUhtTokenReader, Char, Char, Boolean, System.Object, System.Action)
2>   at EpicGames.UHT.Tokenizer.UhtTokenReaderFlowControlExtensions.RequireList(EpicGames.UHT.Tokenizer.IUhtTokenReader, Char, Char, Boolean, System.Action)
2>   at EpicGames.UHT.Parsers.UhtEnumParser.ParseUEnum(EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Tokenizer.UhtToken)
2>   at EpicGames.UHT.Parsers.UhtEnumParser.UENUMKeyword(EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Tokenizer.UhtToken ByRef)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.DispatchKeyword(EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Tokenizer.UhtToken ByRef)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.ParseStatement(EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Tokenizer.UhtToken ByRef, Boolean)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.ParseStatements(Char, Char, Boolean)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.ParseStatements()
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.Parse(EpicGames.UHT.Types.UhtHeaderFile)
2>   at EpicGames.UHT.Utils.UhtSession+<>c.<StepParseHeaders>b__218_0(EpicGames.UHT.Types.UhtHeaderFile)
2>   at EpicGames.UHT.Utils.UhtSession.TryHeader(System.Action`1<EpicGames.UHT.Types.UhtHeaderFile>, EpicGames.UHT.Types.UhtHeaderFile)
2>   at EpicGames.UHT.Utils.UhtSession+<>c__DisplayClass187_0.<ForEachHeaderNoErrorCheck>b__0(EpicGames.UHT.Types.UhtHeaderFile)
2>   at System.Threading.Tasks.Parallel+<>c__DisplayClass19_0`2[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<ForWorker>b__1(System.Threading.Tasks.RangeWorker ByRef, Int64, Boolean ByRef)
2>   at System.Threading.Tasks.TaskReplicator+Replica.Execute()
2>   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
2>   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
2>   at System.Threading.ThreadPoolWorkQueue.Dispatch()
2>   at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command ""C:\Program Files\Epic Games\UE_5.5\Engine\Build\BatchFiles\Build.bat" PrimitiveEditor Win64 DebugGame -Project="C:\Work\Primitive\Primitive.uproject" -WaitMutex -FromMsBuild -architecture=x64" exited with code -1073741819.
2>Done building project "Primitive.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========
========== Build completed at 20:36 and took 13,444 seconds ==========
Random error 4
Build started at 20:58...
1>------ Skipped Build: Project: UE5, Configuration: BuiltWithUnrealBuildTool Win64 ------
1>Project not selected to build for this solution configuration 
2>------ Build started: Project: Primitive, Configuration: DebugGame_Editor x64 ------
2>Using bundled DotNet SDK version: 8.0.300
2>Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" PrimitiveEditor Win64 DebugGame -Project="C:\Work\Primitive\Primitive.uproject" -WaitMutex -FromMsBuild -architecture=x64
2>Log file: C:\Users\EdelweissPC\AppData\Local\UnrealBuildTool\Log.txt
2>Using 'git status' to determine working set for adaptive non-unity build (C:\Work\Primitive).
2>Parsing headers for PrimitiveEditor
2>  Running Internal UnrealHeaderTool C:\Work\Primitive\Primitive.uproject C:\Work\Primitive\Intermediate\Build\Win64\PrimitiveEditor\DebugGame\PrimitiveEditor.uhtmanifest -WarningsAsErrors -installed
2>Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
2>   at EpicGames.UHT.Tokenizer.UhtTokenBufferReader.InternalGetChar(System.ReadOnlySpan`1<Char>)
2>   at EpicGames.UHT.Tokenizer.UhtTokenBufferReader.SkipWhitespaceAndCommentsInternal(Boolean ByRef, Boolean)
2>   at EpicGames.UHT.Tokenizer.UhtTokenBufferReader.GetTokenInternal(Boolean)
2>   at EpicGames.UHT.Tokenizer.UhtTokenBufferReader.PeekToken()
2>   at EpicGames.UHT.Tokenizer.UhtTokenReaderGeneralExtensions.TryOptional(EpicGames.UHT.Tokenizer.IUhtTokenReader, Char)
2>   at EpicGames.UHT.Tokenizer.UhtTokenReaderFlowControlExtensions.TryOptionalList(EpicGames.UHT.Tokenizer.IUhtTokenReader, Char, Char, Char, Boolean, System.Action)
2>   at EpicGames.UHT.Parsers.UhtSpecifierParser.ReadValueList()
2>   at EpicGames.UHT.Parsers.UhtSpecifierParser.TryParseValue(EpicGames.UHT.Tables.UhtSpecifierValueType, System.Object ByRef)
2>   at EpicGames.UHT.Parsers.UhtSpecifierParser.ParseInternal()
2>   at EpicGames.UHT.Tokenizer.UhtTokenReaderFlowControlExtensions.RequireList(EpicGames.UHT.Tokenizer.IUhtTokenReader, Char, Char, Boolean, System.Object, System.Action)
2>   at EpicGames.UHT.Tokenizer.UhtTokenReaderFlowControlExtensions.RequireList(EpicGames.UHT.Tokenizer.IUhtTokenReader, Char, Char, Char, Boolean, System.Object, System.Action)
2>   at EpicGames.UHT.Tokenizer.UhtTokenReaderFlowControlExtensions.RequireList(EpicGames.UHT.Tokenizer.IUhtTokenReader, Char, Char, Char, Boolean, System.Action)
2>   at EpicGames.UHT.Parsers.UhtSpecifierParser.ParseSpecifiers()
2>   at EpicGames.UHT.Parsers.UhtClassParser.ParseUClass(EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Tokenizer.UhtToken ByRef)
2>   at EpicGames.UHT.Parsers.UhtClassParser.UCLASSKeyword(EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Tokenizer.UhtToken ByRef)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.DispatchKeyword(EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Tokenizer.UhtToken ByRef)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.ParseStatement(EpicGames.UHT.Parsers.UhtParsingScope, EpicGames.UHT.Tokenizer.UhtToken ByRef, Boolean)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.ParseStatements(Char, Char, Boolean)
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.ParseStatements()
2>   at EpicGames.UHT.Parsers.UhtHeaderFileParser.Parse(EpicGames.UHT.Types.UhtHeaderFile)
2>   at EpicGames.UHT.Utils.UhtSession+<>c.<StepParseHeaders>b__218_0(EpicGames.UHT.Types.UhtHeaderFile)
2>   at EpicGames.UHT.Utils.UhtSession.TryHeader(System.Action`1<EpicGames.UHT.Types.UhtHeaderFile>, EpicGames.UHT.Types.UhtHeaderFile)
2>   at EpicGames.UHT.Utils.UhtSession+<>c__DisplayClass187_0.<ForEachHeaderNoErrorCheck>b__0(EpicGames.UHT.Types.UhtHeaderFile)
2>   at System.Threading.Tasks.Parallel+<>c__DisplayClass19_0`2[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<ForWorker>b__1(System.Threading.Tasks.RangeWorker ByRef, Int64, Boolean ByRef)
2>   at System.Threading.Tasks.TaskReplicator+Replica.Execute()
2>   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
2>   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
2>   at System.Threading.ThreadPoolWorkQueue.Dispatch()
2>   at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command ""C:\Program Files\Epic Games\UE_5.5\Engine\Build\BatchFiles\Build.bat" PrimitiveEditor Win64 DebugGame -Project="C:\Work\Primitive\Primitive.uproject" -WaitMutex -FromMsBuild -architecture=x64" exited with code -1073741819.
2>Done building project "Primitive.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 50 up-to-date, 1 skipped ==========
========== Build completed at 20:58 and took 13,463 seconds ==========

I was switching toolchain, I was trying to install/uninstall .NET for studio. The problem is I just do not understand what’s going on.