MarimerLLC / csla

A home for your business logic in any .NET application.
https://cslanet.com
MIT License
1.26k stars 402 forks source link

Blazor WebAssembly don`t use serializer? #3037

Closed Mvoron7 closed 2 years ago

Mvoron7 commented 2 years ago

Describe the bug Change csla version from 6.0.0-R22040701 to 6.1. Have exception "System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters." Request body (in 6.1.0) is "\u0002\u0000\u0000..."

Version and Platform CSLA version: 6.1.0 OS: Windows Platform: BlazorWebAssembly

Up. If can be fix with:

public DataPortalController(Csla.ApplicationContext applicationContext)
      : base(applicationContext)
    {
      UseTextSerialization = false;
    }
vijaygill commented 2 years ago

@Mvoron7 - #2922 covers this.

rockfordlhotka commented 2 years ago

Yes @Mvoron7, I did a "bad thing" and introduced a breaking change in a point release. Specifically, I changed the default behavior of the HttpProxy data portal client to no longer use text-based serialization, which means that there's a required change on the data portal server to remove the line from the constructor that configures the endpoint to use text-based serialization.

I made this choice knowing it violated semver, and suspecting that it would cause some pain. But I think it is so worth it because without text-based serialization the data over the wire is literally half the size.

This was all possible due to an enhancement in .NET 6 to remove the limitation on the Blazor WebAssembly client about transferring binary data over http. It wasn't possible, forcing the use of base64 encoding (doubling the size of the data). Now we don't need that overhead, and I didn't want to wait until .NET 7 for people (like you) to take advantage of this very major enhancement to Blazor (and thus the data portal).