Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack Overflow Exception #6

Closed
mcghub opened this issue Feb 2, 2013 · 4 comments
Closed

Stack Overflow Exception #6

mcghub opened this issue Feb 2, 2013 · 4 comments

Comments

@mcghub
Copy link

mcghub commented Feb 2, 2013

I'm having a hard time getting started with FormFactory. I've installed FormFactory and FormFactory.Templates via Nuget but keep getting a StackOverflowException with the following:

<form>
    @{
        var me = new Site { Name = "Hello World", Id = 55 };

        Html.PropertiesFor(me).Render();
    }
    <input type="submit" value="submit" />
</form>

I'm using MVC4.

@mcintyre321
Copy link
Owner

Do you have the stacktrace? I've tried this in the example project, where it works, but it may be on MVC3. The stacktrace should be helpful.

This might happen if your Site class self-references itself I think.

@mcghub
Copy link
Author

mcghub commented Feb 3, 2013

Here's the definition for the Site class:

public class Site
{
    //Properties
    public int Id { get; set; }
    public string Name { get; set; }
    public string Domain { get; set; }

    //Navigations
    public virtual List<Page> Pages { get; set; }
}

If I remove the virtual Pages property it works.

Here's the call stack:

App_Web_lszlwmbd.dll!ASP._Page_Views_Shared_FormFactory_Property_System_Object_cshtml.Execute() Line 75 + 0xdf bytes    C#
[External Code] 
App_Web_lszlwmbd.dll!ASP._Page_Views_Shared_FormFactory_Form_Property_Block_cshtml.Execute() Line 18 + 0x36 bytes   C#
[External Code] 
App_Web_lszlwmbd.dll!ASP._Page_Views_Shared_FormFactory_Form_Property_cshtml.Execute() Line 17 + 0x4d bytes C#
[External Code] 
App_Web_lszlwmbd.dll!ASP._Page_Views_Shared_FormFactory_Property_System_Object_cshtml.Execute() Line 75 + 0xdf bytes    C#
[External Code] 
App_Web_lszlwmbd.dll!ASP._Page_Views_Shared_FormFactory_Form_Property_Block_cshtml.Execute() Line 18 + 0x36 bytes   C#
[External Code] 
App_Web_lszlwmbd.dll!ASP._Page_Views_Shared_FormFactory_Form_Property_cshtml.Execute() Line 17 + 0x4d bytes C#
[External Code] 
App_Web_lszlwmbd.dll!ASP._Page_Views_Shared_FormFactory_Property_System_Object_cshtml.Execute() Line 75 + 0xdf bytes    C#
[External Code] 
App_Web_lszlwmbd.dll!ASP._Page_Views_Shared_FormFactory_Form_Property_Block_cshtml.Execute() Line 18 + 0x36 bytes   C#
[External Code] 
App_Web_lszlwmbd.dll!ASP._Page_Views_Shared_FormFactory_Form_Property_cshtml.Execute() Line 17 + 0x4d bytes C#
[External Code] 
App_Web_lszlwmbd.dll!ASP._Page_Views_Shared_FormFactory_Property_System_Object_cshtml.Execute() Line 75 + 0xdf bytes    C#
[External Code] 
App_Web_lszlwmbd.dll!ASP._Page_Views_Shared_FormFactory_Form_Property_Block_cshtml.Execute() Line 18 + 0x36 bytes   C#
[External Code] 
App_Web_lszlwmbd.dll!ASP._Page_Views_Shared_FormFactory_Form_Property_cshtml.Execute() Line 17 + 0x4d bytes C#
[External Code] 
App_Web_lszlwmbd.dll!ASP._Page_Views_Shared_FormFactory_Property_System_Object_cshtml.Execute() Line 75 + 0xdf bytes    C#

@mcintyre321
Copy link
Owner

What is the class definition for Page? I suspect it is a property on there.

Can you also use ICollection rather that List on the method signature? The ICollection renderer is better.

@mcintyre321
Copy link
Owner

Can't reproduce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants