Hot Reload doesn't work when changes are made in VS when editor is closed

Build Type: Source build

Build version: 4.11.2

Issue: Compiling in the editor doesn’t work if changes have been made in VS while unreal was closed.

Reproduction:

  1. Open VS solution
  2. Change code
  3. Open unreal
  4. Hit the compile button.
  5. The hot reload will fail and you will see this error in the output log: “LogModuleManager:Warning: ModuleManager: Unable to load module ‘ProjectTest’ because the file ‘P:/necro_test/ProjectTest/Binaries/Win64/UE4Editor-ProjectTest-9302-207.dll’ was not found.”
  6. The Compile button in the unreal toolbar will be gone

To us it looks like unreal is trying to load two hot reloads at the same time (both ProjectTest-9302.dll and ProjectTest-207.dll exist independently, but not together).

Hey Megatron-

I created a new project and added a new actor class. After creating a blueprint for the class I saved/closed the editor, then added a couple of component as well as a float value to the class in code. When I reopened the project the blueprint was still empty. After pressing the compile button in the editor, the blueprint populated with the components and variables added in code. Can you let me know if this is similar to the setup you’re using? If not can you provide the code you edited that did not update when compiling?

Hello ,

It was not specific code, sometimes it just happens when I add or remove comments. I think in order for this bug to occur you must already have a hot reload dll file (ProjectTest-XX.dll). Check in your Binaries folder, make sure you have such a file. If so, close the editor, change some code, then open the editor and try the compile button again.

I have reproduced this in ShooterGame by only adding comments. My configurations settings are Development_Editor for UE4 and the project, and I am using Visual Studio 2015.

Hello . Thanks for the clarification. Yes, that is what I have been doing to get around it, but it does seem like a bug to me.

Hey Meagatron-

I understand what you’re saying now and your original guess was close. What’s happening is that the project is opened (for the first time) with an initial UE4Editor-ProjectTest.dll. When you preform a hot reload it creates a new .dll with a string of numbers appended to the end of this initial dll (in this case -9302) and then replaces the .dll it was using with the newly created one. Subsequent hot reloads will use the initial .dll and append a fresh string of numbers and replace the current dll with the new each time.

What’s happening in this case is when the project opens after the first hot reload, it is using UE4Editor-ProjectTest-9302.dll as the ‘initial’ .dll for that run of the editor. When you preform the hot reload, it appends a new string to the end (-207) and then attempts to replace the .dll it was using (the working -9302.dll) with the new one. The problem occurs because the editor sees -9302-207 and doesn’t recognize it as valid.

The best solution in this case would be to close the editor and compile from Visual Studio which should flush any old hot reload dlls.

The workflow necessary to recreate the issue is not one that is supported by the Engine. It would be best to either preform a hot reload in the same instance that the editor is open or, if the editor is closed, to compile from VS. Closing and reopening the editor to preform a hot reload is not ideal

I hate to re-open, but this seems to be reproducing even without closing the editor now. I keep having to close the editor and rebuild in VS after a few compiles in the editor, because the hot reload fails with that error.

Are you still seeing the “-####-####” that was originally shown in the erroring .dll file? Does this new behavior reproduce in a new project (create and hot reload a number of times)? How many times are you able to hot reload before you get an error? Keep in mind that is it a good idea to preform a compile with the editor closed every so often in order to flush out old .dlls to reduce the chances of hot reload issues arising.

Yes I am still seeing that error. Right now I am not able to hot reload at all. I’ve noticed that the ProjectName-XXXX.dll files do not disappear from the Binary folder when I build from VS. If I delete them all and then build, it works for a little while before this reoccurs, though it asks me to rebuild because my .dll is out of date (I imagine since they are looking for the XXXX.dll version). I will try in a new project and let you know.

Hey Meagatron-

Were you able to test if you have the same issue in a new project? If you are still having problems, can you try deleting the .dll as you mention and then run Generate Project Files from the .uproject to refresh the .sln and see if you still have hot reload problems?

A had a similar issue with hot reload.I fixed it by ensuring that the “Solution-Configurations” in VS2015 are set to “Development Editor”.

(UE: 4.18.3. / VS2015)