Common Language Runtime detected an invalid program.

Topics: Installing Orchard, Troubleshooting
Nov 16, 2011 at 8:40 PM

Hello everyone,

After downloading Orchard 1.3 using WebMatrix I run and get this message.I tried running the source code in visual studio 2010 and i get the same message

this is the stack trace : spcifically this function   --->     Orchard.DisplayManagement.Implementation.DefaultShapeFactory.Create. I thank you for your help

[InvalidProgramException: Common Language Runtime detected an invalid program.]
   Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.GenerateProperty(EXPRCALL pExpr) +0
   Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.GetExpression(EXPR pExpr) +153
   Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.GenerateAssignment(EXPRCALL pExpr) +28
   Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.VisitCALL(EXPRCALL pExpr) +89
   Microsoft.CSharp.RuntimeBinder.Semantics.ExprVisitorBase.Dispatch(EXPR pExpr) +50
   Microsoft.CSharp.RuntimeBinder.Semantics.ExprVisitorBase.Visit(EXPR pExpr) +57
   Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.GenerateLambda(EXPRCALL pExpr) +23
   Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.VisitCALL(EXPRCALL pExpr) +38
   Microsoft.CSharp.RuntimeBinder.Semantics.ExprVisitorBase.Dispatch(EXPR pExpr) +50
   Microsoft.CSharp.RuntimeBinder.Semantics.ExprVisitorBase.Visit(EXPR pExpr) +57
   Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.Rewrite(TypeManager typeManager, EXPR pExpr, IEnumerable`1 listOfParameters) +160
   Microsoft.CSharp.RuntimeBinder.RuntimeBinder.CreateExpressionTreeFromResult(IEnumerable`1 parameters, ArgumentObject[] arguments, Scope pScope, EXPR pResult) +127
   Microsoft.CSharp.RuntimeBinder.RuntimeBinder.BindCore(DynamicMetaObjectBinder payload, IEnumerable`1 parameters, DynamicMetaObject[] args, DynamicMetaObject& deferredBinding) +213
   Microsoft.CSharp.RuntimeBinder.RuntimeBinder.Bind(DynamicMetaObjectBinder payload, IEnumerable`1 parameters, DynamicMetaObject[] args, DynamicMetaObject& deferredBinding) +81
   Microsoft.CSharp.RuntimeBinder.BinderHelper.Bind(DynamicMetaObjectBinder action, RuntimeBinder binder, IEnumerable`1 args, IEnumerable`1 arginfos, DynamicMetaObject onBindingError) +764
   Microsoft.CSharp.RuntimeBinder.CSharpSetMemberBinder.FallbackSetMember(DynamicMetaObject target, DynamicMetaObject value, DynamicMetaObject errorSuggestion) +104
   ClaySharp.ClayMetaObject.BindSetMember(SetMemberBinder binder, DynamicMetaObject value) +63
   System.Dynamic.SetMemberBinder.Bind(DynamicMetaObject target, DynamicMetaObject[] args) +77
   System.Dynamic.DynamicMetaObjectBinder.Bind(Object[] args, ReadOnlyCollection`1 parameters, LabelTarget returnLabel) +233
   System.Runtime.CompilerServices.CallSiteBinder.BindCore(CallSite`1 site, Object[] args) +123
   System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +666
   Orchard.DisplayManagement.Implementation.DefaultShapeFactory.Create(String shapeType, INamedEnumerable`1 parameters, IEnumerable`1 behaviors) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\DisplayManagement\Implementation\DefaultShapeFactory.cs:94
   Orchard.DisplayManagement.Implementation.DefaultShapeFactory.Create(String shapeType, INamedEnumerable`1 parameters) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\DisplayManagement\Implementation\DefaultShapeFactory.cs:28
   Orchard.UI.Zones.LayoutWorkContext.Get(String name) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\UI\Zones\LayoutWorkContext.cs:15
   Orchard.Environment.<>c__DisplayClass7`1.<FindResolverForState>b__2(IWorkContextStateProvider wcsp) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\WorkContextImplementation.cs:32
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +85
   System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate) +99
   Orchard.Environment.WorkContextImplementation.FindResolverForState(String name) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\WorkContextImplementation.cs:32
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +72
   Orchard.Environment.WorkContextImplementation.GetState(String name) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\WorkContextImplementation.cs:27
   Orchard.WorkContext.get_Layout() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\WorkContext.cs:20
   Orchard.UI.Resources.ResourceFilter.OnResultExecuting(ResultExecutingContext filterContext) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\UI\Resources\ResourceFilter.cs:23
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +45
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
   System.Web.Mvc.Controller.ExecuteCore() +116
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Mvc\Routes\ShellRoute.cs:148
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8920029
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225

