FastScriptReload icon indicating copy to clipboard operation
FastScriptReload copied to clipboard

Hot overload failure

Open SiMaLaoShi opened this issue 2 years ago • 2 comments

FSR: HOW TO FIX - INSTRUCTIONS:

  1. Open file that caused issue by looking at error log starting with: 'FSR: Compilation error: temporary files were not removed so they can be inspected: '. And click on file path to open.
  2. Look up other error in the console, which will be like 'Error When updating files:' - this one contains exact line that failed to compile (in XXX_SourceCodeGenerated.cs file). Those are same compilation errors as you see in Unity/IDE when developing.
  3. Read compiler error message as it'll help understand the issue

Error could be caused by a normal compilation issue that you created in source file (eg typo), in that case please fix and it'll recompile.

It's possible compilation fails due to existing limitation, in that case:

You can quickly specify custom script rewrite override for part of code that's failing.

Please use project panel to:

  1. Right-click on the original file that has compilation issue
  2. Click Fast Script Reload -> Add / Open User Script Rewrite Override
  3. Read top comment in opened file and it'll explain how to create overrides

I'm continuously working on mitigating limitations.

If you could please get in touch with me via '[email protected]' and include error you see in the console as well as created files (from paths in previous error). This way I can get it fixed for you.

You can also:

  1. Look at 'limitation' section in the docs - which will explain bit more around limitations and workarounds
  2. Move some of the code that you want to work on to different file - compilation happens on whole file, if you have multiple types there it could increase the chance of issues
  3. Have a look at compilation error, it shows error line (in the '*.SourceCodeCombined.cs' file, it's going to be something that compiler does not accept, likely easy to spot. To workaround you can change that part of code in original file. It's specific patterns that'll break it.

If you want to prevent that message from reappearing please go to Window -> Fast Script Reload -> Start Screen -> Logging -> tick off 'Log how to fix message on compilation error' UnityEngine.Logger:Log (UnityEngine.LogType,object) ImmersiveVrToolsCommon.Runtime.Logging.LoggerScoped:LogInternal (UnityEngine.LogType,object) ImmersiveVrToolsCommon.Runtime.Logging.LoggerScoped:LogWarning (object) FastScriptReload.Editor.Compilation.DotnetExeDynamicCompilation:Compile (System.Collections.Generic.List1<string>,ImmersiveVRTools.Runtime.Common.UnityMainThreadDispatcher) (at Assets/FastScriptReload/Scripts/Editor/Compilation/DotnetExeCompilator.cs:110) FastScriptReload.Editor.Compilation.DynamicAssemblyCompiler:Compile (System.Collections.Generic.List1,ImmersiveVRTools.Runtime.Common.UnityMainThreadDispatcher) (at Assets/FastScriptReload/Scripts/Editor/Compilation/DynamicAssemblyCompiler.cs:23) FastScriptReload.Editor.FastScriptReloadManager/<>c__DisplayClass45_1:<TriggerReloadForChangedFiles>b__2 () (at Assets/FastScriptReload/Scripts/Editor/FastScriptReloadManager.cs:367) System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()

SiMaLaoShi avatar Apr 12 '23 06:04 SiMaLaoShi

image image

SiMaLaoShi avatar Apr 12 '23 06:04 SiMaLaoShi

for some reason those 2 references were picked up. Usually that means one of your assemblies will be refrencing version A and other version B.

I'll have a think what's the best way for that, in the meantime you can just do a distinct in method FastScriptReload.Editor.Compilation.DynamicCompilationBase.ResolveReferencesToAdd This should only then pick up one version.

Alternatively you can make sure that your code is actually only referencing one version of that System.Drawing

handzlikchris avatar Apr 12 '23 08:04 handzlikchris