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

NameValueList does not deserialize on Blazor wasm #3083

Closed
rockfordlhotka opened this issue Sep 10, 2022 · 4 comments · Fixed by #3084
Closed

NameValueList does not deserialize on Blazor wasm #3083

rockfordlhotka opened this issue Sep 10, 2022 · 4 comments · Fixed by #3084
Assignees
Labels

Comments

@rockfordlhotka
Copy link
Member

Hi. I am attempting to move my solution from CSLA 5.4 to 6.1. I have a class library project containing many different classes which inherit from the various CSLA base classes (BusinessBase, ReadonlyBase, ReadonlyListBase, BusinessListBase). All of these types have migrated successfully, however I have one class that inherits from NameValueListBase that is giving me a problem. When I configure my solution to use a local dataportal, this NameValueListBase class works fine. But when I use a remote dataportal (hosted by an ASP.NET Core 6 endpoint), the following System.MissingMethodException gets thrown back to the calling client when I attempt to instantiate an instance:

System.MissingMethodException: 'Constructor on type 'Csla.NameValueListBase`2+NameValuePair[[Csla6.Lib.CardTypeId, Csla6.Lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' not found.'

Here is the signature of this class and corresponding enum, which are located in class library project "Csla6.Lib":

    [Serializable()]
    public enum CardTypeId : int
    {
        Password = 1,
        CreditCard = 2,
        Computer = 3,
        Miscellaneous = 4
    }
    [Serializable()]
    public class CardTypeList : NameValueListBase<CardTypeId, string>

Here is the client-code used to instantiate:

	var portal = _dataPortalFactory.GetPortal<CardTypeList>();
	CardTypeList cardTypeList = portal.Fetch();

When calling this portal.Fetch() method, I have been able to debug and successfully step into the CardTypeList.Fetch method, so I know this inbound call works. It is only when the BO finishes executing this method on the remote dataportal and attempts to return back to the client that the above exception is thrown.

I first encountered this problem when using a Blazor WebAssembly project as my client app. Assuming this was some issue with Blazor, I then created a simple console client application, pointed at the same remote dataportal endpoint, but this test client app also experienced the same exception.

Any insight into this error would be greatly appreciated.

Thanks,

John

Originally posted by @johnlabue in #3082

@rockfordlhotka
Copy link
Member Author

rockfordlhotka commented Sep 10, 2022

On deserialization, it is the NameValuePair child type that fails to be instantiated:

'Csla.NameValueListBase`2+NameValuePair[[CardTypeI…Culture=neutral, PublicKeyToken=93be5fdc093e4c30'

Looking at the code, this type has a private ctor (in some runtimes), and the current MobileFormatter requires a public ctor.

@johnlabue
Copy link

Thanks for the quick response. I hope this didn't ruin your weekend:)

@rockfordlhotka
Copy link
Member Author

No problem, I really appreciate the good bug report, thank you.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants