MentorAgent Docs
Menu

ReferencePackage: Novior.MentorAgent.Scanner

MentorUiScannerExtensions class

The MentorUiScannerExtensions class of Novior.MentorAgent.Scanner: Story 1636 — registers the scan of the pages.

View as Markdown
On this page

Story 1636 — registers the scan of the pages.

Namespace: Novior.MentorAgent.Scanner. Package: Novior.MentorAgent.Scanner.

public static class MentorUiScannerExtensions

Terminal
dotnet add package Novior.MentorAgent.Scanner

public static IServiceCollection AddMentorUiScanner(this IServiceCollection services, Action<MentorUiScannerOptions>? configure = null)

Registers the scan of the pages: once the application has started, in Development only, it opens each page of the application in the Edge or Chrome already installed and writes what the page offers to the project's mentor-ui-manifest.json, which the AutoMentor reads at the next build. Outside Development it does nothing. Reference the package in Debug only, and call this under #if DEBUG; it needs AddMentorAgent() with AutoMentor.Enabled.

public static IServiceProvider StartMentorUiScan(this IServiceProvider services)

Starts the scan of the pages in a .NET MAUI Blazor Hybrid app on Windows, where no host starts it: call it on MauiApp.Services right after builder.Build(), under #if DEBUG, before the app's window is created. In a Debug build of the app only, it opens the DevTools port of the app's WebView2 on the loopback (or uses the one WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS already names, and the log says which), then reads each page in the app's window, as the app's own user, and returns to the page it found. The port stays open until the app closes. The scan clicks as the app's user: use it only with a build that points to development data. It needs MentorUiScannerExtensions.AddMentorUiScanner; in a web host it does nothing, since the scan starts by itself.