For some reason any computed properties that return bool cause the ko.Initialize() method call to fail. For example this fails:
[Computed]
public bool HasExpirationDate { get { return true; } }
This will cause this call to fail:
@ko.Initialize(Model)
With the following error:
No coercion operator is defined between types 'System.Int32' and 'System.Boolean'.
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: No coercion operator is defined between types 'System.Int32' and 'System.Boolean'.
Source Error:
Line 7: {
Line 8: @Scripts.Render("~/bundles/scripts/datepicker")
Line 9: @ko.Initialize(Model)
Line 10:
Line 11:
Source File: c:\Development\Projects\Base House Contracting\Dev\Website\Views\TradeReview\Index.cshtml Line: 9
For some reason any computed properties that return bool cause the ko.Initialize() method call to fail. For example this fails:
[Computed] public bool HasExpirationDate { get { return true; } }
This will cause this call to fail:
@ko.Initialize(Model)
With the following error:
No coercion operator is defined between types 'System.Int32' and 'System.Boolean'. 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: No coercion operator is defined between types 'System.Int32' and 'System.Boolean'.
Source Error:
Line 7: { Line 8: @Scripts.Render("~/bundles/scripts/datepicker") Line 9: @ko.Initialize(Model) Line 10: Line 11:
Source File: c:\Development\Projects\Base House Contracting\Dev\Website\Views\TradeReview\Index.cshtml Line: 9
Stack Trace:
[InvalidOperationException: No coercion operator is defined between types 'System.Int32' and 'System.Boolean'.] System.Linq.Expressions.Expression.Convert(Expression expression, Type type, MethodInfo method) +6156301 DelegateDecompiler.MethodBodyDecompiler.Decompile() +297 DelegateDecompiler.Cacheb 17() +33
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Funcb 22(IAsyncResult asyncResult) +240
System.Web.Mvc.<>cDisplayClass1d.b 18(IAsyncResult asyncResult) +28
System.Web.Mvc.Async.<>cDisplayClass4.b 3(IAsyncResult ar) +15
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.<>cDisplayClass4.b 3(IAsyncResult ar) +15
System.Web.Mvc.<>cDisplayClass8.b 3(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>cDisplayClass4.b 3(IAsyncResult ar) +15
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +282
2.GetOrAdd(TKey key, Func
2 func) +247 DelegateDecompiler.DecompileExtensions.Decompile(MethodInfo method) +127 DelegateDecompiler.DecompileExpressionVisitor.Decompile(MethodInfo method, Expression instance, IList1 arguments) +36 PerpetuumSoft.Knockout.KnockoutJsModelBuilder.AddComputedToModel(Type modelType, Object model, String modelName) +321 PerpetuumSoft.Knockout.KnockoutContext
1.GetInitializeData(TModel model, Boolean needBinding) +526 PerpetuumSoft.Knockout.KnockoutContext1.Initialize(TModel model) +14 ASP.<>c__DisplayClass4.<Execute>b__2() in c:\Development\Projects\Base House Contracting\Dev\Website\Views\TradeReview\Index.cshtml:9 System.Web.WebPages.<>c__DisplayClassb.<RenderSection>b__9(TextWriter tw) +289 System.Web.WebPages.WebPageBase.Write(HelperResult result) +89 ASP._Page_Views_Shared__Layout_cshtml.Execute() in c:\Development\Projects\Base House Contracting\Dev\Website\Views\Shared\_Layout.cshtml:74 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +125 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +196 System.Web.WebPages.WebPageBase.Write(HelperResult result) +89 System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action
1 body) +233 System.Web.WebPages.WebPageBase.PopContext() +291 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +380 System.Web.Mvc.<>cDisplayClass1a.1 continuation) +613 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func
1 continuation) +613 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +613 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList
1 filters, ActionResult actionResult) +263 System.Web.Mvc.Async.<>cDisplayClass25.