[CLOSED] Issues with a complex layout of many partials

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Issues with a complex layout of many partials

    Firstly, I realise that your stock reply will be "please supply an example that shows the problem" but as that will take time, I'm going to explain the issues first.

    My site (MVC Razor) uses a complex layout based on partials which are included dynamically based on view model data e.g the default Razor master _layout.cshtml uses model data to load partials using ComponentLoader using ...

                                   .Items( layout =>
                                           {
                                               for (int item = 0; item < @Model.PageItems.Count; item++)
                                               {
                                                  PageItem pi = @Model.PageItems.ElementAt(item);
                                                   layout.Add(
                                                               Html.X().Panel()
                                                                   .BaseCls("x-plain")
                                                                   .ID(pi.Id)
                                                                   .Border(false)
                                                                   .Loader(Html.X().ComponentLoader()
                                                                               .Url(Url.Action(pi.ActionUrl))
                                                                               .Mode(LoadMode.Script)
                                                                               .Params(new { containerId = pi.ContainerId })
                                                                          )
                                                            );
                                              }
    The controller actions are "out-of-the-box" .....

            public Ext.Net.MVC.PartialViewResult _CandidateHomeHeader(string containerId)
            {
                return new Ext.Net.MVC.PartialViewResult
                {
                    RenderMode = RenderMode.AddTo,
                    ContainerId = containerId,
                    WrapByScriptTag = false // we load the view via Loader with Script mode therefore script tags is not required
                };
            }
    The ResourceManager is invoked from in _layout.cshtml and each "view" uses this master layour. Each partial loaded in the above way, may load additional partials using ItemsFromPartial(...) on components.

    Now, the first issue.

    If any component specifies a .Render or a .Listener or a .Icon I occassionally get an error popup with .....


    Ext.ComponentManager.onAvailable("_SubmitEvidence" ,function(){Ext.net.append(Ext.getBody(),[" ","


    More frequently, I get a full blown runtime exception ....


    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    Line 246: {
    Line 247: BaseControl.SectionsStack.Push(new List<string>());
    Line 248: var result = Ext.Net.X.Builder.HtmlHelper.Partial(partialViewNa me);
    Line 249: this.HandleResult(result);
    Line 250: return this as TBuilder;

    Source File: c:\Users\mckelvied\Projects\VS2012 Projects\Ext.Net SVN v2.2.1\Ext.Net\MVC\Factory\AbstractContainerBuilde r.cs Line: 248



    If I comment out all .Render, .Listener and .Icon directives, I do not get the Ext.ComponentManager.onAvailable error any more but do occassionally get the full blown exception (maybe 1 in 10 page loads). This points to a timing triggered issue.

    If I have even just one of .Render, .Listener and .Icon directives in any partial, it will generate a full blown exception every page load.

    Any inital thoughts?
    Last edited by Daniil; Jul 30, 2013 at 4:12 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Yes, sample is required to understand the issue

    If any component specifies a .Render or a .Listener or a .Icon I occassionally get an error popup with .....
    Can you post text of that error? Also please post full generated code of 'Ext.ComponentManager.onAvailable'

    More frequently, I get a full blown runtime exception ....
    Can explain what exactly property is null? Is 'Ext.Net.X.Builder.HtmlHelper' null?
  3. #3
    Quote Originally Posted by Vladimir View Post
    Hi,

    Yes, sample is required to understand the issue


    1) Can you post text of that error?
    2) Also please post full generated code of 'Ext.ComponentManager.onAvailable'


    3) Can explain what exactly property is null?
    4) Is 'Ext.Net.X.Builder.HtmlHelper' null?
    1) That is the full text of the error (in a Request Failure dialog with Status Code = 200 and Status Text = OK ).
    2) How do I get that?
    3) and 4) I should have pasted more of the exception ....


    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    Line 246: {
    Line 247: BaseControl.SectionsStack.Push(new List<string>());
    Line 248: var result = Ext.Net.X.Builder.HtmlHelper.Partial(partialViewNa me);
    Line 249: this.HandleResult(result);
    Line 250: return this as TBuilder;

    Source File: c:\Users\mckelvied\Projects\VS2012 Projects\Ext.Net SVN v2.2.1\Ext.Net\MVC\Factory\AbstractContainerBuilde r.cs Line: 248

    Stack Trace:

    [NullReferenceException: Object reference not set to an instance of an object.]
    Microsoft.VisualStudio.WebHost.Request.GetRemoteAd dress() +62
    System.Web.HttpWorkerRequest.IsLocal() +16
    System.Web.HttpRequestWrapper.get_IsLocal() +19
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy() +54
    System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +97
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
    System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +260
    System.Web.Mvc.BuildManagerCompiledView.Render(Vie wContext viewContext, TextWriter writer) +115
    System.Web.Mvc.HtmlHelper.RenderPartialInternal(St ring partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +276
    System.Web.Mvc.Html.PartialExtensions.Partial(Html Helper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +108
    System.Web.Mvc.Html.PartialExtensions.Partial(Html Helper htmlHelper, String partialViewName) +31
    Ext.Net.Builder`2.ItemsFromPartial(String partialViewName) in c:\Users\mckelvied\Projects\VS2012 Projects\Ext.Net SVN v2.2.1\Ext.Net\MVC\Factory\AbstractContainerBuilde r.cs:248
    ASP._Page_Views_Shared__SubmitEvidenceBrowseSelect UploadPanel_cshtml.Execute() in c:\Users\mckelvied\Projects\VS2012 Projects\CAMS\Main\Source\CAMS.Web.UI\Views\Shared \_SubmitEvidenceBrowseSelectUploadPanel.cshtml:8
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy() +197
    System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +97
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
    System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +260
    System.Web.Mvc.BuildManagerCompiledView.Render(Vie wContext viewContext, TextWriter writer) +115
    System.Web.Mvc.HtmlHelper.RenderPartialInternal(St ring partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +276
    System.Web.Mvc.Html.PartialExtensions.Partial(Html Helper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +108
    System.Web.Mvc.Html.PartialExtensions.Partial(Html Helper htmlHelper, String partialViewName) +31
    Ext.Net.Builder`2.ItemsFromPartial(String partialViewName) in c:\Users\mckelvied\Projects\VS2012 Projects\Ext.Net SVN v2.2.1\Ext.Net\MVC\Factory\AbstractContainerBuilde r.cs:248
    ASP._Page_Views_Shared__SubmitEvidence_cshtml.Exec ute() in c:\Users\mckelvied\Projects\VS2012 Projects\CAMS\Main\Source\CAMS.Web.UI\Views\Shared \_SubmitEvidence.cshtml:11
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy() +197
    System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +97
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
    System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +260
    System.Web.Mvc.BuildManagerCompiledView.Render(Vie wContext viewContext, TextWriter writer) +115
    Ext.Net.MVC.PartialViewResult.RenderRazorView(Cont rollerContext context, RazorView razorView) in c:\Users\mckelvied\Projects\VS2012 Projects\Ext.Net SVN v2.2.1\Ext.Net\MVC\Results\PartialViewResult.cs:55 8
    Ext.Net.MVC.PartialViewResult.ExecuteResult(Contro llerContext context) in c:\Users\mckelvied\Projects\VS2012 Projects\Ext.Net SVN v2.2.1\Ext.Net\MVC\Results\PartialViewResult.cs:28 3


    So I recon the result from Ext.Net.X.Builder.HtmlHelper.Partial(partialViewNa me); is NULL due to GetRemoteAddress failing. I am running this in debug within VS2012 using the ASP.NET development server so I don't think that anything should be "remote"? I also notice this in VS2012 output pane ....


    A first chance exception of type 'System.NullReferenceException' occurred in WebDev.WebHost40.dll
    A first chance exception of type 'System.NullReferenceException' occurred in System.Web.Mvc.dll


    I will try and create a cut down example that causes the issue.
  4. #4
    About "Ext.ComponentManager.onAvailable", please use Fiddler or similar tool (for example, Firebug in Firefox) to get response text and post it here
    We will analyze generated js code which causes js error

    About, server side exception, I see that error inside .NET code, I am not sure that the issue is related with Ext.Net, in any way I'll try to find info about similar exception in internet
  5. #5
    It seems that 'Microsoft.VisualStudio.WebHost.Request.GetRemoteA ddress()' is used during debuging (when you use VS test web server)
    It is not related with Ext.Net, do you have the same issue if IIS is used?
  6. #6
    Quote Originally Posted by Vladimir View Post
    It seems that 'Microsoft.VisualStudio.WebHost.Request.GetRemoteA ddress()' is used during debuging (when you use VS test web server)
    It is not related with Ext.Net, do you have the same issue if IIS is used?
    I hope this is what you require .......

    Ext.net.ResourceMgr.registerIcon(["BulletPlus"]);Ext.ComponentManager.onAvailable("_SubmitEvidence",function(){Ext.net.append(Ext.getBody(),["        ","<script type=\"text/javascript\">","    var lastCUTitle;","    var firstCU;","    // TODO ","    function fnRenderElementSelectedCheckbox(value, metadata, record) {","        if (record.data.IsSelected == true)","        {","            return \"<input name=\\\"elementCheckbox\\\" value=\\\"\" + record.data.CUId + \"\\\" type=\\\"checkbox\\\" checked=\\\"checked\\\" />\";","        }","        return \"<input name=\\\"elementCheckbox\\\" value=\\\"\" + record.data.CUId + \"\\\" type=\\\"checkbox\\\" />\";","    }","    // TODO ","    function fnPostRenderElementSelectedCheckbox(item) {","        if (item != null) {","            lastCUTitle = null;","            firstCU = true;","        }","    }","    // ============================ Store changed listener ================================","    // This function parses the store after loading and creates the buttons in the panel","    // \"ELEMENTS_PANEL_ID\" that indicated which unique Competency Units have been selected","    // for evidence tagging.","    function fnStoreChanged() ","    {","        var lastCU = null;","        var firstCU = true;","        this.data.each(function(item, index, totalItems) ","        {","            if (lastCU != item.data.CUTitle && item.data.IsSelected ) ","            {","                lastCU = item.data.CUTitle;","                if (firstCU) ","                {","                    firstCU = false;","                    Ext.getCmp('NoPerfCriteria').hide();","                }","                var button = Ext.create('Ext.Button',","                    {","                        id: item.data.CUId,","                        text: item.data.CUTitle,","                        cls: 'wrap-button',","                        width: 60,","                        height: 60,","                        margin: '5, 5, 5, 5'","                    });","                Ext.getCmp('ELEMENTS_PANEL_ID').add(button);","            }","        });","    }","    // ============================ checkbox changed listener ================================","    // This function will add a new button to the \"ELEMENTS_PANEL_ID\" panel if the checkbox has","    // been checked and it is a new and unique Competency Unit selection. If the checkbox has been","    // unchecked, the associated Competency Unit button in the \"Elements Pane\" will be removed","    // if all checkboxes associated with the CU have been unchecked. If there are no buttons","    // in the Element Pane, hint text will be shown.","    function fnCheckboxChange(item, rowindex, record, checked) {","        if (checked === true)","        {","            var existingButton = Ext.getCmp(record.data.CUId);","            if (existingButton == null)","            {","                var button = Ext.create('Ext.Button',","                    {","                        id: record.data.CUId,","                        text: record.data.CUTitle,","                        cls: 'wrap-button',","                        width: 60,","                        height: 60,","                        margin: '5, 5, 5, 5'","                    });","                Ext.getCmp('ELEMENTS_PANEL_ID').add(button);","            }","        }","        else","        {","            if ($(\"input[value=\" + record.data.CUId + \"]:checked\").length == 0)","            {   ","                var button = Ext.getCmp(record.data.CUId);","                if (button != null) {","                    Ext.getCmp('ELEMENTS_PANEL_ID').remove(button);","                }","                var panel = Ext.getCmp('ELEMENTS_PANEL_ID');","                if (Ext.getCmp('ELEMENTS_PANEL_ID').items.length == 1) {","                    Ext.getCmp('NoPerfCriteria').show();","                }","            }","        }","    }","<\/script>","/* --------------------------- spacer --------------------------- */","                     ","<script>","                                    function insertImage() {","                                        var win = this.up('window'),","                                            image = win.down('dataview').selModel.getSelection()[0];","                                        if (image) {","                                            var imageEl = Ext.fly('ELEMENTS_PANEL_ID').createChild({","                                                tag: 'img',","                                                src: image.get('url')","                                            });","                                            imageEl.hide().show({ duration: 500 }).frame();","                                            win.animateTarget = imageEl;","                                            win.hide();","                                        }","                                    }","                                <\/script>","            <script>","                function loadRecord(image){","                    this.body.hide();","                    this.tpl.overwrite(this.body, image.data);","                    this.body.slideIn('r', {","                        duration: 250","                    });","                }","            <\/script>","<script>","                        function filter (field, value) {","                            var dataview = this.up('window').down('dataview'),","                                store = dataview.store;","                                    ","                            store.suspendEvents();","                            store.clearFilter();","                            dataview.getSelectionModel().clearSelections();","                            store.resumeEvents();","                            store.filter({","                                property: 'name',","                                anyMatch: true,","                                value   : value","                            });","                        }","                    <\/script>            ","                             ","             ","        ","         "].join(''));Ext.net.addTo("_SubmitEvidence", [{"bin":[Ext.create("Ext.data.Store",{"model":Ext.define(Ext.id(), {extend: "Ext.data.Model", "fields":[{"name":"CUId"},{"name":"CUTitle"},{"name":"CUDescription"},{"name":"CEId"},{"name":"CETitle"},{"name":"CEDescription"},{"name":"PerfCritId"},{"name":"PerfCriteria"},{"name":"IsSelected","type":"boolean"}] }),"storeId":"SUBMIT_EVIDENCE_STORE_ID","autoLoad":true,"proxy":{"type":"ajax","reader":{"type":"json","root":"Data","successProperty":"Success","totalProperty":"Total","messageProperty":"Message"},"url":"/Api/CompetencyApi/RetrieveUnitsExt","startParam":undefined,"limitParam":undefined},"groupField":"CUDescription","pageSize":5000})],"border":false,"padding":"1, 20, 10, 20","xtype":"container","items":[{"border":true,"xtype":"container","items":[{"id":"PERFORMANCE_CRITERIA_GRID_PANEL_ID","border":true,"cls":"custom-grid","maxHeight":750,"padding":2,"width":1000,"xtype":"grid","region":"west","flex":3,"autoScroll":true,"layout":{"type":"hbox","align":"stretch"},"bbar":{"ui":"flat","xtype":"pagingtoolbar","flat":true,"displayInfo":true,"displayMsg":"Displaying elements {0} - {1} of {2}"},"tbar":{"ui":"flat","xtype":"toolbar","items":[{"xtype":"tbfill"},{"handler":function(){this.up('gridpanel').getView().getFeature('UserCompElementsGrouping').expandAll();},"iconCls":"#BulletPlus","text":"Expand All"},{"handler":function(){this.up('gridpanel').getView().getFeature('UserCompElementsGrouping').collapseAll();},"text":"Collapse All"},{"width":30,"xtype":"tbspacer"}],"flat":true},"columnLines":true,"columns":{"items":[{"id":"CU-ID","hidden":true,"dataIndex":"CUId"},{"id":"CE-ID","hidden":true,"dataIndex":"CEId"},{"id":"PerfCrit-ID","hidden":true,"dataIndex":"PerfCritId"},{"dataIndex":"CUDescription","hideable":false,"text":"Competency Units"},{"width":100,"dataIndex":"CUTitle","menuDisabled":true,"sortable":false,"text":"Unit"},{"width":100,"dataIndex":"CEDescription","menuDisabled":true,"sortable":false,"text":"Element"},{"flex":1,"dataIndex":"PerfCriteria","menuDisabled":true,"sortable":false,"text":"Performance / Knowledge Criteria Assessment"},{"width":60,"xtype":"checkcolumn","align":"center","dataIndex":"IsSelected","menuDisabled":true,"renderer":fnRenderElementSelectedCheckbox,"sortable":false,"text":"Select","tooltip":"Select to associate item with evidence","editable":true}]},"features":[window.App.UserCompElementsGrouping=Ext.create("Ext.grid.feature.Grouping",{"proxyId":"UserCompElementsGrouping","ftype":"grouping","enableGroupingMenu":false,"groupHeaderTpl":"{name} ({rows.length} Element{[values.rows.length > 1 ? 's' : '']})","hideGroupedHeader":true,"startCollapsed":true})],"viewConfig":{"xtype":"gridview"}},{"baseCls":"x-plain","minWidth":20,"xtype":"panel"},{"border":false,"cls":"img-chooser-dlg","padding":"24, 0, 0, 0","width":752,"xtype":"panel","region":"east","items":[{"id":"North","border":false,"width":750,"region":"north","items":[{"id":"EVIDENCE_BROWSER_PANEL_ID","border":false,"minHeight":100,"width":750,"region":"north","autoScroll":true,"items":[{"id":"ImgDetailPanel","loadRecord":loadRecord,"border":true,"minWidth":150,"tpl":Ext.create("Ext.net.XTemplate",{"html":["<div class=\"details\">","<tpl for=\".\">","<tpl if=\"!Ext.isIE6\">","<img src=\"{imageUrl}\" />","</tpl>","<tpl if=\"Ext.isIE6\">","<div style=\"width:74px;height:74px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{imageUrl}')\"></div>","</tpl>","<div class=\"details-info\">","<b>File Name:</b>","<span>{fullname}</span>","<b>Size:</b>","<span>{sizeString}</span>","<b>Evidence Type:</b>","<span>{evidenceType}</span>","<b>Description:</b>","<span>{description}</span>","<b>Upload Date:</b>","<span>{uploadDate}</span>","</div>","</tpl>","</div>",""]}),"width":250,"xtype":"panel","region":"east","split":true},{"border":true,"width":500,"xtype":"panel","region":"center","autoScroll":true,"items":[{"cls":"img-chooser-view","tpl":Ext.create("Ext.net.XTemplate",{"html":["<tpl for=\".\">","<div class=\"thumb-wrap\">","<div class=\"thumb\">","<tpl if=\"!Ext.isIE6\">","<img src='{imageUrl}' />","</tpl>","<tpl if=\"Ext.isIE6\">","<div style=\"width:74px;height:74px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{imageUrl}')\"></div>","</tpl>","</div>","<span>{name}</span>","</div>","</tpl>",""]}),"xtype":"dataview","itemSelector":"div.thumb-wrap","overItemCls":"x-view-over","singleSelect":true,"store":{"model":Ext.define(Ext.id(), {extend: "Ext.data.Model", "fields":[{"name":"name"},{"name":"fullname"},{"name":"imageUrl","type":"string"},{"name":"evidenceUrl"},{"name":"sizeString"},{"name":"size","type":"int"},{"name":"evidenceType"},{"name":"description"},{"name":"uploadDate"}] }),"autoLoad":true,"proxy":{"type":"ajax","reader":{"type":"json","root":"Data"},"url":"/Api/CompetencyApi/RetrieveUserEvidence"}},"listeners":{"itemdblclick":{"fn":insertImage},"selectionchange":{"fn":function(item,selections){if(selections[0]){App.ImgDetailPanel.loadRecord(selections[0]);}}}}}],"tbar":{"xtype":"toolbar","items":[{"width":150,"xtype":"textfield","fieldLabel":"Filter","labelAlign":"right","labelWidth":35,"listeners":{"change":{"buffer":250,"fn":filter}}},{"xtype":"tbspacer"},{"width":150,"xtype":"combobox","fieldLabel":"Sort By","labelAlign":"right","labelWidth":45,"editable":false,"queryMode":"local","store":[["name","name"],["size","size"]],"listeners":{"select":{"fn":function(item,records){this.up('window').down('dataview').store.sort(this.getValue());}}}}]}}],"layout":{"type":"hbox","align":"stretch"}},{"id":"ELEMENTS_PANEL_ID","border":true,"minHeight":100,"region":"south","items":[{"id":"NoPerfCriteria","cls":"floating-label-12pt-grey-italic","margin":"150, 50, 20, 50","xtype":"netlabel","text":"You do not have any submitted Evidence against Performance Criteria"}]}],"layout":{"type":"vbox","align":"stretch"},"bbar":{"border":false,"ui":"flat","xtype":"toolbar","items":[{"text":"Upload Evidence","tooltip":"Upload your evidence against the selected performance criteria"},{"text":"Create Evidence","tooltip":"Opens a window where evidence can be created and saved","directEvents":{"click":{fn:function(item,e){Ext.net.directRequest({"cleanRequest":true,"url":"/UserActivities/RenderCreateEvidenceWindow",control:this});}}}},{"xtype":"filefield","tooltips":[{"xtype":"tooltip","items":[{"xtype":"netlabel","text":"Browse for existing evidence to submit"}]}],"buttonText":"Browse","buttonOnly":true}],"flat":true}}],"layout":{"type":"hbox","align":"stretch"},"title":"Evidence"}],"layout":{"type":"hbox","align":"stretch"}}],"layout":"fit"}], false);});

    As for the GetRemoteAddress issue, I'm quite happy to accept that it may be a Microsoft problem that I can work around but why is it easlier inrtroduced by defining a Listener, Icon or Renderer? What from an Ext.Net viewpoint changes? As it is indeterminate, do you use asynchronous access methods which may result in differennt timings?
  7. #7

    Still get error usin IIS (Express)

    Quote Originally Posted by Vladimir View Post
    It seems that 'Microsoft.VisualStudio.WebHost.Request.GetRemoteA ddress()' is used during debuging (when you use VS test web server)
    It is not related with Ext.Net, do you have the same issue if IIS is used?

    OK, I've configured VS2012 to use IIS (Express) and I still get an exception, albeit a different one. Stack trace included below.


    Server Error in '/' Application.
    --------------------------------------------------------------------------------


    Stack empty.
    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.InvalidOperationException: Stack empty.

    Source Error:





    Line 246: {
    Line 247: BaseControl.SectionsStack.Push(new List<string>());
    Line 248: var result = Ext.Net.X.Builder.HtmlHelper.Partial(partialViewNa me);
    Line 249: this.HandleResult(result);
    Line 250: return this as TBuilder;

    Source File: c:\Users\mckelvied\Projects\VS2012 Projects\Ext.Net SVN v2.2.1\Ext.Net\MVC\Factory\AbstractContainerBuilde r.cs Line: 248

    Stack Trace:





    [InvalidOperationException: Stack empty.]
    System.ThrowHelper.ThrowInvalidOperationException( ExceptionResource resource) +52
    System.Collections.Generic.Stack`1.Pop() +6704369
    System.Web.WebPages.TemplateStack.Pop(HttpContextB ase httpContext) +25
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy() +236
    System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +97
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
    System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +260
    System.Web.Mvc.BuildManagerCompiledView.Render(Vie wContext viewContext, TextWriter writer) +115
    System.Web.Mvc.HtmlHelper.RenderPartialInternal(St ring partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +276
    System.Web.Mvc.Html.PartialExtensions.Partial(Html Helper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +108
    System.Web.Mvc.Html.PartialExtensions.Partial(Html Helper htmlHelper, String partialViewName) +31
    Ext.Net.Builder`2.ItemsFromPartial(String partialViewName) in c:\Users\mckelvied\Projects\VS2012 Projects\Ext.Net SVN v2.2.1\Ext.Net\MVC\Factory\AbstractContainerBuilde r.cs:248
    ASP._Page_Views_Shared__SubmitEvidence_cshtml.Exec ute() in c:\Users\mckelvied\Projects\VS2012 Projects\CAMS\Main\Source\CAMS.Web.UI\Views\Shared \_SubmitEvidence.cshtml:9
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy() +197
    System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +97
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
    System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +260
    System.Web.Mvc.BuildManagerCompiledView.Render(Vie wContext viewContext, TextWriter writer) +115
    Ext.Net.MVC.PartialViewResult.RenderRazorView(Cont rollerContext context, RazorView razorView) in c:\Users\mckelvied\Projects\VS2012 Projects\Ext.Net SVN v2.2.1\Ext.Net\MVC\Results\PartialViewResult.cs:55 8
    Ext.Net.MVC.PartialViewResult.ExecuteResult(Contro llerContext context) in c:\Users\mckelvied\Projects\VS2012 Projects\Ext.Net SVN v2.2.1\Ext.Net\MVC\Results\PartialViewResult.cs:28 3
    System.Web.Mvc.ControllerActionInvoker.InvokeActio nResult(ControllerContext controllerContext, ActionResult actionResult) +13
    System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionRe sultWithFilters>b__17() +23
    System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
    System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionRe sultWithFilters>b__19() +21
    System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
    System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionRe sultWithFilters>b__19() +21
    System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
    System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInv okeAction>b__20() +89
    System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInv okeAction>b__22(IAsyncResult asyncResult) +102
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
    System.Web.Mvc.Async.AsyncControllerActionInvoker. EndInvokeAction(IAsyncResult asyncResult) +43
    System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCo re>b__18(IAsyncResult asyncResult) +14
    System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidD elegate>b__3(IAsyncResult ar) +23
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
    System.Web.Mvc.Controller.EndExecuteCore(IAsyncRes ult asyncResult) +57
    System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidD elegate>b__3(IAsyncResult ar) +23
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
    System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47
    System.Web.Mvc.Controller.System.Web.Mvc.Async.IAs yncController.EndExecute(IAsyncResult asyncResult) +10
    System.Web.Mvc.<>c__DisplayClass8.<BeginProcessReq uest>b__3(IAsyncResult asyncResult) +25
    System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidD elegate>b__3(IAsyncResult ar) +23
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsync Result asyncResult) +47
    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHan dler.EndProcessRequest(IAsyncResult result) +9
    System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +9629708
    System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +155



    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
  8. #8

    Just to show randomness

    Quote Originally Posted by Vladimir View Post
    It seems that 'Microsoft.VisualStudio.WebHost.Request.GetRemoteA ddress()' is used during debuging (when you use VS test web server)
    It is not related with Ext.Net, do you have the same issue if IIS is used?
    While trying to get further I still get either the internal Request Failure dialog or a full blown exception. Under IIS, I've had a slightly different exception .......


    Exception Details: System.ArgumentException: Value does not fall within the expected range.

    Source Error:

    Line 246: {
    Line 247: BaseControl.SectionsStack.Push(new List<string>());
    Line 248: var result = Ext.Net.X.Builder.HtmlHelper.Partial(partialViewNa me);
    Line 249: this.HandleResult(result);
    Line 250: return this as TBuilder;

    Source File: c:\Users\mckelvied\Projects\VS2012 Projects\Ext.Net SVN v2.2.1\Ext.Net\MVC\Factory\AbstractContainerBuilde r.cs Line: 248

    Stack Trace:

    [ArgumentException: Value does not fall within the expected range.]
    System.Runtime.InteropServices.Marshal.ThrowExcept ionForHRInternal(Int32 errorCode, IntPtr errorInfo) +0
    System.Runtime.InteropServices.Marshal.ThrowExcept ionForHR(Int32 errorCode) +10722798
    System.Web.Hosting.IIS7WorkerRequest.GetServerVari ableInternal(String name) +40
    System.Web.Hosting.IIS7WorkerRequest.GetServerVari able(String name) +36
    System.Web.Hosting.IIS7WorkerRequest.GetRemoteAddr ess() +18
    System.Web.HttpWorkerRequest.IsLocal() +16
    System.Web.HttpRequestWrapper.get_IsLocal() +19
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy() +54
    System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +97
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
    System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +260
    System.Web.Mvc.BuildManagerCompiledView.Render(Vie wContext viewContext, TextWriter writer) +115
    .
    .
    .
    .

    Incidently the CDATA in the <head> if I "view source" is .....
        <script type="text/javascript">
        //<![CDATA[
            Ext.net.ResourceMgr.init({"isMVC":true,"theme":"gray"});Ext.onReady(function(){Ext.create("Ext.container.Viewport",{"renderTo":Ext.getBody(),"items":[{"baseCls":"x-plain","region":"west","items":[{"id":"FLUID_VERTICAL_SPACED_PANEL_ID","defaults":{"margins":"0 5 0 0"},"items":[{"id":"_ToolBar","baseCls":"x-plain","border":false,"loader":{"paramsFn":function(){ return {"containerId":"_ToolBar"}; },"renderer":"script","url":"/UserActivities/_ToolBar"}},{"id":"_AwardInfoPanel","baseCls":"x-plain","border":false,"loader":{"paramsFn":function(){ return {"containerId":"_AwardInfoPanel"}; },"renderer":"script","url":"/UserActivities/_AwardInfoPanel"}},{"id":"_SubmitEvidence","baseCls":"x-plain","border":false,"loader":{"paramsFn":function(){ return {"containerId":"_SubmitEvidence"}; },"renderer":"script","url":"/UserActivities/_SubmitEvidence"}},{"baseCls":"x-plain","flex":1},{"id":"_Carousel","baseCls":"x-plain","border":false,"loader":{"paramsFn":function(){ return {"containerId":"_Carousel"}; },"renderer":"script","url":"/UserActivities/_Carousel"}},{"id":"_Navigator","baseCls":"x-plain","border":false,"loader":{"paramsFn":function(){ return {"containerId":"_Navigator"}; },"renderer":"script","url":"/UserActivities/_Navigator"}},{"id":"_Footer","baseCls":"x-plain","border":false,"loader":{"paramsFn":function(){ return {"containerId":"_Footer"}; },"renderer":"script","url":"/UserActivities/_Footer"}}],"layout":{"type":"vbox","align":"stretch"},"bodyPadding":5}],"layout":"fit"}],"layout":"fit"});});
        //]]>
        </script>
    Last edited by ATLAS; Jul 11, 2013 at 8:18 AM.
  9. #9

    Solution/Workaround

    Quote Originally Posted by ATLAS View Post
    Firstly, I realise that your stock reply will be "please supply an example that shows the problem" but as that will take time, I'm going to explain the issues first.

    My site (MVC Razor) uses a complex layout based on partials which are included dynamically based on view model data e.g the default Razor master _layout.cshtml uses model data to load partials using ComponentLoader using ...

                                   .Items( layout =>
                                           {
                                               for (int item = 0; item < @Model.PageItems.Count; item++)
                                               {
                                                  PageItem pi = @Model.PageItems.ElementAt(item);
                                                   layout.Add(
                                                               Html.X().Panel()
                                                                   .BaseCls("x-plain")
                                                                   .ID(pi.Id)
                                                                   .Border(false)
                                                                   .Loader(Html.X().ComponentLoader()
                                                                               .Url(Url.Action(pi.ActionUrl))
                                                                               .Mode(LoadMode.Script)
                                                                               .Params(new { containerId = pi.ContainerId })
                                                                          )
                                                            );
                                              }
    The controller actions are "out-of-the-box" .....

            public Ext.Net.MVC.PartialViewResult _CandidateHomeHeader(string containerId)
            {
                return new Ext.Net.MVC.PartialViewResult
                {
                    RenderMode = RenderMode.AddTo,
                    ContainerId = containerId,
                    WrapByScriptTag = false // we load the view via Loader with Script mode therefore script tags is not required
                };
            }
    The ResourceManager is invoked from in _layout.cshtml and each "view" uses this master layour. Each partial loaded in the above way, may load additional partials using ItemsFromPartial(...) on components.

    Now, the first issue.

    If any component specifies a .Render or a .Listener or a .Icon I occassionally get an error popup with .....


    Ext.ComponentManager.onAvailable("_SubmitEvidence" ,function(){Ext.net.append(Ext.getBody(),[" ","


    More frequently, I get a full blown runtime exception ....


    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    Line 246: {
    Line 247: BaseControl.SectionsStack.Push(new List<string>());
    Line 248: var result = Ext.Net.X.Builder.HtmlHelper.Partial(partialViewNa me);
    Line 249: this.HandleResult(result);
    Line 250: return this as TBuilder;

    Source File: c:\Users\mckelvied\Projects\VS2012 Projects\Ext.Net SVN v2.2.1\Ext.Net\MVC\Factory\AbstractContainerBuilde r.cs Line: 248



    If I comment out all .Render, .Listener and .Icon directives, I do not get the Ext.ComponentManager.onAvailable error any more but do occassionally get the full blown exception (maybe 1 in 10 page loads). This points to a timing triggered issue.

    If I have even just one of .Render, .Listener and .Icon directives in any partial, it will generate a full blown exception every page load.

    Any inital thoughts?



    OK chaps,
    I've spend many a long hour looking at this and trying alternative. I've got a solutions that (so far) appears to work for me. It would appear that ItemsFromPartial and loading partials via the ComponentLoader seems to introduce both timing issues and possible authentication issues (seeded by timing issues?) so I changed all ItemsFromPartial to ItemsFromPage which seems to act as partials. So in my master "_Layout" you can see the changes below (problematic code commented out) :-


                                  .Items( layout =>
                                           {
                                              for (int item = 0; item < @Model.PageItems.Count; item++)
                                                {
                                                    @* -----------------------------------------------------------------------
                                                    Do not change this unless you add more than the footer, navigation and 
                                                    carousel panels below the main content panel(s). This interposes an x-plain 
                                                    "flexed" panel above carousel to ensure the space between the toolbar and
                                                    the carousel is always filled to max available space in a fluid layout.  
                                                    ------------------------------------------------------------------------ *@    
                                                    if (item == @Model.PageItems.Count - 3)
                                                    {
                                                          layout.Add(Html.X().Panel().BaseCls("x-plain").Flex(1).ID("FLUID_FLEX_FILLER_ID"));
                                                    }
                                                @* ----------------------------------------------------------------------- *@
                                                                          
                                  
                                                   PageItem pi = @Model.PageItems.ElementAt(item);
                                                   layout.Add(Html.X().Panel().BaseCls("x-plain").ItemsFromPage(this, pi.Id + ".cshtml"));
    //                                                   Html.X().Panel()
    //                                                               .ID(pi.Id)
    //                                                               .Border(false)
    //                                                               .Loader(Html.X().ComponentLoader()
    //                                                                           .Url(Url.Action(pi.ActionUrl))
    //                                                                          .Mode(LoadMode.Script)
    //                                                                           .Params(new { containerId = pi.ContainerId })
    //                                                                      )
    //                                                        );
                                               }
                                           }                                                            
                                  )

    Next I changed all ItemsFromPartial to ItemsFromPage in every view.

    So, I'm guessing that removing the loader round trip to the controller action has altered the timings and required authentication. The down side is that I can't return minimalist bespoke models to each partial via the loader controller action.
  10. #10
    Hi,

    Thanks for your posts
    It will be much better if can provide examples are demonstrated the issues, it will allow us to fix the issues asap

    About Ext.ComponentManager.onAvailable problem, I guess that some js error occurs when we try to execute that js code
    Unfortunately, I did not notice any problem code in your posted javascript, it is required to have runable sample and we will see the error under debuger. Just one note, I see that you have a big script section in partial view, may be that script is not available yet when widgets code is executed

    For testing, try to move that script section to base page and retest


    About server side exception, Do you use AsyncController or async action results? If yes then can you try to test without async functionality?

    In any way, only sample reproduces the issues can help us to understand what is wrong

    Thanks for your reports
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] IE8 https Layout issues
    By blueworld in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 07, 2013, 4:00 PM
  2. MDI form and Complex Layout
    By themack in forum 1.x Help
    Replies: 0
    Last Post: Sep 25, 2011, 6:20 PM
  3. [CLOSED] Complex Layout
    By jchau in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 08, 2011, 8:10 PM
  4. Replies: 2
    Last Post: Mar 04, 2010, 3:57 PM
  5. [CLOSED] [1.0] Having layout issues in ie8 only
    By ashton.lamont in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 18, 2010, 5:18 AM

Posting Permissions