DataPortal.Fetch failed (Value cannot be null. Parameter name: constructor)

DataPortal.Fetch failed (Value cannot be null. Parameter name: constructor)

Old forum URL:

dragonworld posted on Wednesday, February 26, 2014

I'm having a strange issue with a DataPortal.Fetch function.  The error is DataPortal.Fetch failed (Value cannot be null.  Parameter name: constructor).

The code that breaks is below and it breaks on the Return DataPortal.Fetch.  It never reaches the dataportal fetch method.  It looks the same as my other calls but I cannot figure out why this is breaking.

     If Not CanGetObject() Then

                Throw New System.Security.SecurityException("User not authorize to view a pro Compliance report")

            End If

            Return DataPortal.Fetch(Of ProCompliance)()


This is my DataPortal Fetch method:

   Private Overloads Sub DataPortal_Fetch()

        Using cn As SqlConnection = New SqlConnection(SharedOptions.ConnectionString)



            If cn.State = ConnectionState.Open Then


            End If


        End Using


    End Sub

Here is the stack trace:

   at Csla.Reflection.DynamicMethodHandlerFactory.CreateConstructor(ConstructorInfo constructor)

   at Csla.Reflection.MethodCaller.GetCachedConstructor(Type objectType)

   at Csla.Reflection.MethodCaller.CreateInstance(Type objectType)

   at Csla.Reflection.LateBoundObject..ctor(Type objectType)

   at Csla.Server.SimpleDataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context)

   at Csla.DataPortal.Fetch(Type objectType, Object criteria)

   at Csla.DataPortal.Fetch[T]()

   at RSManagementReports.ProCompliance.GetCSV() in P:\Projects\Utilities\ManagementConsole\Source\ManagementConsole\RSManagementReports\CSVs\ProCompliance.vb:line 60

dragonworld replied on Thursday, February 27, 2014

Well, in case anyone runs across this, I managed to fix it.  I re-created the class, copied and pasted the code, and it worked.  No idea what the issue was.

Copyright (c) Marimer LLC