I had exactly the same issue with x64 OS and ODP.Net. (In my case it was XP 64) Occurence : running debug in x64 using VS 2008. I think Frans is right.
Selon Frans Bouma <[email protected]>: > > I am posting here an issue that i observed with NHibernate. Sorry to post > > here if this is already (if so please redirect me to the same). > > > > Details of my project: > > NHibernate version used - 1.2 > > Underlying database - Oracle 11g. > > .NET language - C#, .NET Framework - 3.5 > > > > Issue: > > > > Code: > > Attempted to read or write protected memory. This is often an indication > > that other memory is corrupt. > > Likely a problem with ODP.NET. I'm not sure which version of ODP.NET > you're using, but be sure you're using a recent build and also that you > install the proper version for your OS, so the 64bit version for your 64bit > OS or the 32bit version for the 32bit OS. > > ODP.NET is a .NET wrapper around a Java based client, and the > exception occurs inside the client, not the code calling it. > > FB > > > > > > The inner exception is: > > An exception of type 'NHibernate.ADOException' occurred in method 'DoList' > > of class 'Loader' > > > > The stack trace given is: > > at NHibernate.Loader.Loader.DoList(ISessionImplementor session, > > QueryParameters queryParameters) in C:\Documents and Settings\test > > \Desktop\NHibernate-1.2.1.GA-src\src\NHibernate\Loader\Loader.cs:line > > 1803 > > at > > NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor > > session, QueryParameters queryParameters) in C:\Documents and Settings > > \test\Desktop\NHibernate-1.2.1.GA-src\src\NHibernate\Loader > > \Loader.cs:line 1745 > > at NHibernate.Loader.Loader.List(ISessionImplementor session, > > QueryParameters queryParameters, ISet querySpaces, IType[] > > resultTypes) in C:\Documents and Settings\test\Desktop > \NHibernate-1.2.1.GA- > > src\src\NHibernate\Loader\Loader.cs:line 1733 > > at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria, IList > > results) in C:\Documents and Settings\test\Desktop\NHibernate-1.2.1.GA- > > src\src\NHibernate\Impl\SessionImpl.cs:line 4963 > > at NHibernate.Impl.SessionImpl.Find[T](CriteriaImpl criteria) in C: > > \Documents and Settings\test\Desktop\NHibernate-1.2.1.GA-src\src > > \NHibernate\Impl\SessionImpl.cs:line 4914 > > at NHibernate.Impl.CriteriaImpl.List[T]() in C:\Documents and > > Settings\test\Desktop\NHibernate-1.2.1.GA-src\src\NHibernate\Impl > > \CriteriaImpl.cs:line 323 > > > > The inner exception is: > > An exception of type 'System.AccessViolationException' occurred in method > > 'Read' of class 'OpsDac' > > > > The stack trace given is: > > 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 NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, > > QueryParameters queryParameters, Boolean returnProxies) in C: > > \Documents and Settings\test\Desktop\NHibernate-1.2.1.GA-src\src > > \NHibernate\Loader\Loader.cs:line 440 > > at > > > NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImpl > > ementor > > session, QueryParameters queryParameters, Boolean returnProxies) in C: > > \Documents and Settings\test\Desktop\NHibernate-1.2.1.GA-src\src > > \NHibernate\Loader\Loader.cs:line 181 > > at NHibernate.Loader.Loader.DoList(ISessionImplementor session, > > QueryParameters queryParameters) in C:\Documents and Settings\test > > \Desktop\NHibernate-1.2.1.GA-src\src\NHibernate\Loader\Loader.cs:line > > 1793 > > > > > > Code Accessing NHibernate: > > I save an object say 'OBJ1' in database using ADO.NET, and then i try to > > load it from NHibernate, but at this time i get the above reported > > exception. > > > > Below is the sample code. > > > > Code: > > public void Main() > > { > > //Placeholder for saving ID of new record that is saved through ADO. > > decimal static ADOSavedObjectID; > > > > ADONewTestRecord obj = new ADONewTestRecord(); > > > > //ADO.NET code to save this returns saved object db ID. > > ADOSavedObjectID = SaveThroughADO(obj); > > > > //Fetch the Saved record through NHibernate. > > TestNewRecordFromNHibernate = > > GetTestRecordThroughNHibernate(ADOSavedObjectID) > > > > public decimal SaveThroughADO(ADONewTestRecord obj) > > { > > //ADO code. > > } > > > > public TestNewRecordFromNHibernate > > GetTestRecordThroughNHibernate(decimal ADOSavedObjectID) > > { > > return LoadNHibernateObject(ADOSavedObjectID); > > } > > > > public TestNewRecordFromNHibernate LoadNHibernateObject(decimal > > ADOSavedObjectID) > > { > > //NHibernate session is already opened, i am not providing > details. > > Session.Clear(); > > IList<TestNewRecordFromNHibernate> results; > > ICriteria criteria = Session.CreateCriteria(typeof > > (TestNewRecordFromNHibernate)); > > criteria.Add(Expression.Eq("ID", ADOSavedObjectID)); > > //In this line i get the reported exception see above. > > results = criteria.List<TestNewRecordFromNHibernate>(); > > return results[0]; > > } > > } > > > > -- > > You received this message because you are subscribed to the Google Groups > > "nhusers" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > > http://groups.google.com/group/nhusers?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
