Print Page | Close Window

Entity Server Exception was Unhandled

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=728
Printed Date: 28-Apr-2024 at 6:47am


Topic: Entity Server Exception was Unhandled
Posted By: rclarke
Subject: Entity Server Exception was Unhandled
Date Posted: 14-Mar-2008 at 12:05pm
I tried to add a form to my project with buttons to execute various queries and write the query results to the console. I noticed that none of the tutorials use forms as yet so I may be venturing into unimlemented territory but nothing ventured, nothing gained. The form code is as follows:
 
Public Class Form1
   Private Shared aManager As DomainModel.Manager = New DomainModel.Manager()
   Public Sub New()
      ' This call is required by the Windows Form Designer.
      InitializeComponent()
      ' Add any initialization after the InitializeComponent() call.
   End Sub
   Private Sub Query01()
      Dim query = aManager.Customers
      For Each aCustomer As DomainModel.Customer In query
         Console.WriteLine(aCustomer.CompanyName)
      Next aCustomer
      'Console.WriteLine()
      ' Console.WriteLine("Press ENTER to close window.")
      'Console.ReadLine()
   End Sub
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      Query01()
   End Sub
End Class
When I run tha app and click on Button1 I get Server Exception was Unhandled when the For Each statement is executed. The details of the exception is as follows:
 
 
 
IdeaBlade.EntityModel.v4.EntityServerException was unhandled
  Cancelled=False
  Message="Value cannot be null. Parameter name: key"
  Source="IdeaBlade.EntityModel.v4"
  StackTrace:
       at IdeaBlade.EntityModel.v4.EntityManager.HandleEntityServerException(Exception pException, Boolean pTryToHandle, PersistenceOperation pOperation)    at IdeaBlade.EntityModel.v4.EntityManager.ExecuteServerQuery(IEntityQuery pEntityQuery)    at IdeaBlade.EntityModel.v4.EntityManager.ExecuteFetch(IEntityFinder finder)    at IdeaBlade.EntityModel.v4.EntityQueryFinder.Execute()    at IdeaBlade.EntityModel.v4.EntityManager.ExecuteQueryCore(IEntityQuery query, QueryStrategy strategy)    at IdeaBlade.EntityModel.v4.EntityManager.ExecuteQuery[T](IEntityQuery query, QueryStrategy strategy, Boolean checkT)    at IdeaBlade.EntityModel.v4.EntityManager.ExecuteQuery[T](IEntityQuery`1 query)    at IdeaBlade.EntityModel.v4.EntityQuery`1.GetEnumerator()    at DevForceEFTest2.Form1.Query01() in C:\Documents and Settings\Ron\My Documents\Visual Studio 2008\Projects\DevForceTest2\DevForceEFTest2\Form1.vb:line 16    at DevForceEFTest2.Form1.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\Ron\My Documents\Visual Studio 2008\Projects\DevForceTest2\DevForceEFTest2\Form1.vb:line 25    at System.Windows.Forms.Control.OnClick(EventArgs e)    at System.Windows.Forms.Button.OnClick(EventArgs e)    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)    at System.Windows.Forms.Control.WndProc(Message& m)    at System.Windows.Forms.ButtonBase.WndProc(Message& m)    at System.Windows.Forms.Button.WndProc(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)    at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)    at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)    at System.Windows.Forms.Application.Run(ApplicationContext context)    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)    at DevForceEFTest2.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81    at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)    at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.ArgumentNullException
       Message="Value cannot be null. Parameter name: key"
       ParamName="key"
       Source="IdeaBlade.EntityModel.v4"
       StackTrace:
            at IdeaBlade.EntityModel.v4.EntityServerProxy.CheckConnection(Exception pException)    at IdeaBlade.EntityModel.v4.EntityServerProxy.Fetch(SessionBundle pBundle, IEntityQuery pQuery)    at IdeaBlade.EntityModel.v4.EntityManager.ExecuteServerQuery(IEntityQuery pEntityQuery)
       InnerException:



Replies:
Posted By: rclarke
Date Posted: 14-Mar-2008 at 12:18pm
Update
 
Ok, so I created a console application in the same solution and tried to execute the code there and I get the same exception. So now I'm stuck. Could this possibly be related to the fact that I'm generating VB? I noticed that all of the tutorials are C#.


Posted By: kimj
Date Posted: 17-Mar-2008 at 5:43pm
Ron,
 
Thanks for reporting this, and for your patience.
 
The problem is somewhat related to our improper handling of namespaces in VB, and also to our current expectation that the type names used in the model (the c-space) correspond to the type names in the generated code in the EF assembly (the o-space).  If you clear out the Root namespace in your EF project and then re-build, this should work.
 
We're already fixing the namespace problem.  I'll open two additional problem reports:  one to address the c-space / o-space name restriction, and another to provide better error messages for these kinds of failures (since this particular error message is quite confusing and misleading).
 
 


Posted By: rclarke
Date Posted: 18-Mar-2008 at 6:16am
I though that I had cleared the root namespace prior to ecountering the problem but I just checked and it was clear. I did a rebuild and the exception still occurs. Looks like I'll have to wait on the next Devforce EF rev to continue.


Posted By: kimj
Date Posted: 18-Mar-2008 at 8:31am
Hmmm.  What are the full type names (including namespace) for one object in both the CSDL and the EF generated code?  If you can synch them up without too much difficulty you should be able to get past the problem. 


Posted By: rclarke
Date Posted: 19-Mar-2008 at 7:06am
I've been all over tha map on this namespace thing and I get the same error. I even started from scratch again. I will wait for the next rev which will hopefully be sooooon ;-)?


Posted By: kimj
Date Posted: 19-Mar-2008 at 9:35am
Beta2 is planned for approx. 6 weeks from the Beta1 release date.
 
If you'd like, you can zip up your solution and email it to support, attn: Kim, and I'll take a look.



Print Page | Close Window