[CLOSED] Keep receiving the following exception "An item with the same key has already been added."

  1. #1

    [CLOSED] Keep receiving the following exception "An item with the same key has already been added."

    Hello,

    When using the following example, I keep receiving the following exception:

    An item with the same key has already been added.
    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.ArgumentException: An item with the same key has already been added.
    
    
    Source Error:
    
    
    Line 80:         new public static string Transform(string text)
    Line 81:         {
    Line 82:             return new ExtNetTransformer(ExtNetTransformer.PrepareText(text)).Transform();
    Line 83:         }
    Line 84: 
    
    
    
    
    Source File: D:\Application\Library\Required Dependencies\Ext.NET\Source\2.0.0.DP1\Ext.Net\Core\ExtNetTransformer.cs    Line: 82
    
    
    Stack Trace:
    
    
    [ArgumentException: An item with the same key has already been added.]
       System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +12674096
       Transformer.NET.Token.ParseAnchors() +478
       Transformer.NET.TextTransformer.Parse(List`1 tokensType, Dictionary`2 variables) +793
       Transformer.NET.TextTransformer.Transform(List`1 tokensType, Dictionary`2 variables) +22
       Ext.Net.ExtNetTransformer.Transform(String text) in D:\Application\Library\Required Dependencies\Ext.NET\Source\2.0.0.DP1\Ext.Net\Core\ExtNetTransformer.cs:82
       Ext.Net.InitScriptFilter.Transform() in D:\Application\Library\Required Dependencies\Ext.NET\Source\2.0.0.DP1\Ext.Net\Core\InitScriptFilter.cs:70
       Ext.Net.InitScriptFilter.Flush() in D:\Application\Library\Required Dependencies\Ext.NET\Source\2.0.0.DP1\Ext.Net\Core\InitScriptFilter.cs:57
       System.Web.HttpWriter.Filter(Boolean finalFiltering) +398
       System.Web.HttpResponse.FilterOutput() +141
       System.Web.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +168
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
    When using the following:

    Layout.cshtml:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head runat="server">
            <title>@ViewBag.Title</title>
        </head>
        <body>
            @(Html.X().ResourceManager()
                .IDMode(Ext.Net.IDMode.Static)
                .Theme(Ext.Net.Theme.Gray)
            )
    
    
            @(Html.X().Viewport()
                .Border(false)
                .Layout(Ext.Net.LayoutType.Fit)
                .Items(a =>
                    a.Add(Html.X().Panel()
                        .BodyStyle("background-color: #FFFFFF;")
                        .Border(false)
                        .Layout(Ext.Net.LayoutType.Border)
                        .Items(b =>
                        {
                            b.Add(Html.X().Panel()
                                .BodyCls("x-panel-fade")
                                .Border(false)
                                .ItemsFromSection(this, "Content")
                                .Region(Ext.Net.Region.Center)
                            );
                        } )
                    )
                )
            )
        </body>
    </html>
    Index.cshtml:
    @{
        ViewBag.Title = "Title";
        Layout = "~/Areas/Management/Views/Shared/Layout.cshtml";
    }
    @section Content {
        @(Html.X().Panel()
            .Border(false)
            .Padding(15)
            .Items(a =>
            {
                a.Add(Html.X().Container()
                    .Html(@"
                        <h1>Setup</h1>
                        <p>Welcome to the Setup</p>
                        <br>
                    ")
                );
            } )
        )
    }
    It will only work when I change it to the following:

                a.Add(Html.X().Container()
                    .ID("Welcome")
                    .Html(@"
                        <h1>Setup</h1>
                        <p>Welcome to the Setup</p>
                        <br>
                    ")
                );
    I don't want to have to define an ID for everything :(

    Can this be looked at? I'm using DP1.

    Cheers,
    Timothy
    Last edited by Daniil; May 03, 2012 at 3:14 PM. Reason: [CLOSED]
  2. #2
    Hi Timothy,

    I've tested your code with the latest sources and it appears to be working without any errors.

    We don't support DP1 anymore, so, please update from SVN. There was a lot of fixed bug since DP1.
  3. #3
    Confirmed, please close.

    Cheers,
    Timothy

Similar Threads

  1. Replies: 5
    Last Post: Jul 31, 2012, 2:36 PM
  2. [CLOSED] How does "MaskCls" work for "AutoLoad" mask in panel control
    By leon_tang in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jul 19, 2012, 12:09 PM
  3. Replies: 1
    Last Post: Jun 26, 2012, 11:29 AM
  4. Replies: 5
    Last Post: May 02, 2012, 5:37 PM
  5. Replies: 4
    Last Post: Oct 11, 2011, 2:42 AM

Posting Permissions