<!-- [InvalidProgramException]: Common Language Runtime detected an invalid program. at Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.GenerateProperty(EXPRCALL pExpr) at Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.GetExpression(EXPR pExpr) at Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.GenerateAssignment(EXPRCALL pExpr) at Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.VisitCALL(EXPRCALL pExpr) at Microsoft.CSharp.RuntimeBinder.Semantics.ExprVisitorBase.Dispatch(EXPR pExpr) at Microsoft.CSharp.RuntimeBinder.Semantics.ExprVisitorBase.Visit(EXPR pExpr) at Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.GenerateLambda(EXPRCALL pExpr) at Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.VisitCALL(EXPRCALL pExpr) at Microsoft.CSharp.RuntimeBinder.Semantics.ExprVisitorBase.Dispatch(EXPR pExpr) at Microsoft.CSharp.RuntimeBinder.Semantics.ExprVisitorBase.Visit(EXPR pExpr) at Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.Rewrite(TypeManager typeManager, EXPR pExpr, IEnumerable`1 listOfParameters) at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.CreateExpressionTreeFromResult(IEnumerable`1 parameters, ArgumentObject[] arguments, Scope pScope, EXPR pResult) at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.BindCore(DynamicMetaObjectBinder payload, IEnumerable`1 parameters, DynamicMetaObject[] args, DynamicMetaObject& deferredBinding) at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.Bind(DynamicMetaObjectBinder payload, IEnumerable`1 parameters, DynamicMetaObject[] args, DynamicMetaObject& deferredBinding) at Microsoft.CSharp.RuntimeBinder.BinderHelper.Bind(DynamicMetaObjectBinder action, RuntimeBinder binder, IEnumerable`1 args, IEnumerable`1 arginfos, DynamicMetaObject onBindingError) at Microsoft.CSharp.RuntimeBinder.CSharpSetMemberBinder.FallbackSetMember(DynamicMetaObject target, DynamicMetaObject value, DynamicMetaObject errorSuggestion) at ClaySharp.ClayMetaObject.BindSetMember(SetMemberBinder binder, DynamicMetaObject value) at System.Dynamic.SetMemberBinder.Bind(DynamicMetaObject target, DynamicMetaObject[] args) at System.Dynamic.DynamicMetaObjectBinder.Bind(Object[] args, ReadOnlyCollection`1 parameters, LabelTarget returnLabel) at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T](CallSite`1 site, Object[] args) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at Orchard.DisplayManagement.Implementation.DefaultShapeFactory.Create(String shapeType, INamedEnumerable`1 parameters, IEnumerable`1 behaviors) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\DisplayManagement\Implementation\DefaultShapeFactory.cs:line 94 at Orchard.DisplayManagement.Implementation.DefaultShapeFactory.Create(String shapeType, INamedEnumerable`1 parameters) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\DisplayManagement\Implementation\DefaultShapeFactory.cs:line 28 at Orchard.UI.Zones.LayoutWorkContext.Get[T](String name) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\UI\Zones\LayoutWorkContext.cs:line 15 at Orchard.Environment.WorkContextImplementation.<>c__DisplayClass7`1.<FindResolverForState>b__2(IWorkContextStateProvider wcsp) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\WorkContextImplementation.cs:line 32 at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) at Orchard.Environment.WorkContextImplementation.FindResolverForState[T](String name) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\WorkContextImplementation.cs:line 32 at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) at Orchard.Environment.WorkContextImplementation.GetState[T](String name) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\WorkContextImplementation.cs:line 27 at Orchard.WorkContext.get_Layout() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\WorkContext.cs:line 20 at Orchard.UI.Resources.ResourceFilter.OnResultExecuting(ResultExecutingContext filterContext) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\UI\Resources\ResourceFilter.cs:line 23 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) at System.Web.Mvc.Controller.ExecuteCore() at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5() at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0() at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d() at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) at Orchard.Mvc.Routes.ShellRoute.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Mvc\Routes\ShellRoute.cs:line 148 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) -->
Coordinator
Nov 16, 2011 at 11:05 PM

If you are using visual studio, you need the full source code, not the webpi version. The webpi version will not compile, nor does it need to be compiled.

Nov 17, 2011 at 6:31 AM

I used the full source code after downloading the source from the source archive .zip file and i still get the same issue 

Even i tried the previous version of orchard 1.2 but the same happens.

Coordinator
Nov 17, 2011 at 6:33 AM

Did you build src\orchard.sln?

Nov 17, 2011 at 8:40 AM

Yes, It stops in the function i specified.I think this is something regarding the .net framework

I am running it on top of windows 7 professional 32 bit and visual studio 2010 sp1 

Coordinator
Nov 17, 2011 at 5:37 PM

You might want to try aspnet_regiis -i, in case your ASP.NET is not installed right.

Nov 18, 2011 at 12:15 PM

I tried aspnet_regiis -i.still i get the same error System.InvalidProgramException

in this line :

 createdContext.Shape.Metadata = shapeMetadata;

of the function i specified

thank you 

Coordinator
Nov 18, 2011 at 7:41 PM

Something is wrong in your environment but I can't see what from what I nformation I have here, sorry. things to check: app pool under which the site runs is configured for .net 4.0 integrated pipeline, you have the full source code, you have built, you have pointed the site to src\orchard.web.

Nov 18, 2011 at 8:24 PM

Thanks,

I know it is in the environment but what,which i don't, All the things you mentioned are correct as you said but it still gives the same error

 

Coordinator
Nov 18, 2011 at 8:48 PM

Full trust?

Nov 21, 2011 at 6:15 PM

I tried to trace the problem but it is so difficult.I tried on different platform and everything work just fine.

I reapplied SP1,repaired .net framework 4,deleted IIS and reinsalled it but nothing changes.All other websites and applications work just fine too.

What the hack??

Coordinator
Nov 21, 2011 at 6:17 PM

What trust level is it running under?

Nov 21, 2011 at 6:34 PM

If by trust level you mean in the internet options under security tab in the internet zone it is Medium-high

if anything else please excuse my misunderstanding and tell me more

thank you

Coordinator
Nov 21, 2011 at 7:18 PM

No, I mean the trust level of the IIS application. It's in web.config. If it's not full trust, please try to change it.

Nov 21, 2011 at 7:32 PM

sorry may i know where the location of that web.config is

Coordinator
Nov 21, 2011 at 7:39 PM

src/orchard.web

Nov 21, 2011 at 7:46 PM

It was commented I uncommented it and change the level to Full.Sorry Nothing happened.