From 1450ce6e3c5fbccedc07cc76e8d9bb2f2c64b38a Mon Sep 17 00:00:00 2001 From: David Britch Date: Mon, 2 Oct 2023 10:28:31 +0100 Subject: [PATCH 1/5] Enable logging in Blazor Hybrid apps. --- docs/troubleshooting.md | 11 ++++- docs/user-interface/controls/blazorwebview.md | 49 ++++++++++++++++++- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 19e5fd9d1d..15b1b6ca95 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -1,7 +1,7 @@ --- title: "Troubleshoot known issues" description: "Learn about .NET MAUI known issues and troubleshooting you can do to resolve these issues." -ms.date: 03/08/2023 +ms.date: 10/02/2023 --- # Troubleshooting known issues @@ -182,3 +182,12 @@ If you receive the error "Could not find a valid Xcode app bundle at '/Library/D ```zsh sudo xcode-select --reset ``` + +## + + has built-in logging that can help you diagnose problems in your Blazor Hybrid app. There are two steps to enable this logging: + +1. Enable and related components to log diagnostic information. +1. Configure a logger to write the log output to where you can view it. + +For more information, see [Diagnosing issues in Blazor Hybrid apps](~/user-interface/controls/blazorwebview.md#diagnosing-issues). diff --git a/docs/user-interface/controls/blazorwebview.md b/docs/user-interface/controls/blazorwebview.md index f833fbb0ad..f3fbec00bd 100644 --- a/docs/user-interface/controls/blazorwebview.md +++ b/docs/user-interface/controls/blazorwebview.md @@ -138,7 +138,7 @@ The process to add a has a `TryDispatchAsync` method that calls a specified `Action` asynchronously and passes in the scoped services available in Razor components. This enables code from the native UI to access scoped services such as `NavigationManager`: + has a `TryDispatchAsync` method that can call a specified `Action` asynchronously and pass in the scoped services available in Razor components. This enables code from the native UI to access scoped services such as `NavigationManager`: ```csharp private async void MyMauiButtonHandler(object sender, EventArgs e) @@ -156,4 +156,51 @@ private async void MyMauiButtonHandler(object sender, EventArgs e) } ``` +## Diagnosing issues + + has built-in logging that can help you diagnose issues in your Blazor Hybrid app. There are two steps to enable this logging: + +1. Enable and related components to log diagnostic information. +1. Configure a logger to write the log output to where you can view it. + +For more information about logging, see [Logging in C# and .NET](/dotnet/core/extensions/logging). + +### Enable BlazorWebView logging + +All logging configuration can be performed as part of service registration in the dependency injection system. To enable maximum logging for and related components under the `Microsoft.AspNetCore.Components.WebView` namespace, add the following code to where your app's services are registered: + +```csharp +services.AddLogging(logging => +{ + logging.AddFilter("Microsoft.AspNetCore.Components.WebView", LogLevel.Trace); +}); +``` + +Alternatively, to enable maximum logging for every component that uses `Microsoft.Extensions.Logging`, you could use the following code: + +```csharp +services.AddLogging(logging => +{ + logging.SetMinimumLevel(LogLevel.Trace); +}); +``` + +### Configure logging output and viewing the output + +After configuring components to write log information you need to configure where the loggers should write the logs to, and then view the log output. + +The **Debug** logging providers write the output using `Debug` statements, and the output can be viewed from Visual Studio. + +To configure the **Debug** logging provider, first add a reference in your project to the `Microsoft.Extensions.Logging.Debug` NuGet package. Then register the provider inside the call to `AddLogging` that you added in the previous step by calling the `AddDebug` extension method: + +```csharp +services.AddLogging(logging => +{ + logging.AddFilter("Microsoft.AspNetCore.Components.WebView", LogLevel.Trace); + logging.AddDebug(); +}); +``` + +When you run the app from Visual Studio (with debugging enabled), you can view the debug output in Visual Studio's **Output** window. + ::: moniker-end From 68ec4941addd0ff6de5f16a93af013f690f0345c Mon Sep 17 00:00:00 2001 From: David Britch Date: Mon, 2 Oct 2023 10:33:19 +0100 Subject: [PATCH 2/5] What's new in .NET 8. --- docs/whats-new/TOC.yml | 2 ++ docs/whats-new/dotnet-8.md | 65 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 docs/whats-new/dotnet-8.md diff --git a/docs/whats-new/TOC.yml b/docs/whats-new/TOC.yml index 19ba98ad08..656e42fe91 100644 --- a/docs/whats-new/TOC.yml +++ b/docs/whats-new/TOC.yml @@ -6,6 +6,8 @@ items: - name: Releases expanded: true items: + - name: .NET 8 + href: dotnet-8.md - name: .NET 7 href: dotnet-7.md - name: Month diff --git a/docs/whats-new/dotnet-8.md b/docs/whats-new/dotnet-8.md new file mode 100644 index 0000000000..e8f80c48e3 --- /dev/null +++ b/docs/whats-new/dotnet-8.md @@ -0,0 +1,65 @@ +--- +title: What's new in .NET MAUI for .NET 8 +description: Learn about the new features introduced in .NET MAUI for .NET 8. +ms.date: 10/02/2023 +--- + +# What's new in .NET MAUI for .NET 8 + +.NET 8 is the successor to .NET 7 and focuses on being unified, modern, simple, and *fast*. Due to working with underlying external dependencies, such as Xcode or Android SDK Tools, the .NET Multi-platform App UI (.NET MAUI) support policy differs from the [.NET and .NET Core support policy](https://dotnet.microsoft.com/platform/support/policy/maui). For more information, see [.NET MAUI support policy](https://dotnet.microsoft.com/platform/support/policy/maui). + +This article lists the new features of .NET MAUI for .NET 8 and provides links to more detailed information on each. + +For information about what's new in .NET 8, see [What's new in .NET 8](/dotnet/core/whats-new/dotnet-8). + +## New functionality + +.NET MAUI for .NET 8 addresses top feedback issues and introduces the following new functionality: + +- BlazorWebView gains a `StartPath` property, a `TryDispatchAsync` method, and enhanced logging capabilities. For more information, see [Host a Blazor web app in a .NET MAUI app using BlazorWebView](~/user-interface/controls/blazorwebview.md). + + + + + + + + From 501691ccac4abba87c685f79979d1383e4dbaa4f Mon Sep 17 00:00:00 2001 From: David Britch Date: Mon, 2 Oct 2023 10:35:55 +0100 Subject: [PATCH 3/5] Fix linting errors. --- docs/user-interface/controls/blazorwebview.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/user-interface/controls/blazorwebview.md b/docs/user-interface/controls/blazorwebview.md index f3fbec00bd..97014d4146 100644 --- a/docs/user-interface/controls/blazorwebview.md +++ b/docs/user-interface/controls/blazorwebview.md @@ -172,7 +172,7 @@ All logging configuration can be performed as part of service registration in th ```csharp services.AddLogging(logging => { - logging.AddFilter("Microsoft.AspNetCore.Components.WebView", LogLevel.Trace); + logging.AddFilter("Microsoft.AspNetCore.Components.WebView", LogLevel.Trace); }); ``` @@ -181,7 +181,7 @@ Alternatively, to enable maximum logging for every component that uses `Microsof ```csharp services.AddLogging(logging => { - logging.SetMinimumLevel(LogLevel.Trace); + logging.SetMinimumLevel(LogLevel.Trace); }); ``` @@ -196,8 +196,8 @@ To configure the **Debug** logging provider, first add a reference in your proje ```csharp services.AddLogging(logging => { - logging.AddFilter("Microsoft.AspNetCore.Components.WebView", LogLevel.Trace); - logging.AddDebug(); + logging.AddFilter("Microsoft.AspNetCore.Components.WebView", LogLevel.Trace); + logging.AddDebug(); }); ``` From 26ff0f47ac55497bc5562c38e3d3297e50ea68d7 Mon Sep 17 00:00:00 2001 From: David Britch Date: Mon, 2 Oct 2023 10:37:38 +0100 Subject: [PATCH 4/5] Add heading. --- docs/troubleshooting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 15b1b6ca95..0d1587f028 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -183,7 +183,7 @@ If you receive the error "Could not find a valid Xcode app bundle at '/Library/D sudo xcode-select --reset ``` -## +## Diagnose issues in Blazor Hybrid apps has built-in logging that can help you diagnose problems in your Blazor Hybrid app. There are two steps to enable this logging: From 0bd09a7951cafcaafbaa7961f6f6dd42cda249b1 Mon Sep 17 00:00:00 2001 From: David Britch Date: Mon, 2 Oct 2023 10:51:40 +0100 Subject: [PATCH 5/5] Add xref. --- docs/whats-new/dotnet-8.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/whats-new/dotnet-8.md b/docs/whats-new/dotnet-8.md index e8f80c48e3..24431deb83 100644 --- a/docs/whats-new/dotnet-8.md +++ b/docs/whats-new/dotnet-8.md @@ -16,7 +16,7 @@ For information about what's new in .NET 8, see [What's new in .NET 8](/dotnet/c .NET MAUI for .NET 8 addresses top feedback issues and introduces the following new functionality: -- BlazorWebView gains a `StartPath` property, a `TryDispatchAsync` method, and enhanced logging capabilities. For more information, see [Host a Blazor web app in a .NET MAUI app using BlazorWebView](~/user-interface/controls/blazorwebview.md). +- gains a `StartPath` property, a `TryDispatchAsync` method, and enhanced logging capabilities. For more information, see [Host a Blazor web app in a .NET MAUI app using BlazorWebView](~/user-interface/controls/blazorwebview.md).