Hot-reloading issue with specific child class of a generic class
When a class inherits from a generic class with itself as a type argument, FSR tries to hot reload but causes error due to the reference to original class name is missing.
For example, the class below will causes exception when modified inside play mode.
public partial class GameManager : MonoBehaviourSingleton<GameManager>
FSR: Error when updating files: 'GameManager.cs', FastScriptReload.Editor.Compilation.HotReloadCompilationException: Compiler failed to produce the assembly. Output: 'C:\Users\Nugget\AppData\Local\Temp\0fe7e28f1b734ebeb756f4db6ff4d726.SourceCodeCombined.cs(42,152): error CS0246: The type or namespace name 'GameManager' could not be found (are you missing a using directive or an assembly reference?)' ---> System.Exception: Compiler failed to produce the assembly. Output: 'C:\Users\Nugget\AppData\Local\Temp\0fe7e28f1b734ebeb756f4db6ff4d726.SourceCodeCombined.cs(42,152): error CS0246: The type or namespace name 'GameManager' could not be found (are you missing a using directive or an assembly reference?)'
Is it a known or unknown limitation, or a bug?
Don't think I've seen this one yet. Should be fairly easy to fix thought, it just needs a Roslyn rewritter to change that MonoBehaviourSingleton<GameManager> to MonoBehaviourSingleton<GameManager__Changed_>.
This is also mixing partials thought so that could get rough. Right now other partials are pulled in to the same file so maybe that'll work as well.
If you look at generated source code it should give you bit better idea what's not correctly rewritten there
Non-partial classes also causes this problem. I've checked patched code and it does keep the original class name and lose reference.
Like this.
public class CentralPanelManager__Patched_: MonoBehaviourSingleton<CentralPanelManager>
Yes, current limitation, I'd say related to : https://github.com/handzlikchris/FastScriptReload/issues/186
Just need to create these rewrite rules for any token matching the main rewrited class.