Skip to content

Commit 4c289cd

Browse files
enable diagnostics on tests, others
1 parent 1476a38 commit 4c289cd

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

docs/design/FeatureSwitches.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ The following switches are toggled for applications running on Mono for `TrimMod
1414
| MauiEnableXamlCBindingWithSourceCompilation | Microsoft.Maui.RuntimeFeature.XamlCBindingWithSourceCompilationEnabled | When enabled, MAUI will compile all bindings, including those where the `Source` property is used. |
1515
| MauiHybridWebViewSupported | Microsoft.Maui.RuntimeFeature.IsHybridWebViewSupported | Enables HybridWebView, which makes use of dynamic System.Text.Json serialization features |
1616
| MauiNamescopesSupported | Microsoft.Maui.RuntimeFeature.AreNamescopesSupported | Enable support for Namescopes, FindByName if the application uses it, or to keep supporting runtime and XamlC XAML inflators |
17+
| EnableDiagnostics | Microsoft.Maui.RuntimeFeature.EnableDiagnostics | Enables diagnostic for the running app |
18+
| EnableMauiDiagnostics | Microsoft.Maui.RuntimeFeature.EnableMauiDiagnostics | Enables MAUI specific diagnostics, like VisualDiagnostics and BindingDiagnostics. Defaults to EnableDiagnostics |
1719

1820
## MauiEnableIVisualAssemblyScanning
1921

src/Controls/tests/Core.UnitTests/BindingUnitTests.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,30 @@ namespace Microsoft.Maui.Controls.Core.UnitTests
2020
public class BindingUnitTests
2121
: BindingBaseUnitTests
2222
{
23+
bool enableDiagnosticsInitialState;
24+
public BindingUnitTests()
25+
{
26+
enableDiagnosticsInitialState = RuntimeFeature.EnableDiagnostics;
27+
RuntimeFeature.EnableMauiDiagnostics = true;
28+
}
29+
30+
bool _disposed;
31+
32+
protected virtual void Dispose(bool disposing)
33+
{
34+
if (_disposed)
35+
{
36+
return;
37+
}
38+
39+
if (disposing)
40+
{
41+
RuntimeFeature.EnableMauiDiagnostics = enableDiagnosticsInitialState;
42+
}
43+
44+
_disposed = true;
45+
}
46+
2347
protected override BindingBase CreateBinding(BindingMode mode = BindingMode.Default, string stringFormat = null)
2448
{
2549
return new Binding("Text", mode, stringFormat: stringFormat);

src/Core/src/RuntimeFeature.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Microsoft.Maui
1414
/// </remarks>
1515
static class RuntimeFeature
1616
{
17-
const string FeatureSwitchPrefix = "Microsoft.Maui.RuntimeFeature.";
17+
const string FeatureSwitchPrefix = "Microsoft.Maui.RuntimeFeature";
1818

1919
const bool IsIVisualAssemblyScanningEnabledByDefault = false;
2020
const bool IsShellSearchResultsRendererDisplayMemberNameSupportedByDefault = true;

0 commit comments

Comments
 (0)