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

Null Ref Exception fetching/updating business object not derived from IDataPortalTarget #1103

Closed
rockfordlhotka opened this issue Apr 1, 2019 · 1 comment
Assignees
Labels

Comments

@rockfordlhotka
Copy link
Member

rockfordlhotka commented Apr 1, 2019

From MarimerLLC/cslaforum#721

Describe the bug

Exception fetching/updating business object not derived from IDataPortalTarget

Version and Platform
CSLA version: 4.10.0
OS: Windows
Platform: WinForms

Code that Fails

Any fetch of a non-derived object.

Stack Trace or Exception Detail

at System.Object.GetType()
at Csla.Reflection.MethodCaller.GetCachedMethod(Object obj, String method, Boolean hasParameters, Object[] parameters) in C:\src\rdl\csla\Source\Csla.Shared\Reflection\MethodCaller.cs:line 98
at Csla.Reflection.MethodCaller.IsAsyncMethod(Object obj, String method, Boolean hasParameters, Object[] parameters) in C:\src\rdl\csla\Source\Csla.Shared\Reflection\MethodCaller.cs:line 1144
at Csla.Utilities.ThrowIfAsyncMethodOnSyncClient(Boolean isSync, Object obj, String methodName, Object[] parameters) in C:\src\rdl\csla\Source\Csla.Shared\Utilities.cs:line 415
at Csla.Server.SimpleDataPortal.<Fetch>d__1.MoveNext() in C:\src\rdl\csla\Source\Csla.Shared\Server\SimpleDataPortal.cs:line 159
at Csla.DataPortal`1.Fetch(Type objectType, Object criteria) in C:\src\rdl\csla\Source\Csla.Shared\DataPortalT.cs:line 439
at Csla.DataPortal`1.Fetch(Object criteria) in C:\src\rdl\csla\Source\Csla.Shared\DataPortalT.cs:line 424

Looks like SimpleDataPortal (Fetch, Update etc.) have an issue when target is not of type IDataPortalTarget - There are null checks but then the ThrowIfAsyncMethodOnSyncClient causes the Null Reference Exception further down then stack when GetType() is called on the now null object.

Perhaps should be passing in obj.Instance to the Utilities.ThrowIfAsyncMethodOnSyncClient method?

@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 Aug 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants