Editor lag frequently after compile failed

Hi everyone, I’m new to UE C++. I have tried all the methods on the Internet but still cannot solve them. Can someone help?

Problems:

  1. Extremely long time during 0>Running UnrealBuildTool: dotnet session
  2. The editor will lag every 2-3 seconds after manually stopping the building process

Details:
I was using VS2022 and changed to Rider recently, but the problem is always there. The compiling process will always stuck at 0>Running UnrealBuildTool: dotnet and the CPU usage doesn’t change either.

Usually, I have to stop the building process manually, but the UE editor will become super laggy, and I have to close the editor completely then recompile the project in the IDE, and reopen the editor to keep working on it. But even when I compile the project in IDE, it still takes a long time during the 0>Running UnrealBuildTool: dotnet session.

0>Total time in Parallel executor: 1.13 seconds
0>Total execution time: 115.55 seconds

System spec:
i7 13700kf, 32G RAM, on Windows 11.