Skip to content
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

CSLA 8 uses wrong IContextManager in aspnetcore when Blazor Server is also used #4182

Closed
rockfordlhotka opened this issue Aug 22, 2024 · 0 comments · Fixed by #4183
Closed
Assignees

Comments

@rockfordlhotka
Copy link
Member

rockfordlhotka commented Aug 22, 2024

If you have a Blazor 8 app that does the following:

  1. Is configured to use CSLA state management, so state is kept in sync between server and wasm, including user identity
  2. Is configured to not flow the user from the wasm client to the data portal server (this is the default)
  3. Makes a data portal call from a wasm client to the aspnetcore/Blazor server
  4. The data portal on the server makes another root data portal call (such as a UoW object)
  5. That second data portal call should be using the aspnetcore IContextManager, but it continues to use the state-aware Blazor context manager
  6. This fails, because the data portal attempts to call SetUser, thinking it is running in aspnetcore, but having the wrong context manager (Blazor server) which doesn't support setting the user

The fix is to ensure that, with a cascading root data portal call like this, that the correct context manager is used.

Probably related to #4075

@rockfordlhotka rockfordlhotka self-assigned this Aug 22, 2024
rockfordlhotka added a commit that referenced this issue Aug 23, 2024
* Update to latest nuget packages

* Ensure use of .NET 8 b/c .NET 9 has a bug

* Update version numbers to 8.2.6

* Add context manager tests

* Make HttpContext fake function enough for testing

* #4182 Don't remove other context managers, b/c the accessor needs to scan them all

* Target latest .NET 8 SDK

* Update to target CSLA 8.2.6

* Update release notes
rockfordlhotka added a commit that referenced this issue Oct 21, 2024
* Update version to 8.2.7

* #4182 Fix issue with Blazor context manager

* Fix .NET target

* Update CSLA version
rockfordlhotka added a commit that referenced this issue Oct 21, 2024
* If !SyncContextWithServer properly load empty session

* #2551 Updating ProjectTracker code

* #4182 Fix Blazor context manager issue

* Optimize code

* Fix issue where "non-mobile" objects don't serialize

Non-mobile objects now need to have an opportunity to be serialized by a custom formatter for that type, so all types should _try_ to serialize.

* Clarify test names

* #4182 Fix context manager accessor

* Update to latest CSLA

* #4182 Fix issue with IContextManager selection

* Provide better exception information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant