Closed Code-DJ closed 1 year ago
hum, by default, using the mauireactor template hot-reload is not configured at all under Release mode:
and running the project in debug the #else branch above shouldn't go in the compile code at all.
are you running the app under Release or Debug? can you post a small project showing the issue?
I have it the same way.
#if DEBUG
.EnableMauiReactorHotReload()
#endif
Run the following in first terminal:
dotnet build -t:Run -f net7.0-ios /p:_DeviceName=:v2:udid=***
Run the following in second terminal:
dotnet-maui-reactor -f net7.0-ios
Changed from static variable and constructor to instance variable and constructor, moved the #if DEBUG
one level up where the class gets instantiated. Closing thanks!
Hi, there is a bug in hot reload - not sure how it works behind the scenes but I assume it builds and loads a new assembly in the background - this assembly is being built in Release mode.
dotnet new maui-reactor-startup
app.SetWindowsSpecificAssetsDirectory("Assets");
so removed it. It's anyway not relevant to this issue.public override VisualNode Render()
{
#if DEBUG
Console.WriteLine("DEBUG");
#else
Console.WriteLine("RELEASE");
#endif
/* rest of the code */
}
dotnet build -t:Run -f net7.0-ios /p:_DeviceName=:v2:udid=EECA5B10-A549-4D07-8A60-0CA944B62766
in terminal.dotnet-maui-reactor -f net7.0-ios
in another terminal.UPDATE: Tried both options, still shows RELEASE.
Looks like it is being built in debug mode but the DEBUG constants is not being set DefineConstants
. Visual Studio automatically does this for us. May be we need to pass it here?
{ "DefineConstants", "DEBUG;TRACE" }
or is it?
{ "DebugSymbols", "true" }
Hi, sorry, but can't look at the issue before Wednesday next week, hopefully it is not a problem for you
Hot reload does not set the DEBUG flag. See example below. On change of any file in the project, hot reload kicks in causing Foo to get recreated but logic doesn't go through
if DEBUG
, writes RELEASE to the console and Bar is set to null.