-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Blazor Hybrid dev tools topic #25384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
bd050c2
Blazor Hybrid dev tools topic
guardrex 7f82564
Updates
guardrex 5f37a25
Update aspnetcore/blazor/hybrid/developer-tools.md
guardrex e46d6c6
Apply suggestions from code review
guardrex 84a894e
Updates
guardrex d0c2a76
Updates
guardrex 2422939
Apply suggestions from code review
guardrex 6e77c7b
Update aspnetcore/zone-pivot-groups.yml
guardrex c8f6294
Updates
guardrex de69392
Update aspnetcore/blazor/hybrid/handle-errors.md
guardrex b2e1305
Update handle-errors.md
TanayParikh 2b82006
Update aspnetcore/blazor/hybrid/handle-errors.md
TanayParikh eb222cb
Update aspnetcore/blazor/hybrid/handle-errors.md
TanayParikh a120d73
Update aspnetcore/blazor/hybrid/handle-errors.md
TanayParikh e187d80
Updates
guardrex d6117be
Updates
guardrex 14115c8
Update aspnetcore/blazor/hybrid/handle-errors.md
guardrex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| --- | ||
| title: Handle errors in ASP.NET Core Blazor Hybrid | ||
| author: guardrex | ||
| description: Learn how to develop ASP.NET Core Blazor Hybrid apps that detect and handle errors. | ||
| monikerRange: '>= aspnetcore-6.0' | ||
| ms.author: riande | ||
| ms.custom: "mvc" | ||
| ms.date: 03/24/2022 | ||
| no-loc: ["Blazor Hybrid", Home, Privacy, Kestrel, appsettings.json, "ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR] | ||
| uid: blazor/hybrid/handle-errors | ||
| zone_pivot_groups: blazor-hybrid-operating-systems | ||
| --- | ||
| # Handle errors in ASP.NET Core Blazor Hybrid | ||
|
|
||
| This article explains how to use [browser developer tools](https://developer.mozilla.org/docs/Glossary/Developer_Tools) with Blazor Hybrid apps. | ||
|
|
||
| [!INCLUDE[](~/blazor/includes/blazor-hybrid-preview-notice.md)] | ||
|
|
||
| ## Browser developer tools with .NET MAUI Blazor | ||
|
|
||
| Ensure the Blazor Hybrid project is configured to support browser developer tools. Locate the `CreateMauiApp` method in the app, which is likely within the app's `Program.cs` or `Startup.cs` file and contains `services.AddMauiBlazorWebView()`. If the services extension method to add services for `BlazorWebView` developer tools (`AddBlazorWebViewDeveloperTools`) isn't present in the app's `CreateMauiApp` method for debug app execution (compiler directive: `DEBUG`), add it to the `CreateMauiApp` method: | ||
|
|
||
| ```csharp | ||
| #if DEBUG | ||
| services.AddBlazorWebViewDeveloperTools(); | ||
| #endif | ||
| ``` | ||
|
|
||
| > [!NOTE] | ||
| > Guidance on popular browsers' developer tools can be found in the documentation of each browser maintainer: | ||
| > | ||
| > * [Chrome DevTools](https://developer.chrome.com/docs/devtools/) | ||
| > * [Microsoft Edge Developer Tools overview](/microsoft-edge/devtools-guide-chromium/) | ||
| > * [Safari Web Inspector](https://support.apple.com/guide/safari-developer/welcome/mac) | ||
|
|
||
| :::zone pivot="windows" | ||
|
|
||
| To use browser developer tools with a Windows app: | ||
|
|
||
| 1. Run the .NET MAUI Blazor app for Windows and navigate to an app page that uses a `BlazorWebView`. | ||
| 1. Use the keyboard shortcut <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> to open browser developer tools. | ||
| 1. Developer tools provide a variety of features for working with apps, including which assets the page requested, how long assets took to load, and the content of loaded assets. The following example shows the **Console** tab to see the console messages, which includes any exception messages generated by the framework or developer code: | ||
|
|
||
|  | ||
|
|
||
| :::zone-end | ||
|
|
||
| :::zone pivot="android" | ||
|
|
||
| To use browser developer tools with an Android app: | ||
|
|
||
| 1. Start the Android emulator and navigate to an app page that uses a `BlazorWebView`. | ||
| 1. Open Google Chrome or Microsoft Edge. | ||
| 1. Navigate to `chrome://inspect/#devices` (Google Chrome) or `edge://inspect/#devices` (Microsoft Edge). | ||
| 1. Select the **`inspect`** link button to open developer tools. The following example shows the **DevTools** page in Microsoft Edge: | ||
|
|
||
|  | ||
|
|
||
| 1. Developer tools provide a variety of features for working with apps, including which assets the page requested, how long assets took to load, and the content of loaded assets. The following example shows the **Console** tab to see the console messages, which includes any exception messages generated by the framework or developer code: | ||
|
|
||
|  | ||
|
|
||
| :::zone-end | ||
|
|
||
| :::zone pivot="ios" | ||
|
|
||
| To use Safari developer tools with an iOS app: | ||
|
|
||
| 1. Open desktop Safari. | ||
| 1. Select the **Preferences** > **Advanced** > **Show Develop** menu item. | ||
| 1. Run the .NET MAUI Blazor app in the iOS simulator and navigate to an app page that uses a `BlazorWebView`. | ||
| 1. Return to desktop Safari. Select **Develop** > **Simulator** > **0.0.0.0**. If multiple entries for **0.0.0.0** are present, select the entry that highlights the `BlazorWebView`. The `BlazorWebView` is highlighted in blue in the iOS simulator when the correct **0.0.0.0** entry is selected. | ||
|
|
||
|  | ||
|
|
||
| 1. The **Web Inspector** window appears for the `BlazorWebView`. | ||
| 1. Developer tools provide a variety of features for working with apps, including which assets the page requested, how long assets took to load, and the content of loaded assets. The following example shows the **Console** tab, which includes any exception messages generated by the framework or developer code: | ||
|
|
||
|  | ||
|
|
||
| :::zone-end | ||
|
|
||
| :::zone pivot="macos" | ||
|
|
||
| Using browser developer tools with Mac Catalyst apps isn't currently supported. Please use the guidance for [iOS](?pivots=ios) apps, as the behavior is similar between the two platforms. | ||
|
|
||
| <!-- | ||
| To use Safari developer tools with a macOS app: | ||
|
|
||
| 1. Open desktop Safari. | ||
| 1. Select the **Preferences** > **Advanced** > **Show Develop** menu item. | ||
|
guardrex marked this conversation as resolved.
|
||
| 1. Run the .NET MAUI Blazor app in the macOS simulator. | ||
| 1. Return to desktop Safari. Select **Develop** > **Simulator** > **0.0.0.0**. If multiple entries for **0.0.0.0** are present, select the entry that highlights the `BlazorWebView`. The `BlazorWebView` is highlighted in blue in the macOS simulator when the correct **0.0.0.0** entry is selected. | ||
| 1. The **Web Inspector** window appears for the `BlazorWebView`. | ||
| 1. Developer tools provide a variety of features for working with apps, including which assets the page requested, how long assets took to load, and the content of loaded assets. The following example shows the **Console** tab, which includes any exception messages generated by the framework or developer code: | ||
|
|
||
|  | ||
|
|
||
| --> | ||
|
|
||
| :::zone-end | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.