Copied to clipboard

Flag this post as spam?

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


  • Arnim Anhut 137 posts 148 karma points
    Jan 02, 2010 @ 11:50
    Arnim Anhut
    0

    Usercontrol gives "Key not in Dictonary"

    Hello,

    I upgraded several webs on 4.1beta. All of them are using "Multiple File Upload" and are working perfectly fine.

    But on one I get the ASP.NET-error "Key not found in dictonary whenever I try to show a media-folder. If I remove the usercontroll (Mulitple File Upload) everything works fine. I already tried to uninstall and install again - samer error. I checked the DB and couldn't find anything unusual.

    At what point is that "dictonary" build and where is it fetching its values from? Why can't the usercontroll be rendered, I guess its not part of the dictonary, but should be.

    Any ideas?

    Greets, Arnim.

  • Arnim Anhut 137 posts 148 karma points
    Jan 02, 2010 @ 11:52
    Arnim Anhut
    0

    That's the error-stack:

    [KeyNotFoundException: Der angegebene Schlüssel war nicht im Wörterbuch angegeben.]
    System.ThrowHelper.ThrowKeyNotFoundException() +28
    System.Collections.Generic.Dictionary`2.get_Item(TKey key) +2647056
    umbraco.cms.businesslogic.datatype.controls.Factory.GetNewObject(Guid DataEditorId) +41
    umbraco.cms.businesslogic.datatype.DataTypeDefinition.get_DataType() +101
    umbraco.cms.businesslogic.datatype.DataTypeDefinition.GetByDataTypeId(Guid DataTypeId) +42
    noerd.Umb.DataTypes.multipleFileUpload.MultipleFileUploadDataType.get_DataEditor() +61
    umbraco.controls.ContentControl.addControlNew(Property p, TabPage tp, String Caption) +87
    umbraco.controls.ContentControl.CreateChildControls() +440
    System.Web.UI.Control.EnsureChildControls() +87
    umbraco.controls.ContentControl.OnInit(EventArgs e) +32
    System.Web.UI.Control.InitRecursive(Control namingContainer) +333
    System.Web.UI.Control.AddedControl(Control control, Int32 index) +198
    System.Web.UI.ControlCollection.Add(Control child) +80
    umbraco.cms.presentation.editMedia.OnInit(EventArgs e) +455
    System.Web.UI.Control.InitRecursive(Control namingContainer) +333
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378

     

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jan 02, 2010 @ 11:58
    Sebastiaan Janssen
    0

    You could check if the datatype has all of the required properties set, maybe there's something missing or one of the properties is pointing to a node that doesn't exist any more.

  • Arnim Anhut 137 posts 148 karma points
    Jan 02, 2010 @ 12:04
    Arnim Anhut
    0

    Hey Seba! You're a fast one! Thanx!

    Where could I find the required props? The datatype only has on empty prevalue which is optional. And where could I look for this "thing" pointing at a nonexist node? I allready checked cmsDataType and umbracoNode and couldn't find anything suspicous.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jan 02, 2010 @ 12:10
    Sebastiaan Janssen
    0

    Ah, that's what I meant, the prevalue. Hmmm, in that case you might want to start having a look at the source of the Multiple File Upload and check out where this key is coming from and what it's used for.

    http://github.com/noerd/Multiple-File-Upload-Package/tree/master/src/ (the download source button is under the search box).

     

  • Arnim Anhut 137 posts 148 karma points
    Jan 02, 2010 @ 12:13
    Arnim Anhut
    0

    But I don't even know which key is missing... is there a way, to see what key is looked for in the dic?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jan 02, 2010 @ 12:22
    Sebastiaan Janssen
    0

    I don't think it the Umbraco dictionary that is missing something here. The Multiple File Upload is using "System.Collections.Generic.Dictionary" here.

    I am not familiar enough with the source, so I have no idea where the key is supposed to come from. So have a look at the filename you got with this exception and have a look at the source to see what it's expecting here. 

    Don't you just love open source? ;-)

  • Arnim Anhut 137 posts 148 karma points
    Jan 02, 2010 @ 12:28
    Arnim Anhut
    0

    No, of course its not the umbraco dictonary, but "a" dictonary.

    But when I look at the error:

    [KeyNotFoundException: Der angegebene Schlüssel war nicht im Wörterbuch angegeben.]
    System.ThrowHelper.ThrowKeyNotFoundException() +28
    System.Collections.Generic.Dictionary`2.get_Item(TKey key) +2647056
    umbraco.cms.businesslogic.datatype.controls.Factory.GetNewObject(Guid DataEditorId) +41
    umbraco.cms.businesslogic.datatype.DataTypeDefinition.get_DataType() +101
    umbraco.cms.businesslogic.datatype.DataTypeDefinition.GetByDataTypeId(Guid DataTypeId) +42
    noerd.Umb.DataTypes.multipleFileUpload.MultipleFileUploadDataType.get_DataEditor() +61
    umbraco.controls.ContentControl.addControlNew(Property p, TabPage tp, String Caption) +87

    It looks like the error is thrown at this point

    umbraco.cms.businesslogic.datatype.controls.Factory.GetNewObject

    I'm not quite familar with the internals of umbraco. But it looks like some GUID is missing or something like that?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jan 02, 2010 @ 12:38
    Sebastiaan Janssen
    0

    Ah yes, of course (not fully awake yet).

    This datatype is registered using a new GUID during the install of the package. It seems that the GUID is not found in cmsDatatype, the controlId should be: ACCB9911-CD81-4B17-AF3F-446CEB1DBF0D

    If it's not there, you might want to run the installed for the Multile File uploader again (make sure to backup before you do so).

  • Arnim Anhut 137 posts 148 karma points
    Jan 02, 2010 @ 12:43
    Arnim Anhut
    0

    Already looked into this, but the cmsDataType with this GUID is present and points to the correct umbracoNode. This can't be the issue I guess. :-( It dbType is Ntext - guess that's ok?

    Any other idea?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jan 02, 2010 @ 12:53
    Sebastiaan Janssen
    0

    Are you sure the GUID is the same? 

    In my database it is an nvarchar, that could be it!

    Other than that, uninstalling and reinstalling the package might help..

  • Arnim Anhut 137 posts 148 karma points
    Jan 02, 2010 @ 13:03
    Arnim Anhut
    0

    GUID is identical and already changed dbType to Nvarchar... didn't help. I already uninstalled and installed the package several times. But - maybe this helps - when I install the package using the installer I get the following error:

    After the package installation is run, the local installer of MFU asks if I want to do an automatic installation. If I use it it get this:

    Der angegebene Schlüssel war nicht im Wörterbuch angegeben.

    Beschreibung: Unbehandelte Ausnahme beim Ausführen der aktuellen Webanforderung. Überprüfen Sie die Stapelüberwachung, um weitere Informationen über diesen Fehler anzuzeigen und festzustellen, wo der Fehler im Code verursacht wurde.

    Ausnahmedetails: System.Collections.Generic.KeyNotFoundException: Der angegebene Schlüssel war nicht im Wörterbuch angegeben.

    Quellfehler:

    Zeile 59:         foreach (DataTypeDefinition dt in DataTypeDefinition.GetAll())
    Zeile 60: {
    Zeile 61: if (dt.DataType != null && dt.DataType.Id.Equals(DATATYPE_UID))
    Zeile 62: ddMultipleFileUpload = dt;
    Zeile 63: }


    Quelldatei: d:\inetpub\vhosts\fredo03-art.de\httpdocs\usercontrols\MultipleFileUpload\Installer.ascx.cs    Zeile: 61

    Stapelüberwachung:

    [KeyNotFoundException: Der angegebene Schlüssel war nicht im Wörterbuch angegeben.]
    System.ThrowHelper.ThrowKeyNotFoundException() +28
    System.Collections.Generic.Dictionary`2.get_Item(TKey key) +2647056
    umbraco.cms.businesslogic.datatype.controls.Factory.GetNewObject(Guid DataEditorId) +41
    umbraco.cms.businesslogic.datatype.DataTypeDefinition.get_DataType() +101
    usercontrols_MultipleFileUpload_Installer.Install(Object sender, EventArgs e) in d:\inetpub\vhosts\fredo03-art.de\httpdocs\usercontrols\MultipleFileUpload\Installer.ascx.cs:61
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
    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

    Looks like the same error, but I'm 100% sure the GUID is correct inside of cmsDataType...

    I'm totaly clueless... :-(

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jan 02, 2010 @ 13:52
    Sebastiaan Janssen
    0

    So apparently, the dt.DataType is not null, but when it tries to do the GUID compare you get this error. That is odd, it should just continue.. 

    In cmsDatatype, the data type of the controlId column should be "uniqueidentifier", have you checked that as well?

    Maybe one of the other columns in cmsDataType is corrupt? Are any of them missing a controlID or something like that?

     

  • Arnim Anhut 137 posts 148 karma points
    Jan 02, 2010 @ 14:56
    Arnim Anhut
    0

    Just checked cmsDatatype. Nothing odd on the first glance, no empty controlID, everything looks fine. But I don't know what controll hides behind each GUID. Is there a list of all the GUIDs and the connected GUID? Maybe on is missing and becaus of that .GetAll() won't give me all controlls.

    Is there a way to investigate, that further?

  • Arnim Anhut 137 posts 148 karma points
    Jan 02, 2010 @ 15:20
    Arnim Anhut
    1

    Solved it!

    This Umbraco installation came a long way from 3.0.x to 4.0.x to 4.1 and it still had an umbracoNode-defintion for the mass-mailer in umbracoNode and cmdDataType. I ersaed both lines from the database and (I just don't know why) everything is working perfeclty!

    @Seba: Thanx for your time and support! You pointed me in the right direction!

    Greets, Arnim.

  • Arnim Anhut 137 posts 148 karma points
    Jan 02, 2010 @ 15:36
    Arnim Anhut
    1

    Just removing the DataType "MassMailer" from the Datatypes also gets the job done! ;-)

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jan 03, 2010 @ 13:06
    Sebastiaan Janssen
    0

    Ahaaa, it's the other way around than what I thought.

    But now I'm thinking that maybe your database wasn't corrupt, but the massmailer DLL was removed. Maybe the GetAll method actually tests if the registered GUID is still also loaded in memory somewhere?

    It seems to me that you should be able to delete a dll file without wrecking the rest of the packages... Can you confirm that you removed the massmailer from the bin folder? In that case, this might be a bug.

  • jernej 7 posts 28 karma points
    Jan 11, 2010 @ 13:01
    jernej
    0

    I don't know if this is related but I also have the similar problem with my own user controls in Umbraco backoffice:( I created my own section where I'm trying a simple gridview with update/delete/cancel functionality. On postback if I check the datakeys or selectedDatakey value...they are both empty. I tested my usercontrol in Umbraco public frontend  and it works perfect.

    Is there something that you have to do different if the user control is used in the backoffice?

     

    Thanks for help!

  • jernej 7 posts 28 karma points
    Jan 11, 2010 @ 13:44
    jernej
    0

    Update: I just found out that the problem is in the gridview Update function.Edit & Cancel work well...but the Update like if it wasn't there :(

Please Sign in or register to post replies

Write your reply to:

Draft