Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Sørensen 304 posts 650 karma points
    Dec 23, 2013 @ 23:12
    Paul Sørensen
    0

    Upgrade to 7.0.1 gives 'Unable to cast object of type System.Int32 to type System.String'

    Hi

    I'm upgrading from 6.1.6 and it works fine until the database is 100% updated then the error occur.
    I have updated bin, ,umbraco, umbraco_client and merged config. I have deleted app_data\temp

    I have done it several times now on a machine where I have installed a new 7.0.1 version without problems.

    I have downloaded the source and found out that it occurs when this is performed:

    SELECT *
    FROM [umbracoUser]
    LEFT JOIN [umbracoUser2app]
    ON [umbracoUser].[id] = [umbracoUser2app].[user]
    WHERE (umbracoUser.id = @0)

    in petapoco.cs here

    try
    {
    if (!r.Read())
    break;
    poco = factory(r, cb); // calling on from here
    }
    catch (Exception x)
    {
    OnException(x);
    throw;
    }

    to this

    public TRet CallCallback<TRet>(Delegate callback, IDataReader dr, int count)
    {
    var args = new List<object>();
    for(var i = 0;i<count;i++)
    {
    args.Add(CallDelegate(i, dr)); / and from here
    }

    return (TRet)callback.DynamicInvoke(args.ToArray());
    }


    private object CallDelegate(int index, IDataReader reader)
    {
    var d = GetItem(index);
    var output = d.DynamicInvoke(reader); // which calls
    return output;
    }

    this

    Convert.ChangeType(src, dstType, null)
    where src is an object og value 1 and dstType is an datatype Int16.

    Exceuting the inital query gives me this
    id userDisabled userNoConsole userType startStructureID startMediaID userName userLanguage user app

    0 0 0 1 -1 -1 admin admin en 0 content
    0 0 0 1 -1 -1 admin admin en 0 developer
    0 0 0 1 -1 -1 admin admin en 0 media
    0 0 0 1 -1 -1 admin admin en 0 member
    0 0 0 1 -1 -1 admin admin en 0 settings
    0 0 0 1 -1 -1 admin admin en 0 users
    0 0 0 1 -1 -1 admin admin en 0 vgcms

    Is it a bug or..?

    /Paul S
  • Paul Sørensen 304 posts 650 karma points
    Dec 24, 2013 @ 14:10
    Paul Sørensen
    0

    Hi

    It turns out that it's due to these 2 fields being removed from the UmbracoUser table. After the Database upgrade the MultiPocoFactories still contains code for the old structure of the table so it tries to read the 2 missing fields.

    defaultToLiveEditing
    userDefaultPermissions

    One way to get around this is to do the installation and then manual update the version number. That's how I got it working.

    I did a test in the source code where I cleared the MultiPocoFactories cache after the update - it also worked.

    /Paul S

  • Farhad 13 posts 56 karma points
    Jan 06, 2014 @ 15:52
    Farhad
    0

    Hi

    That seems to have worked. Brilliant....

    Will have to do some thorough tetsing though. Thanks again for all your help. Really appreciate,

     

    Regards

    Farhad

Please Sign in or register to post replies

Write your reply to:

Draft