FubuMvcArchive / Serenity

The dynamic duo of StoryTeller and WebDriver aim to grant you Serenity by acceptance testing your FubuMVC application
6 stars 7 forks source link

Package loading and application bootstrapping failed (While add Razor Viewengine) #20

Closed Vinoar closed 12 years ago

Vinoar commented 12 years ago

Hi Friends,

I got the following Issue, While add Razor View Engine. In Fubu Registry.

public class ConfigureFubuMVC : FubuRegistry { public ConfigureFubuMVC() { // This line turns on the basic diagnostics and request tracing IncludeDiagnostics(true);

    // All public methods from concrete classes ending in "Controller"
    // in this assembly are assumed to be action methods
    Actions.IncludeClassesSuffixedWithController();

    // Policies
    Routes
        .HomeIs<DisplayInputModel>()
        .IgnoreControllerNamesEntirely()
        .IgnoreMethodSuffix("Html")
        .RootAtAssemblyNamespace();

    Import<RazorEngineRegistry>();
    // Match views to action methods by matching
    // on model type, view name, and namespace
    Views.TryToAttachWithDefaultConventions();
}

}

Error:

Package loading and application bootstrapping failed

Lambda expression at: FubuMVC.Core.FubuApplication+<>cDisplayClasse.b9(), line 0 Applying extension FubuMVC.GettingStarted.GettingStartedExtensions System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Length cannot be less than zero. Parameter name: length at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) at System.String.Substring(Int32 startIndex, Int32 length) at FubuMVC.Razor.RazorModel.SpanExtensions.Master(IEnumerable1 chunks) in c:\BuildAgent\work\e5cfff0cc125d023\src\FubuMVC.Razor\RazorModel\SpanExtensions.cs:line 22 at FubuMVC.Razor.RazorModel.RazorParsings.Parse(IRazorTemplate template) in c:\BuildAgent\work\e5cfff0cc125d023\src\FubuMVC.Razor\RazorModel\RazorParsings.cs:line 26 at FubuMVC.Razor.RazorEngineRegistry.b__2(IRazorTemplate t) in c:\BuildAgent\work\e5cfff0cc125d023\src\FubuMVC.Razor\RazorEngine.cs:line 92 at System.Collections.Generic.GenericEnumerableExtensions.Each[T](IEnumerable1 values, Action`1 eachAction) in c:\BuildAgent\work\4a2c4b02595de142\src\FubuCore\EnumerableExtensions.cs:line 78 at FubuMVC.Razor.RazorEngineRegistry.parseTemplates() in c:\BuildAgent\work\e5cfff0cc125d023\src\FubuMVC.Razor\RazorEngine.cs:line 92 at FubuMVC.Razor.RazorEngineRegistry.scan(IFubuRegistry parentRegistry) in c:\BuildAgent\work\e5cfff0cc125d023\src\FubuMVC.Razor\RazorEngine.cs:line 84 at FubuMVC.Razor.RazorEngineRegistry.FubuMVC.Core.IFubuRegistryExtension.Configure(FubuRegistry registry) in c:\BuildAgent\work\e5cfff0cc125d023\src\FubuMVC.Razor\RazorEngine.cs:line 65 at FubuMVC.Core.FubuRegistry.ImportT in c:\BuildAgent\work\e5cfff0cc125d023\src\FubuMVC.Core\FubuRegistry.Expressions.cs:line 165 at HelloWorld.ConfigureFubuMVC..ctor() in E:\Projects\ACAP\Projects\MF_Web\Solution\HelloWorld\HelloWorld\ConfigureFubuMVC.cs:line 26 --- End of inner exception stack trace ---

Server stack trace: at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) at System.Activator.CreateInstanceT at FubuMVC.Core.FubuApplication.b__8T in c:\BuildAgent\work\e5cfff0cc125d023\src\FubuMVC.Core\FubuApplication.cs:line 118 at System.Lazy`1.CreateValue()

Exception rethrown at [0]: at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) at System.Activator.CreateInstanceT at FubuMVC.Core.FubuApplication.b8T in c:\BuildAgent\work\e5cfff0cc125d023\src\FubuMVC.Core\FubuApplication.cs:line 118 at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue() at System.Lazy1.get_Value() at FubuMVC.Core.FubuApplication.<>cDisplayClass14.b13(IFubuRegistryExtension x1) in c:\BuildAgent\work\e5cfff0cc125d023\src\FubuMVC.Core\FubuApplication.cs:line 212 at System.Collections.Generic.GenericEnumerableExtensions.Each[T](IEnumerable1 values, Action1 eachAction) in c:\BuildAgent\work\4a2c4b02595de142\src\FubuCore\EnumerableExtensions.cs:line 78 at FubuMVC.Core.FubuApplication.applyFubuExtensionsFromPackages(IPackageLog log) in c:\BuildAgent\work\e5cfff0cc125d023\src\FubuMVC.Core\FubuApplication.cs:line 209 at FubuMVC.Core.FubuApplication.<>cDisplayClasse.<>cDisplayClass10.bb(IPackageLog log) in c:\BuildAgent\work\e5cfff0cc125d023\src\FubuMVC.Core\FubuApplication.cs:line 151 at Bottles.LambdaBootstrapper.Bootstrap(IPackageLog log) at Bottles.PackagingRuntimeGraph.<>cDisplayClass4.b3(IBootstrapper currentBootstrapper, IPackageLog log) at Bottles.Diagnostics.PackagingDiagnosticsExtensions.<>cDisplayClass21.<>cDisplayClass4.b__1() at Bottles.Diagnostics.PackageLog.Execute(Action continuation)

Message Stack Track.

at Bottles.PackageRegistry.b__c() at Bottles.PackageRegistry.AssertNoFailures(Action failure) at Bottles.PackageRegistry.AssertNoFailures() at FubuMVC.Core.FubuApplication.Bootstrap() in c:\BuildAgent\work\e5cfff0cc125d023\src\FubuMVC.Core\FubuApplication.cs:line 164 at HelloWorld.App_Start.AppStartFubuMVC.Start() in E:\Projects\ACAP\Projects\MF_Web\Solution\HelloWorld\HelloWorld\App_Start\FubuMVC.cs:line 18

jeremydmiller commented 12 years ago

I'm going to close this issue. I think you just need to ask the question in the fubumvc list: https://groups.google.com/forum/?fromgroups#!forum/fubumvc-devel

hartez commented 11 years ago

Just in case some other poor soul ends up here after searching Google for this error message: I just fought this problem for hours. It's an issue where the Razor engine is parsing the Layout directive of all the views at application start. An old 'obj' folder from a previous build was somehow in limbo (clean wasn't catching it) and had a weirdly-escaped, malformed old .cshtml file sitting in it. The Razor bootstrapping process was picking it up and trying unsuccessfully to parse it. Deleting the stray 'obj' folder solved the problem.

jeremydmiller commented 11 years ago

I don't suppose I could get you to move this issue to FubuMVC.ViewEngines, could I? I think it's going to be a simple matter of making the view discovery stay out of the /obj and /bin folders, but that's the right place for this issue.