This discussion is archived
0 Replies Latest reply: Nov 10, 2012 12:18 AM by 920337 RSS

Read record from parent table

920337 Newbie
Currently Being Moderated
Hello,

I have a table which is linked (using FK) with a number of other tables which are linked with other tables, etc. (like a tree). Using ADO.NET EF provider within ODAC 11.2.0.3 Release 5 I am trying to get a record from the root table. I coded a test using MSTest and when I do "myContext.MyTable.Where(...).FirstOrDefault();" VS2010 stops the debugging process after a while - no exception is caught in code but I get an error in Test results window: "The test adapter 'UnitTestAdapter' threw an exception while running test '<my test>'. Exception has been thrown by the target of an invocation.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

In the Debug window/view I get this:
A first chance exception of type 'System.AccessViolationException' occurred in Oracle.DataAccess.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll
Step into: Stepping over method without symbols 'Microsoft.VisualStudio.TestTools.Agent.AgentExecution.CallAdapterRunMethod'
W, 7380, 13, 2012/11/09, 23:33:29.803, QTAgent32.exe, AgentExecution: Exception while calling TestAdapter.Run: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Oracle.DataAccess.Client.OpsDac.Read(IntPtr opsConCtx, IntPtr opsErrCtx, IntPtr opsSqlCtx, IntPtr& opsDacCtx, OpoSqlValCtx* pOpoSqlValCtx, OpoMetValCtx* pOpoMetValCtx, OpoDacValCtx* pOpoDacValCtx)
at Oracle.DataAccess.Client.OracleDataReader.Read()
at System.Data.Common.Internal.Materialization.Shaper`1.StoreRead()
at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1[TResult](IEnumerable`1 sequence)
at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
at System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
at <my code stack>
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.DefaultTestMethodInvoke(Object[] args)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.DefaultTestMethodDecorator.Invoke(Object[] args)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunTestMethod()
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.ExecuteTest()
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.Execute(UnitTestResult result)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.ExecuteSingleTest(UnitTestExecuter executer, UnitTestElement test, ITestContext testContext, UnitTestAdapterContext userContext, Boolean isLoadTest)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.Run(UnitTestElement test, ITestContext testContext, Boolean isLoadTest, Boolean useMultipleCpus)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.Run(UnitTestElement test, ITestContext testContext, Boolean isLoadTest, Boolean useMultipleCpus)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter.Run(ITestElement testElement, ITestContext testContext, Boolean isLoadTest)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter.Run(ITestElement testElement, ITestContext testContext)
at Microsoft.VisualStudio.TestTools.Agent.AgentExecution.CallAdapterRunMethod(Object obj)
The thread 'Agent: adapter run thread for test '<my test>' with id '0779674e-2258-44d4-adfe-65302abbe50f'' (0x13e0) has exited with code 0 (0x0).
W, 7380, 30, 2012/11/09, 23:33:29.869, QTAgent32.exe, Performance warning: m_test should be null when TestResult is serialized. Please find the offending code and correct it.
E, 7380, 30, 2012/11/09, 23:33:29.879, QTAgent32.exe, AgentExecution: Received adapter message during test shutdown: run id {94200779-4759-4b4a-819c-61c55d39acbc}, test '<my test>' with id 0779674e-2258-44d4-adfe-65302abbe50f: MessageKind: Result, Outcome: Error
The thread 'ExecutionUtilities.InvokeWithTimeout helper thread 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter.AbortTestRun'' (0x1f98) has exited with code 0 (0x0).
The thread 'Agent: state execution thread for test '<my test>' with id '0779674e-2258-44d4-adfe-65302abbe50f'' (0x2688) has exited with code 0 (0x0).
The thread 'Agent: test queue thread' (0x1c58) has exited with code 0 (0x0).
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in Oracle.DataAccess.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
The thread '<No Name>' (0x24c0) has exited with code 0 (0x0).
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in System.Data.Entity.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
The thread '<No Name>' (0x2410) has exited with code 0 (0x0).
The thread '<No Name>' (0x2520) has exited with code 0 (0x0).
E, 7380, 6, 2012/11/09, 23:35:17.912, QTAgent32.exe, AgentObject: Cleanup: Timeout reached in cleaning up the agent.
E, 7380, 6, 2012/11/09, 23:35:22.918, QTAgent32.exe, AgentObject: Cleanup: Timeout reached in cleaning up the agent.
The program '[7380] QTAgent32.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).

Any idea is appreciated!

Thanks

Edited by: 917334 on Nov 10, 2012 12:17 AM
The equivalent where statement works well in classic ADO.NET.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points