Skip to content

Conversation

StefanOssendorf
Copy link
Contributor

Make internals from csla visible to Blazor.WebAssembly.
Fix CancellationTokenSource usage so it gets disposed properly.

Fixes #4611

@StefanOssendorf StefanOssendorf self-assigned this Aug 9, 2025
Fix CancellationTokenSource usage so it gets disposed properly
Fixes #4611
Copy link
Contributor

@Copilot 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

This PR fixes a memory leak issue in the Blazor WebAssembly project by properly disposing CancellationTokenSource instances and enables access to CSLA internals.

  • Adds InternalsVisibleTo attribute for Csla.Blazor.WebAssembly project
  • Replaces GetCancellationToken method with proper using statements for CancellationTokenSource disposal
  • Removes unused GetCancellationToken helper method

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Source/Csla/Properties/AssemblyInfo.cs Adds InternalsVisibleTo attribute to expose CSLA internals to Blazor.WebAssembly
Source/Csla.Blazor.WebAssembly/State/SessionManager.cs Fixes CancellationTokenSource disposal by using 'using' statements and removes helper method

@@ -56,7 +56,8 @@ public async Task<Session> RetrieveSession(TimeSpan timeout)
{
try
{
return await RetrieveSession(GetCancellationToken(timeout));
using var cts = timeout.ToCancellationTokenSource();
Copy link
Preview

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

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

The method ToCancellationTokenSource() appears to be an extension method that may not exist in the standard .NET libraries. Ensure this extension method is properly implemented and available, or consider using new CancellationTokenSource(timeout) directly.

Suggested change
using var cts = timeout.ToCancellationTokenSource();
using var cts = new CancellationTokenSource(timeout);

Copilot uses AI. Check for mistakes.

@rockfordlhotka rockfordlhotka self-requested a review August 23, 2025 23:45
@rockfordlhotka rockfordlhotka merged commit cdd8b5d into main Aug 23, 2025
2 checks passed
@rockfordlhotka rockfordlhotka deleted the dev/4611-fix-blazor-sessionManager branch August 23, 2025 23:46
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.

is not disposing of CancellationTokenSource in ToCancellationToken a problem?
2 participants