adospace / reactorui-maui

MauiReactor is a MVU UI framework built on top of .NET MAUI
MIT License
586 stars 49 forks source link

Hot reload fails when using partial class with GeneratedRegex #73

Closed Code-DJ closed 1 year ago

Code-DJ commented 1 year ago

Hot reload throws an error if GeneratedRegex is used.

To test, add the following class to any project and try using hot reload:

public partial class Test
{
    [System.Text.RegularExpressions.GeneratedRegex("-")]
    private static partial System.Text.RegularExpressions.Regex MyRegex();
}

You will get the following error:

error CS8795: Partial method 'Test.MyRegex()' must have an implementation part because it has accessibility modifiers.

adospace commented 1 year ago

Hi, simple mode can't handle source generators, for that to work you need to opt in for full mode: add -m Full to dotnet-maui-reactor command.

Another option is to put this function in a secondary assembly/project linked to the main project that will not be hot-reloaded.

Hope it helps!

Code-DJ commented 1 year ago

Cool, thanks for the amazing library!