Skip to content

Commit

Permalink
added code reloading attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiMisiukevich committed Apr 10, 2020
1 parent 5a1febf commit 9ef0c63
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
27 changes: 17 additions & 10 deletions Reloader/Xamarin.Forms.HotReload.Reloader/HotReloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,25 @@ public ReloaderStartupInfo Run(Application app, Configuration config = null)
}
});

Task.Run(() =>
if (config.CodeReloadingEnabled)
{
try
Task.Run(() =>
{
var testType = HotCompiler.Current.Compile("public class TestHotCompiler { }", "TestHotCompiler");
HotCompiler.IsSupported = testType != null;
}
catch
{
HotCompiler.IsSupported = false;
}
});
try
{
var testType = HotCompiler.Current.Compile("public class TestHotCompiler { }", "TestHotCompiler");
HotCompiler.IsSupported = testType != null;
}
catch
{
HotCompiler.IsSupported = false;
}
});
}
else
{
HotCompiler.IsSupported = false;
}

return new ReloaderStartupInfo
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public sealed class Configuration
public int ExtensionAutoDiscoveryPort { internal get; set; }

public PreviewerMode PreviewerDefaultMode { get; set; }

/// <summary>
/// C# code reloading
/// </summary>
public bool CodeReloadingEnabled { get; set; } = true;
}

public sealed class ReloaderStartupInfo
Expand Down

0 comments on commit 9ef0c63

Please sign in to comment.