What’s New for Blazor Hybrid in .NET 7 – Visual Studio Magazine

0

News

What’s new for Blazor Hybrid in .NET 7

Microsoft’s ASP.NET Core development team has big plans for Blazor Hybrid (desktop) in .NET 7, which is slated to debut in November.

While Blazor (web) has been around since 2018 in both client-side and server-side components, new support for building cross-platform hybrid desktop apps using .NET MAUI and Blazor arrived with .NET 6 last November. Blazor Hybrid apps are native apps that can leverage web technologies such as HTML and CSS for additional functionality. So a hybrid app can use an embedded WebView control to render the UI web while taking advantage of the device’s native capabilities, as explained in last month. Visual Studio Magazine article “Edit local images/text from a .NET MAUI Blazor hybrid app.”

Mix and match native and web UI
[Click on image for larger view.] Mix and match native and web UI (source: Microsoft).

To see what’s happening for Blazor Hybrid in .NET 7, we check out the ASP.NET Core Roadmap for .NET 7 on GitHub, which shows 14 issues, 13 of which are still open.

Blazor hybrid roadmap
[Click on image for larger view.] Blazor hybrid roadmap (source: Microsoft).

While most roadmap issues address specific issues or requests, five “principle” issues explain the goals in general terms of security, performance, accessibility, DPI awareness, and overall readiness:

  • Security
    • Need to define what the threats are here
    • Rogue-ish third-party component?
    • Need to look at threat models for other native client platforms eg WPF as we will likely have a subset of the same concerns
    • Need to consult each native WebView component’s documentation guidance for best practices
  • Performance:
    • Set performance goals and scenarios with specific #s we will target
    • Build scenarios on the main competitors and ours
    • Automate measurements on relevant platforms
    • Need to consult each native WebView component’s documentation guidance for best practices
    • A feature to consider:
      • Enable pooling of WebViews and/or enable external creation of WebViews (from an existing pool externally). This technique is used in major applications which often have multiple web views, but only a subset of them are visible at a time.
  • Accessibility:
    • Check compatibility with screen readers
    • Check keyboard navigation such as tab key in and out of WebView
    • Check automation metadata, for example AutomationAttribute in WPF
    • Need to consult each native WebView component’s documentation guidance for best practices
  • DPI awareness:
    • Need to consult each native WebView component’s documentation guidance for best practices
    • We should also consult the docs for each UI platform to see if there are any best practices to follow.
  • Global preparation:
    • In general, globalization and localization
    • But also templates to create applications that use these templates. It’s likely that Blazor and native UI platforms each have their own flavors, so we need to see how they fit into a single app.
    • Does each native WebView component have some of its own concerns/features that we need to be aware of?

The only fixed issue, meanwhile, is “Blazor with maui can’t use Where

Some of the other problems are quite simple. #3684, for example (“Docs: Blazor hybrid walkthrough/getting started”), calls for a doc to go over the basics of getting started with Blazor Hybrid apps.

Another, #4127 (“Blazor Hybrid Project Template Updates”), simply says “We need to verify that the content matches what needs to be shipped.”

The much-requested and long-awaited Hot Reload feature is the subject of #2527 (“Hot Reload on MAUI Blazor app not working.”). Typo aside, this feature is important to many developers, but it has been rolled out to various developer tools in spurts.

The Hot Reload issue was posted on September 16, 2021 and was immediately answered by Microsoft’s Eilon Lipton, who said, “Hi @HeroinGyrl, we’re still working on getting some Hot Reload scenarios to work. It already works in a limited capacity. on some platforms, but it’s not fully functional everywhere” and asked what platform the bug was seen on. It turned out to be a known bug in this particular case.

Blazor uber-guru Steve Sanderson, who basically invented the thing just a week ago, weighed in on the thread, providing an update on the status of Hot Reload in Windows Forms:

  • Editing .razor content already hot-reloads and auto-replenishes
  • Editing .razor.css Is it that not hot-charging for several reasons:
    • It does not load the aspnetcore-browser-refresh.js script to not receive notification
    • Even if you add this script content manually, VS does not trigger any update message to indicate that things have changed
  • Editing some-static.css Is it that not hot-charging for several reasons:
    • You can’t actually save changes to a file like this, because VS says the file is locked while the application is running.
    • Even though this has been fixed, I think it still won’t reload because VS is supposed to achieve this through Browser Link, which is not connected to pages loaded in a BlazorWebView

“I think similar issues will also occur on WPF and MAUI (except on MAUI, .razor content changes don’t trigger auto-rerendering yet),” Sanderson said.

Other issues are related to infrastructure and test plans, authentication support, etc.

So when can developers try out some of these things in a .NET 7 preview? Nobody knows.

On January 11, Microsoft rolled out the GitHub framework for the first three previews of .NET 7, but that’s just placeholder text for now. Since .NET 6 has seen seven previews and two release candidates, the first preview of .NET 7 should arrive any day now.

About the Author


David Ramel is an editor and writer for Converge360.




Source link

Share.

Comments are closed.