Files access problem

Hello. I’m usingUnreal Engine 5.3 and Visual Studio 2022. There is a problem Im having for a long time and its getting really anoying. If Im editing the file in Visual Studio anytime I want to save it (either for building in Visual Studio or compiling in Unreal) I cant save the file. So it cant overwrite the file and it ask me where do I want to save as instead of automatically overwrite the old one. If i choose to save over the old one it says it cant overwrite it.

I press save like 10 to 20 times until it finally works. It doesn’t happen all the time but enough times to drive me insane especially when Im deep into coding and this seems like a distraction.

Ive run Visual Studio as a administrator, Ive reinstalled everything even Windows at some point and it still happens.

If I manage to save it sometimes in unreal I get this error:

Unhandled exception: System.Exception: Error while creating log file “C:\Users\balan\AppData\Local\UnrealBuildTool\Log.txt”
—> System.IO.IOException: The process cannot access the file ‘C:\Users\balan\AppData\Local\UnrealBuildTool\Log.json’ because it is being used by another process.
at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.OSFileStreamStrategy…ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
at System.IO.File.Open(String path, FileMode mode, FileAccess access, FileShare share)
at EpicGames.Core.FileReference.Open(FileReference location, FileMode mode, FileAccess access, FileShare share) in D:\UE_5.3\UE_5.3\Engine\Source\Programs\Shared\EpicGames.Core\FileReference.cs:line 432
at EpicGames.Core.DefaultLogger.AddFileWriter(String name, FileReference outputFile) in D:\UE_5.3\UE_5.3\Engine\Source\Programs\Shared\EpicGames.Core\Log.cs:line 1101
— End of inner exception stack trace —
at EpicGames.Core.DefaultLogger.AddFileWriter(String name, FileReference outputFile) in D:\UE_5.3\UE_5.3\Engine\Source\Programs\Shared\EpicGames.Core\Log.cs:line 1108
at EpicGames.Core.Log.AddFileWriterWithoutBackup(String name, FileReference outputFile) in D:\UE_5.3\UE_5.3\Engine\Source\Programs\Shared\EpicGames.Core\Log.cs:line 285
at EpicGames.Core.Log.AddFileWriter(String name, FileReference outputFile) in D:\UE_5.3\UE_5.3\Engine\Source\Programs\Shared\EpicGames.Core\Log.cs:line 272
at UnrealBuildTool.BuildMode.ExecuteAsync(CommandLineArguments Arguments, ILogger Logger) in D:\UE_5.3\UE_5.3\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 0
at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in D:\UE_5.3\UE_5.3\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 659

So seems it’s a problem accessing and saving files because they are used by another process I suppose. But even after installing a fresh OS and all the tools again (Visual Studio, Unreal Editor) it does the same I dont understand why.
I dont have any antivirus active

Perhaps the tips in this thread can help you

It could also be windows defender that could be scanning in parallel. You can try to add your project and unreal engine (your version 5.3) to it’s folder scanning exceptions.

To be honest i forgat to mention that I disabled The Realtime Protection just to make sure thats not the problem and it still doest the same. Thanks for suggestion.
Also it doesnt help with the main problem that is saving the file, the cpp or h file after I finish editing it.

While working in vs do you have unreal open at the same time? Is live coding enabled in it by any chance?

This could conflict with the files access.

Well I am using Live Coding. But whats the point of Live coding if I cant edit the files needed to rebuild the code and load it in the editor ?

Live coding conflicts with vs on many levels. It is prone to overwriting files, pushing back old versions of code and breaks on many occasions.

It’s better to just build in vs with ctrl + b while unreal is running and it will let you know with a sound byte that the code is compiled and reloaded.