Skip to content

Conversation

@StefanOssendorf
Copy link
Contributor

Adding NRT to Csla.Blazor and Csla.Blazor.WebAssembly.

@rockfordlhotka rockfordlhotka requested a review from Copilot July 11, 2025 21:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds nullable reference type (NRT) support to the Csla.Blazor and Csla.Blazor.WebAssembly packages by enabling nullable in project files, updating APIs and code to use nullable annotations, and aligning tests and documentation with the new defaults.

  • Turned on <Nullable>enable</Nullable> and treat nullable warnings as errors in both Blazor and WebAssembly projects
  • Annotated methods, properties, events, and constructors with nullable reference types and inserted null checks
  • Updated tests to use empty-string defaults and switched assertions to FluentAssertions

Reviewed Changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/NRT Work In Progress Tacking.md Marked Csla.Blazor and WebAssembly as completed in NRT tracking
Source/Csla/State/StateResult.cs Added [MemberNotNullWhen] attribute and imported nullability API
Source/Csla/State/ISessionManager.cs Changed GetCachedSession() to return Session?
Source/Csla/Properties/Resources.resx Added two new resource strings for session errors
Source/Csla.Blazor/ViewModel.cs Added nullability annotations, argument checks, and default values
Source/Csla.Blazor/PropertyInfo.cs Annotated parameters, added null checks, and made events nullable
Source/Csla.Blazor/IPropertyInfo.cs Changed Value and GetPropertyInfo() to return nullable types
Source/Csla.Blazor/HasPermissionHandler.cs Made context readonly and added null check in constructor
Source/Csla.Blazor/HasPermissionAttribute.cs Added null check to objectType in base policy call
Source/Csla.Blazor/EditContextCslaExtensions.cs Added null-forgiving in cast and guarded broken-rule property name
Source/Csla.Blazor/CslaValidator.cs Made CurrentEditContext nullable
Source/Csla.Blazor/CslaValidationMessages.razor.cs Added null checks, default initializers, and nullable event fields
Source/Csla.Blazor/CslaPolicy.cs Added null guard in GetPolicy and updated TryGet signature
Source/Csla.Blazor/CslaPermissionsPolicyProvider.cs Added null checks and updated async policy methods to nullable
Source/Csla.Blazor/CslaPermissionRequirement.cs Threw on null objectType
Source/Csla.Blazor/Csla.Blazor.csproj Enabled nullable and warnings-as-errors
Source/Csla.Blazor/ConfigurationExtensions.cs Added null guard for config in server setup
Source/Csla.Blazor/BlazorServerConfigurationOptions.cs Introduced dedicated options type for server configuration
Source/Csla.Blazor.WebAssembly/State/SessionManager.cs Added constructor null checks, made _session nullable
Source/Csla.Blazor.WebAssembly/Csla.Blazor.WebAssembly.csproj Enabled nullable and warnings-as-errors
Source/Csla.Blazor.WebAssembly/Configuration/ConfigurationExtensions.cs Added null guard for wasm configuration
Source/Csla.Blazor.WebAssembly/Authentication/CslaAuthenticationStateProvider.cs Initialized state and added null guard
Source/Csla.Blazor.WebAssembly/ApplicationContextManager.cs Added null guards, moved session logic to helper, adapted API
Source/Csla.Blazor.Test/ViewModelSaveAsyncErrorTests.cs Switched to FluentAssertions and updated defaults
Source/Csla.Blazor.Test/Csla.Blazor.Test.csproj Added AwesomeAssertions (but tests use FluentAssertions)
Files not reviewed (1)
  • Source/Csla/Properties/Resources.Designer.cs: Language not supported
Comments suppressed due to low confidence (4)

docs/NRT Work In Progress Tacking.md:1

  • The file and title use “Tacking” but should read “Tracking” for correct spelling.
# NRT Tracking file

Source/Csla/State/ISessionManager.cs:30

  • Since the return type is now nullable, update the XML doc to clarify that callers must handle a null session (or consider throwing on missing session instead).
    Session? GetCachedSession();

Source/Csla.Blazor/ViewModel.cs:195

  • This changes the public API from returning T to T?, which is a breaking change—confirm that all consumers can handle nullable model results or consider overloads.
    public async Task<T?> RefreshAsync(Func<Task<T?>> factory)

Source/Csla.Blazor/PropertyInfo.cs:37

  • The parameter textSeprator is misspelled; consider renaming it to textSeparator to match the property name and avoid confusion.
    public PropertyInfo(object model, string propertyName, string textSeprator = " ")

@rockfordlhotka rockfordlhotka merged commit 20f8343 into main Jul 21, 2025
3 checks passed
@rockfordlhotka rockfordlhotka deleted the dev/1233-add-nrt-to-blazor branch July 21, 2025 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants