Upgraded to 3.7.0 - getting errors

Upgraded to 3.7.0 - getting errors

Old forum URL: forums.lhotka.net/forums/t/7405.aspx


ambuj posted on Wednesday, August 05, 2009

After upgrading from 2.1.4 to 3.7.0, I'm getting this error when trying to browse to my website:

GenericArguments[0], 'Reach.Security.User', on 'Csla.BusinessBase`1[T]' violates the constraint of type parameter 'T'.

Don't get any build errors.  Any ideas?

RockfordLhotka replied on Wednesday, August 05, 2009

Can you provide the full stack trace, that might help.

ambuj replied on Thursday, August 06, 2009

OK, I got past that error but getting another error now:

Method not found: 'Void Reach.Security.User.Populate(Csla.Data.SafeDataReader)'.

Even though the Populate method does exist in the same class.  Here's a snippet of the code:


        private void DataPortal_Fetch(UserCriteria criteria)
        {
            using (SqlConnection cn = new SqlConnection(ReachFunctions.ConnectionString))
            {
                cn.Open();
                using (SqlCommand cm = cn.CreateCommand())
                {
                    cm.CommandType = CommandType.StoredProcedure;
                    cm.CommandText = ReachFunctions.DBName + "spUser_getUserName";
                    cm.Parameters.AddWithValue("@username", criteria.Login);

                    using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
                    {
                        if (dr.Read())
                        {
                            Populate(dr); // failing on this line
                            // load child objects
                            dr.NextResult();
                        }

                        //LATE BINDING
                        //_usercustoms = UserCustoms.GetUserCustoms(dr);
                        //_resources = ProjectResources.GetProjectResources(dr);
                    }
                }
            }
        }

        private new void Populate(SafeDataReader dr)
        {
            base.Populate(dr);



Full call stack is this:
Method not found: 'Void Reach.Security.User.Populate(Csla.Data.SafeDataReader)'. body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }

Method not found: 'Void Reach.Security.User.Populate(Csla.Data.SafeDataReader)'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: Method not found: 'Void Reach.Security.User.Populate(Csla.Data.SafeDataReader)'.

Source Error:

Line 1819:                _trace = dr.GetBoolean("trace");
Line 1820:            }
Line 1821:        }
Line 1822:
Line 1823:        protected void PopulateWithRating(SafeDataReader dr)

Source File: C:\Temp\Reach.Web\Main\Solution1\Reach.Framework\User.cs    Line: 1821

Stack Trace:

[MissingMethodException: Method not found: 'Void Reach.Security.User.Populate(Csla.Data.SafeDataReader)'.]
   Reach.Framework.User.Populate(SafeDataReader dr) in C:\Temp\Reach.Web\Main\Solution1\Reach.Framework\User.cs:1821
   Reach.Framework.User.DataPortal_Fetch(UserCriteria criteria) in C:\Temp\Reach.Web\Main\Solution1\Reach.Framework\User.cs:1752
   dm(Object , Object[] ) +74
   Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters) in C:\Temp\Reach.Web\Main\Solution1\Csla\Reflection\MethodCaller.cs:332

[CallMethodException: DataPortal_Fetch method call failed]
   Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters) in C:\Temp\Reach.Web\Main\Solution1\Csla\Reflection\MethodCaller.cs:336
   Csla.Reflection.MethodCaller.CallMethod(Object obj, String method, Object[] parameters) in C:\Temp\Reach.Web\Main\Solution1\Csla\Reflection\MethodCaller.cs:260
   Csla.Reflection.LateBoundObject.CallMethod(String method, Object[] parameters) in C:\Temp\Reach.Web\Main\Solution1\Csla\Reflection\LateBoundObject.cs:86
   Csla.Server.SimpleDataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context) in C:\Temp\Reach.Web\Main\Solution1\Csla\Server\SimpleDataPortal.cs:125

[DataPortalException: DataPortal.Fetch failed (Method not found: 'Void Reach.Security.User.Populate(Csla.Data.SafeDataReader)'.)]
   Csla.DataPortal.Fetch(Type objectType, Object criteria) in C:\Temp\Reach.Web\Main\Solution1\Csla\DataPortal.cs:262
   Csla.DataPortal.Fetch(Object criteria) in C:\Temp\Reach.Web\Main\Solution1\Csla\DataPortal.cs:173
   Reach.Framework.User.GetUserByLogin(String login) in C:\Temp\Reach.Web\Main\Solution1\Reach.Framework\User.cs:1198
   Reach.Framework.User.Login(String Username, String Password, String sessionID) in C:\Temp\Reach.Web\Main\Solution1\Reach.Framework\User.cs:138
   Reach.GlobalConnect.Web.UI.Common.ReachMembershipProvider.ValidateUser(String username, String password) in C:\Temp\Reach.Web\Main\Solution1\Reach.GlobalConnect\Web.UI\Common\ReachMembershipProvider.cs:18
   System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +60
   System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +119
   System.Web.UI.WebControls.Login.AttemptLogin() +115
   System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +101
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +166
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


RockfordLhotka replied on Thursday, August 06, 2009

You have a comment in there about late binding. Are you somehow using a form of late binding?

The exception you are getting comes from the .NET runtime when it can't dynamically invoke a method, but since you are doing C# you shouldn't get that (until 4.0) because C# doesn't do late binding normally.

But I'm now suspecting you are using some add-on or compiler trick to do late binding?

Copyright (c) Marimer LLC