# MauiProgram

- File ID: file:1uay25w:mauiprogram-cs
- Path: NexusReader.Maui/MauiProgram.cs
- Role: program-entry
- Layer: unknown

## Purpose

Bootstraps and configures the MAUI application: creates the MAUI host builder, registers DI services (UI, platform, identity, app services), configures MediatR and returns the built MauiApp.

## Key Details

CreateMauiApp centralizes MAUI DI registration; DEBUG region enables Blazor dev tools and debug logging; HttpClient points to emulator-hosted API at http://10.0.2.2:5000; AddApplication and MediatR registration wire application-layer handlers into the app.

## Symbols

- MauiProgram: Bootstraps and configures the MAUI application: creates the MAUI host builder, registers DI services (UI, platform, identity, app services), configures MediatR and returns the built MauiApp.
- CreateMauiApp(): Create and configure the MAUI app builder, register application and platform services, configure debugging tools in DEBUG, and build/return the app; catches startup exceptions and rethrows after logging.
- MauiProgram: Static bootstrap helper class that exposes CreateMauiApp used to initialize the MAUI app.

## Dependencies

- No resolved dependencies.

## Calls

- No resolved calls.

## Unresolved References

- dependency-target: NexusReader.Application
- dependency-target: NexusReader.Infrastructure.Mobile.Services
- dependency-target: NexusReader.UI.Shared.Services
- dependency-target: MediatR
- call-target: NexusReader.Application
- call-target: NexusReader.Application.DependencyInjection

## Coverage

- Symbols: 3
- Executable symbols: 1
- Executable symbols with control flow: 1
- Grounded edges: 3
- Unresolved references: 6
- Control-flow fragments: 1
- Unresolved jumps: 2
- Unsupported constructs: 0
- Control-flow coverage: 100%
- Required diagrams: 2
- Generated diagrams: 3

## Control Flow Fragments

- CreateMauiApp: 16 nodes, 15 edges, 2 jumps, 0 unsupported constructs

## Diagrams

### MauiProgram Neighborhood

```mermaid
flowchart LR
    class_1e8p0hy_mauiprogram("MauiProgram")
    file_1uay25w_mauiprogram_cs("MauiProgram")
    method_hh1uha_createmauiapp[["CreateMauiApp()"]]
    type_1dhxtbx_mauiprogram[/"MauiProgram"/]
```

### MauiProgram Execution Overview

```mermaid
flowchart TD
    class_1e8p0hy_mauiprogram("MauiProgram")
    method_hh1uha_createmauiapp[["CreateMauiApp()"]]
    unresolved_unresolved_1op5xiq_call_target{"Unresolved: Assembly"}
    unresolved_unresolved_gx6bb9_call_target{"Unresolved: AddApplication"}
    class_1e8p0hy_mauiprogram -->|contains| method_hh1uha_createmauiapp
    method_hh1uha_createmauiapp -->|unresolved call| unresolved_unresolved_1op5xiq_call_target
    method_hh1uha_createmauiapp -->|unresolved call| unresolved_unresolved_gx6bb9_call_target
```

### CreateMauiApp() Control Flow

```mermaid
flowchart TD
    method_hh1uha_createmauiapp__call_51_AddApplication[["AddApplication"]]
    method_hh1uha_createmauiapp__call_54_Assembly[["Assembly"]]
    method_hh1uha_createmauiapp__action_14_createmauiapp_try_14_0__try("Begins protected execution")
    method_hh1uha_createmauiapp__action_14_try_catch_14__linear("Catch startup exceptions, log to Debug and rethrow")
    method_hh1uha_createmauiapp__action_16_create_16__linear("Create builder")
    method_hh1uha_createmauiapp__action_22_compile_time_conditional_22__linear("DEBUG-only tooling and logging")
    method_hh1uha_createmauiapp__action_28_service_registration_28__linear("Register platform and infrastructure singletons")
    method_hh1uha_createmauiapp__action_32_service_registration_32__linear("Register scoped identity services and auth provider")
    method_hh1uha_createmauiapp__action_38_service_registration_38__linear("Register network HttpClient with BaseAddress")
    method_hh1uha_createmauiapp__action_41_service_registration_41__linear("Register UI state and feature services (scoped)")
    method_hh1uha_createmauiapp__action_53_library_integration_53__linear("Register MediatR handlers from application assembly")
    method_hh1uha_createmauiapp__action_59_createmauiapp_catch_59_2__catch("catch Exception ex")
    method_hh1uha_createmauiapp__action_63_createmauiapp_throw_63_3__throw{"Throws exception"}
    method_hh1uha_createmauiapp__entry(["CreateMauiApp entry"])
    method_hh1uha_createmauiapp__action_57_createmauiapp_return_57_1__return(["Returns result"])
    method_hh1uha_createmauiapp__action_57_return_57__return(["Build and return app"])
    method_hh1uha_createmauiapp__action_14_createmauiapp_try_14_0__try -->|next| method_hh1uha_createmauiapp__action_16_create_16__linear
    method_hh1uha_createmauiapp__action_14_try_catch_14__linear -->|next| method_hh1uha_createmauiapp__action_14_createmauiapp_try_14_0__try
    method_hh1uha_createmauiapp__action_16_create_16__linear -->|next| method_hh1uha_createmauiapp__action_22_compile_time_conditional_22__linear
    method_hh1uha_createmauiapp__action_22_compile_time_conditional_22__linear -->|next| method_hh1uha_createmauiapp__action_28_service_registration_28__linear
    method_hh1uha_createmauiapp__action_28_service_registration_28__linear -->|next| method_hh1uha_createmauiapp__action_32_service_registration_32__linear
    method_hh1uha_createmauiapp__action_32_service_registration_32__linear -->|next| method_hh1uha_createmauiapp__action_38_service_registration_38__linear
    method_hh1uha_createmauiapp__action_38_service_registration_38__linear -->|next| method_hh1uha_createmauiapp__action_41_service_registration_41__linear
    method_hh1uha_createmauiapp__action_41_service_registration_41__linear -->|IServiceCollection extension call to register application services| method_hh1uha_createmauiapp__call_51_AddApplication
    method_hh1uha_createmauiapp__action_53_library_integration_53__linear -->|Assembly reference passed into MediatR registration| method_hh1uha_createmauiapp__call_54_Assembly
    method_hh1uha_createmauiapp__action_57_createmauiapp_return_57_1__return -->|return| method_hh1uha_createmauiapp__action_57_return_57__return
    method_hh1uha_createmauiapp__action_57_return_57__return -->|exception| method_hh1uha_createmauiapp__action_59_createmauiapp_catch_59_2__catch
    method_hh1uha_createmauiapp__action_59_createmauiapp_catch_59_2__catch -->|exception| method_hh1uha_createmauiapp__action_63_createmauiapp_throw_63_3__throw
    method_hh1uha_createmauiapp__call_51_AddApplication -->|next| method_hh1uha_createmauiapp__action_53_library_integration_53__linear
    method_hh1uha_createmauiapp__call_54_Assembly -->|return| method_hh1uha_createmauiapp__action_57_createmauiapp_return_57_1__return
    method_hh1uha_createmauiapp__entry -->|next| method_hh1uha_createmauiapp__action_14_try_catch_14__linear
```

## Diagram Validation

- Status: warn
- Warning: Control-flow extraction left 2 unresolved jumps.
