Closed kant2002 closed 1 week ago
Would like to take a look at this.
I can reproduce this issue with the example BlazorExample. I've downgraded the solution to CSLA 8.2.3 or else I couldn't build it due to a missing pre-release package of v9.
Add the following classes to the BusinessLibrary project:
[Serializable]
public class FooCommand : CommandBase<FooCommand> {
[Execute]
private void Execute(Guid? id) {
_ = id;
}
[Execute]
private void Execute(TestBar bar) {
var x = bar;
}
}
public class TestBar : MobileObject { public string MyProperty { get; set; }
protected override void OnGetState(SerializationInfo info, StateMode mode) { base.OnGetState(info, mode); info.AddValue(nameof(MyProperty), MyProperty); }
protected override void OnSetState(SerializationInfo info, StateMode mode) {
base.OnSetState(info, mode);
MyProperty = info.GetValue
2. Replace the method body of `IncrementCount` in the `BlazorExample.Client.Components.Pages.Counter.razor` file with the following body:
```csharp
private async Task IncrementCount()
{
currentCount++;
applicationContext.LocalContext["counter"] = currentCount;
var portal = applicationContext.GetRequiredService<IDataPortal<FooCommand>>();
//_ = await portal.ExecuteAsync(new TestBar { MyProperty = "show me the error" });
_ = await portal.ExecuteAsync(Guid.NewGuid());
}
BlazorExample
projectClick me
An unhandled error has occurred. [Reload](https://localhost:7210/)
with the reported exception from the initial post.
Describe the bug When trying to use
myPortal.ExecuteAsync()
with a serializable object. I've used it previously for aCreateChildAsync()
call without any issues. But with the.ExecuteAsync(myParameter)
I now get the following exception:Because parameters are treated as params object[] criterias my single object is the only element within the object[] -Array. And that produces a hicup. Only for Execute not CreateChild or Fetch.
I had that some time ago, too. Tried to reproduce it with a simple console and in memory stuff. But there it just works. So I think it's the HttpProxy having problems here
Originally reported by @StefanOssendorf