We've used WPF Tookit DataGrid and .NET 3.5 for about 2 years. And we've got two cases which throw exception - "Recursive call to Automation Peer API is not valid". It's quit strange and eratic, very few PCs has such issue.
Case One:
A dropdown combox (WPF Tookit DataGrid as DropDown content control):
And it can be resolved by:
protected override AutomationPeer OnCreateAutomationPeer()
{
return null;
}
This solution is from WPF Recursive call to Automation Peer API is not valid.
Case Two:
A WPF Tookit DataGrid has a Temlate Column , which the cell template has a dropdown combox (WPF Tookit DataGrid as DropDown content control). It can not be fixed by the solution above.
*Exception Stack:
Exception object: 0ac4e048
Exception type: System.InvalidOperationException
Message: Recursive call to Automation Peer API is not valid.
InnerException: <none>
StackTrace (generated):
SP IP Function
0036E3A4 61A0CEFE PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.GetChildren()+0x366bde
0036E3D4 616A5C34 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x18
0036E3EC 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E404 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E41C 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E434 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E44C 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E464 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E47C 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E494 616A5E52 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.ValidateConnected(System.Windows.Automation.Peers.AutomationPeer)+0xaa
0036E4A8 616A444E PresentationCore_ni!MS.Internal.Automation.ElementProxy.StaticWrap(System.Windows.Automation.Peers.AutomationPeer, System.Windows.Automation.Peers.AutomationPeer)+0x1a
0036E4C0 616A7C69 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.UpdateChildrenInternal(Int32)+0x341
0036E52C 616A791A PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.UpdateChildren()+0xa
0036E530 11EDC66E UNKNOWN!Microsoft.Windows.Automation.Peers.DataGridItemAutomationPeer.GetChildrenCore()+0x1e
0036E540 616A662B PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.EnsureChildren()+0x23
0036E558 616A634C PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.GetChildren()+0x2c
0036E588 616A5C34 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x18
0036E5A0 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E5B8 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E5D0 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E5E8 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E600 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E618 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E630 616A5C73 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.isDescendantOf(System.Windows.Automation.Peers.AutomationPeer)+0x57
0036E648 616A5E52 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.ValidateConnected(System.Windows.Automation.Peers.AutomationPeer)+0xaa
0036E65C 616A444E PresentationCore_ni!MS.Internal.Automation.ElementProxy.StaticWrap(System.Windows.Automation.Peers.AutomationPeer, System.Windows.Automation.Peers.AutomationPeer)+0x1a
0036E674 616A6F3E PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.ProviderFromPeer(System.Windows.Automation.Peers.AutomationPeer)+0x1e
0036E680 619DBBD1 PresentationCore_ni!System.Windows.Automation.Peers.AutomationPeer.RaiseAutomationEvent(System.Windows.Automation.Peers.AutomationEvents)+0x7ab6d5
0036E690 609783AA PresentationFramework_ni!System.Windows.Automation.Peers.SelectorAutomationPeer.RaiseSelectionEvents(System.Windows.Controls.SelectionChangedEventArgs)+0x22
0036E6B0 60C48560 PresentationFramework_ni!System.Windows.Controls.ComboBox.OnSelectionChanged(System.Windows.Controls.SelectionChangedEventArgs)+0xbef278
0036E6C4 124C17E7 UNKNOWN!UNKNOWN+0x17
0036E6EC 60061113 PresentationFramework_ni!System.Windows.Controls.Primitives.Selector.InvokeSelectionChanged(System.Collections.Generic.List`1<System.Object>, System.Collections.Generic.List`1<System.Object>)+0x4f
0036E704 6005FE17 PresentationFramework_ni!System.Windows.Controls.Primitives.Selector+SelectionChanger.End()+0xdf
0036E738 6005E325 PresentationFramework_ni!System.Windows.Controls.Primitives.Selector+SelectionChanger.SelectJustThisItem(System.Object, Boolean)+0x11d
0036E76C 60060D02 PresentationFramework_ni!System.Windows.Controls.Primitives.Selector.OnSelectedItemChanged(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)+0xb2
0036E798 627585EC WindowsBase_ni!Unknown+0x4c
0036E7C4 60073E40 PresentationFramework_ni!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)+0x50
0036E8F4 627583BC WindowsBase_ni!Unknown+0x3c
0036E94C 6275676B WindowsBase_ni!Unknown+0x71b
0036EA0C 627594CD WindowsBase_ni!Unknown+0xad
0036EA34 600AD85A PresentationFramework_ni!System.Windows.Data.BindingExpressionBase.Invalidate(Boolean)+0x62
0036EA4C 600AD31D PresentationFramework_ni!System.Windows.Data.BindingExpression.TransferValue(System.Object, Boolean)+0x1fd
0036EAA0 600AA9D8 PresentationFramework_ni!System.Windows.Data.BindingExpression.Activate(System.Object)+0x194
0036EACC 60097C49 PresentationFramework_ni!System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt)+0x38d
0036EB74 600C3D51 PresentationFramework_ni!System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean)+0x19
0036EB80 600C3D19 PresentationFramework_ni!MS.Internal.Data.DataBindEngine+Task.Run(Boolean)+0x31
0036EB94 600C3C36 PresentationFramework_ni!MS.Internal.Data.DataBindEngine.Run(System.Object)+0xb6
0036EBB0 600C2CBA PresentationFramework_ni!MS.Internal.Data.DataBindEngine.OnLayoutUpdated(System.Object, System.EventArgs)+0x1e
0036EBC0 61271CD8 PresentationCore_ni!System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()+0x154
0036EBF8 6127159E PresentationCore_ni!System.Windows.ContextLayoutManager.UpdateLayout()+0x926
0036ECF8 61277F4D PresentationCore_ni!System.Windows.ContextLayoutManager.UpdateLayoutCallback(System.Object)+0x19
0036ECFC 61277F28 PresentationCore_ni!System.Windows.Media.MediaContext+InvokeOnRenderCallback.DoWork()+0x10
0036ED00 61277EC2 PresentationCore_ni!System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()+0x76
0036ED1C 6127785A PresentationCore_ni!System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object)+0x8a
0036ED68 612777AA PresentationCore_ni!System.Windows.Media.MediaContext.RenderMessageHandler(System.Object)+0x6e
0036ED80 6274FE83 WindowsBase_ni!Unknown+0x53
0036EDA0 6274FE0C WindowsBase_ni!Unknown+0x9c
0036EDE8 62752C95 WindowsBase_ni!Unknown+0x8d
0036EE24 62752BF8 WindowsBase_ni!Unknown+0x38
0036EE2C 642F4D85 mscorlib_ni!System.Threading.ExecutionContext.runTryCode(System.Object)+0x51
0036F2D0 642F4C8A mscorlib_ni!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+0x6a
0036F2E8 642F7F92 mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+0x7e
0036F30C 642F7F04 mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+0x2c
0036F328 62752B28 WindowsBase_ni!Unknown+0x68
0036F364 6274E7FE WindowsBase_ni!Unknown+0x15e
0036F3A8 6274E9D7 WindowsBase_ni!Unknown+0x63
0036F3F8 627500A6 WindowsBase_ni!Unknown+0xbe
0036F444 6274FFD5 WindowsBase_ni!Unknown+0x7d
0036F454 6274FE83 WindowsBase_ni!Unknown+0x53
0036F474 6274FDB2 WindowsBase_ni!Unknown+0x42
0036F4BC 6274E2CC WindowsBase_ni!Unknown+0xb4
0036F504 6274F8B8 WindowsBase_ni!Unknown+0x104*
Many threads just has a walkaround solution about the issue, Does any one know have any idea about the Root Cause of Recursive call to Automation Peer API is not valid?
I realise this is an old thread but i just had the exact same issue after reloading a project i completed some months back.
The only real change of significance was that i had installed RoboForm to trial and it had expired.
I could re-create very easily and consistently, Uninstalled it and problem is now gone.
Related
I'm working on an ASP.NET MVC 5 app. I created a class in my Models folder for a table and then created a controller using the class as a model. What I didn't think of when I did this, was the fact that the table I'm modeling is in a database schema other than dbo. I was only after getting my website up to the point where I could go to the Index method and finding that it didn't render any data from the table, that I realized my mistake. So I went into the class I created in Models and added the following attribute to the table:
[Table("Interview", Schema = "Prism")]
Next I compiled it and VS was happy as a clam. So I ran it, navigated to the controller's Index and then everything went belly up. VS gave me this error message:
System.InvalidOperationException was unhandled by user code
HResult=-2146233079
Message=The model backing the 'PrismDeleteInterviewDB' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).
Source=EntityFramework
StackTrace:
at System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context)
at System.Data.Entity.Internal.InternalContext.<>c__DisplayClassf`1.<CreateInitializationAction>b__e()
at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)
at System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
at System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c)
at System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action)
at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator()
at System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at PrismDeleteInterview.Controllers.InterviewsController.Index() in D:\Websites\PrismDeleteInterview\PrismDeleteInterview\Controllers\InterviewsController.cs:line 20
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
InnerException:
My overriding concern is that the last thing I want EF to do is wipe out the database. The phrase, "Consider using Code First Migrations to update the database..." is what concerns me. Updating a database to me means it's changing the database in some way, possibly dropping tables, etc. This database isn't just a temporary thing that I'm working on, alone from the rest of my co-workers. It exists and has real data in it. So, will this wipe out my database or not?
I am receiving an error when trying to render the elmah error logs and using SQL DB. "http://localhost:5525/elmah" [ArgumentNullException: Value cannot be null.
Parameter name: id]
Elmah.ErrorLogEntry..ctor(ErrorLog log, String id, Error error) in c:\builds\ELMAH-1.2-SP2\src\Elmah\ErrorLogEntry.cs:57
Elmah.SqlErrorLog.ErrorsXmlToList(XmlReader reader, IList errorEntryList) in c:\builds\ELMAH-1.2-SP2\src\Elmah\SqlErrorLog.cs:365
Elmah.SqlErrorLog.ErrorsXmlToList(String xml, IList errorEntryList) in c:\builds\ELMAH-1.2-SP2\src\Elmah\SqlErrorLog.cs:332
Elmah.SqlErrorLog.GetErrors(Int32 pageIndex, Int32 pageSize, IList errorEntryList) in c:\builds\ELMAH-1.2-SP2\src\Elmah\SqlErrorLog.cs:186
Elmah.ErrorLogPage.OnLoad(EventArgs e) in c:\builds\ELMAH-1.2-SP2\src\Elmah\ErrorLogPage.cs:76
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
I have the latest Core Elmah 1.2-SP2 and the latest Elmah.MVC 2.1.2. I installed the Nuget package Elmah.MVC with default web.config settings.
When I configure web.config to log errors to the database the errors are recorded in the database but I can't render the error page. When I don't configure the database the elmah page renders just fine.
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Company" />
</elmah>
Decompiling Elmah I see in the constructor where the argument is thrown.
if (id == null)
throw new ArgumentNullException("id");
if (id.Length == 0)
throw new ArgumentException((string) null, "id");
All my ErrorId's in the database are populated GUIDs.
I am stumped as to what id is not being passed to the core elmah. Has anyone ran into this before?
I downloaded the core Elmah code and stepped through to find in SqlErrorLog.cs, method ErrorsXmlToList(XmlReader reader, IList errorEntryList) there is a call to get id which was the parameter missing: string id = reader.GetAttribute("errorId"); I lower cased "errorid" and everything worked. Obviously this is not a good solution because this is core code that everyone works with so I dug deeper.
This led me to look at stored procedure ELMAH_GetErrorsXml. I found in our database we had a lower case "errorid". I updated the stored procedure to select "errorId" and changed the core Elmah back to the original code and of course everything worked.
I've a rather pressing matter that I'd appreciate any input.
I've a DomainService which is defined thus, and everything works fine (on Development machine and Server).
Public Function GetPrices() As IQueryable(Of Price)
Public Sub InsertPrice(ByVal Price As Price)
Public Sub UpdatePrice(ByVal currentPrice As Price)
But when I add the following method, I get the following error on the server (which doesn't occur on the development machine)
<Invoke(HasSideEffects:=True)>
Public Sub SetSitePrices(ByVal SiteIds As IEnumerable(Of Short), p As Price)
Operation named 'SetSitePrices' does not conform to the required signature. Parameter types must be an entity type or one of the predefined serializable types.
[InvalidOperationException: Operation named 'SetSitePrices' does not conform to the required signature. Parameter types must be an entity type or one of the predefined serializable types.]
System.ServiceModel.DomainServices.Server.DomainServiceDescription.ValidateMethodSignature(DomainOperationEntry method) +221051
System.ServiceModel.DomainServices.Server.DomainServiceDescription.AddInvokeOperation(DomainOperationEntry method) +21
System.ServiceModel.DomainServices.Server.DomainServiceDescription.Initialize() +312
System.ServiceModel.DomainServices.Server.DomainServiceDescription.CreateDescription(Type domainServiceType) +216
System.ServiceModel.DomainServices.Server.<>c__DisplayClass8.<GetDescription>b__7(Type type) +9
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +72
System.ServiceModel.DomainServices.Server.DomainServiceDescription.GetDescription(Type domainServiceType) +196
System.ServiceModel.DomainServices.Hosting.DomainServiceHost..ctor(Type domainServiceType, Uri[] baseAddresses) +250
System.ServiceModel.DomainServices.Hosting.DomainServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +29
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +422
System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1461
System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +44
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +651
[ServiceActivationException: The service '/Services/Cosmo-Web-SamDomainService.svc' cannot be activated due to an exception during compilation. The exception message is: Operation named 'SetSitePrices' does not conform to the required signature. Parameter types must be an entity type or one of the predefined serializable types..]
System.Runtime.AsyncResult.End(IAsyncResult result) +688590
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +190
System.ServiceModel.Activation.ServiceHttpHandler.EndProcessRequest(IAsyncResult result) +6
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +96
Is it possible that the server has different WCF DLLs?
The cause of the error is due to an old version of RIA Services installed in the GAC. The latest RIA Services Service Pack uses the same version number, and this caused the version in the GAC to load in preference to the newer version in the bin directory.
The solution is to uninstall RIA Services from the server and that will allow the local \BIN version to load.
In which situation following error occurs?
Unable to cast object of type 'MyType' to type 'Castle.Proxies.MyType'.
UPDATE:
I got this error message while binding MyType.FindAllByProperty("col1", "foo"); to a GridView (exactly a Telerik's one: RadGrid). This error is not occuring every time, just sometimes. Here is markup of my grid:
<telerik:RadGrid ID="grdList" runat="server" AutoGenerateColumns="false" OnNeedDataSource="grdList_NeedDataSource"
OnUpdateCommand="grdList_UpdateCommand" AllowAutomaticUpdates="True" OnItemUpdated="grdList_ItemUpdated"
AllowMultiRowEdit="true">
<MasterTableView EditMode="InPlace" DataKeyNames="PageInRole_id" AllowAutomaticUpdates="true">
<Columns>
<telerik:GridBoundColumn DataField="ContainerPage.PageTitle" HeaderText="Title" UniqueName="ContainerPage.PageTitle"
ReadOnly="true" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
UPDATE2
Here is all exception message and stack trace:
Unable to cast object of type 'PineCMS.Core.PageInRole' to type 'Castle.Proxies.PageInRoleProxy'.
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.InvalidCastException: Unable to cast object of type 'PineCMS.Core.PageInRole' to type 'Castle.Proxies.PageInRoleProxy'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Unable to cast object of type 'PineCMS.Core.PageInRole' to type 'Castle.Proxies.PageInRoleProxy'.]
Telerik.Web.UI.GetEnumerator>d__0.MoveNext() +175
Telerik.Web.UI.GridDataTableFromEnumerable.FillDataTableFromEnumerable(IQueryable enumerable) +1285
Telerik.Web.UI.GridDataTableFromEnumerable.FillData35() +3390
Telerik.Web.UI.GridDataTableFromEnumerable.FillData() +824
Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +28
Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, IEnumerable enumerable, Boolean CaseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +242
Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +223
Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +595
Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +243
Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +42
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +72
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +147
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +261
Telerik.Web.UI.GridTableView.PerformSelect() +23
Telerik.Web.UI.GridTableView.DataBind() +363
Telerik.Web.UI.GridTableView.Rebind() +101
Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source) +1174
Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +185
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70
Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +142
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927
This exception probably comes from the code trying to re-attach a proxied/lazy-loading entity to a session. The most likely API call to throw this exception with a newer NHibernate (I don't have problem with 2.1 but I do have problems with latest) is Session.Lock(obj, LockMode.None).
If the programmer of this component first evicts the entity from the ISession and then re-loads it (perhaps cached?) into another one by id, or performs ISession.Update this problem should go away until the NHibernate team has figured out the underlying problem.
I had a similar problem with EntityFramework 6.0.
I had migrated from an old version of EntityFramework that did not use proxies and had some code that created and attached new instances of the entity via new MyEntity();.
My solution was to use dbContext.MyEntity.Create(); instead so I only work with proxies. Something similar should be available for NHibernate if I recall correctly.
My error was:
Unable to cast object of type 'MyProject.MyEntity' to type
'System.Data.Entity.DynamicProxies.MyEntity_849E94C98E5E543D6DF5245252144E3EAC00131F811886276B6ABD991719D232'
We ran into the same issue with RadGrid having AutomaticInserts. After inserting an item it throw InvalidCastException: Unable to cast object of type 'MyDbModel.Role' to type 'System.Data.Entity.DynamicProxies.Role_...' in DataBind() at Rebind().
The issue was gone after I adapted the DataBinding to have an OrderBy().
We're developing an EPiServer-based website and trying to deploy our latest build onto a WinXP IIS6 box.
When browsing to site, we're getting the following stack trace
[ClassFactoryException: ClassFactory not initialized]
EPiServer.BaseLibrary.ClassFactory.get_Instance() +123
EPiServer.BaseLibrary.Context.get_Repository() +14
EPiServer.WorkflowFoundation.StorageProviders.ObjectStoreStorageProvider.VerifyCommonSchemas() +15
EPiServer.WorkflowFoundation.AspNetWorkflowManager.get_StorageProvider() +44
EPiServer.WorkflowFoundation.AspNetWorkflowManager.Initialize(Boolean lazyLoading) +589
EPiServer.WorkflowFoundation.AspNetWorkflowManager.get_InstanceHandler() +16
EPiServer.WorkflowFoundation.Workflows.ApprovalService..ctor() +93
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +261
System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
EPiServer.WorkflowFoundation.WorkflowSystem.RegisterServices(IWorkflowManager manager, WorkflowSettingsElement configuration) +338
EPiServer.WorkflowFoundation.WorkflowSystem.Init(HttpApplication context) +240
System.Web.HttpApplication.InitModules() +267
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +1251
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +243
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +106
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +214
I've googled it, and visited the EPiServer forums, but I've not found any concrete suggestions or solutions. Has anyone else out there run into this?
Ross
The configuration file is written for IIS7 but you build in webserver in Studio want a IIS6 sonfig file.
I have wrote abut this in ny EPiServer notes
http://epiwiki.se/troubleshooting/classfactory-not-initialized
I am going out on a limb and guessing here, but did you by chance do development on EPiServer 5 SP 2 and deploy on EPiServer 5 SP 3?
In EPiServer 5 SP3 there was some remodelling in how a EPiServer handles the initialization of the application. These changes made it so that it's not possible to hook into the datafactory events in Application_Start. Instead you need to first hook into Application_FirstBeginRequest and then we have a instance of the DataFactory to work with.
Suggested reading
Definitely sounds like a configuration error. As Mattias said, the default web.config is for IIS7. This can cause problems when running IIS6 or Cassini.