daveaglick / FluentBootstrap

Provides extensions, helper classes, model binding, and other goodies to help you use the Bootstrap CSS framework from .NET code.
http://www.fluentbootstrap.com
MIT License
200 stars 76 forks source link

Stack Empty Exception - caused by "Bootstrap().Dropdown" #1

Closed shawty closed 9 years ago

shawty commented 9 years ago

Synopsis

Creating a test harness to learn the library, using samples from website/docs causes a "Stack Empty Exception" to be thrown.

Software Used

Visual Studio 2013 Ultimate (Update 4) Windows 7 X64 Bootstrap 3.1.1 (NuGet Package) FluentBootstrap.Mvc (Current NuGet Package) .NET Runtime V4 IIS7.5

Hardware Used

Intel Core I7 3ghz 4 core w hyper threading enabled

To Reproduce

YSOD as produced when running the solution

untitled

View that causes the above YSOD

untitled

_layout.cshtm (Used to produce full view)

untitled

Resolution

Removal of the line used to create the dropdown from the view and re-running prevents the empty stack exception.

A project configured for NuGet package restore can be zipped and provided if requested.

daveaglick commented 9 years ago

Thanks again for the detailed issue. I am able to reproduce. It appears that just doing @Html.Bootstrap().Dropdown("My Dropdown") is enough to throw the exception.

The problem is that certain components (such as Dropdown) check an internally maintained stack of FluentBootstrap components during rendering. For example, the Dropdown checks if it's in a Navbar. In all my tests, I've apparently always wrapped these components in something else (so there's already something on the stack). A simple empty check should do the trick.

Stupid mistake - a fix (and test) should be available in source and on NuGet momentarily.

shawty commented 9 years ago

No probs, will wait 5 mins then will do a NuGet update and re-test.

daveaglick commented 9 years ago

Better wait 10 - AppVeyor can sometimes take a few... :)

shawty commented 9 years ago

NuGet upgraded, can confirm issue resolved.

daveaglick commented 9 years ago

Awesome, thanks.