-
-
Notifications
You must be signed in to change notification settings - Fork 402
Add NRT to Csla.Blazor.* #4703
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
Add NRT to Csla.Blazor.* #4703
Conversation
There was a problem hiding this 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
TtoT?, 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
textSepratoris misspelled; consider renaming it totextSeparatorto match the property name and avoid confusion.
public PropertyInfo(object model, string propertyName, string textSeprator = " ")
Adding NRT to Csla.Blazor and Csla.Blazor.WebAssembly.