Click here to Skip to main content
15,891,708 members
Home / Discussions / C#
   

C#

 
QuestionWhat Happens If I Don't Close A Text File Pin
BlitzPackage8-Apr-09 16:26
BlitzPackage8-Apr-09 16:26 
AnswerRe: What Happens If I Don't Close A Text File Pin
Luc Pattyn8-Apr-09 16:42
sitebuilderLuc Pattyn8-Apr-09 16:42 
GeneralRe: What Happens If I Don't Close A Text File Pin
BlitzPackage8-Apr-09 16:50
BlitzPackage8-Apr-09 16:50 
QuestionRead Photo Taken Date Pin
S K Y8-Apr-09 15:02
S K Y8-Apr-09 15:02 
AnswerRe: Read Photo Taken Date Pin
Luc Pattyn8-Apr-09 15:14
sitebuilderLuc Pattyn8-Apr-09 15:14 
General[Message Deleted] Pin
S K Y8-Apr-09 15:41
S K Y8-Apr-09 15:41 
GeneralRe: Read Photo Taken Date Pin
Luc Pattyn8-Apr-09 16:04
sitebuilderLuc Pattyn8-Apr-09 16:04 
QuestionSystem.Data.OracleClient - "System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt." [modified] Pin
devvvy8-Apr-09 14:58
devvvy8-Apr-09 14:58 
hello (First of all sorry about long stack trace)

I ran into this problem with System.Data.OracleClient - "System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

I checked the following, none resolved the problem:
(a) Make sure M$ DTC startup automatic
(b) C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN\sqlnet.ora
Change from:
SQLNET.AUTHENTICATION_SERVICES = (NTS)
To:
SQLNET.AUTHENTICATION_SERVICES= (NONE)

(c) Set OracleConnection.Unicode to true, i.e. add the following to connection string
Unicode=true;

(d) Be careful with LONG, LONG RAW, OBJECT, XMLTYPE - try comment out first if any.
REF: http://www.devart.com/forums/viewtopic.php?p=42223&sid=603c2d8bf01329ec2e98df036d5ef2da

I can't find anything "funny" with my Person's table.
<br />
					CREATE TABLE PERSON (<br />
						Id numeric(19,0) NOT NULL,<br />
						FirstName nvarchar2 (50) NOT NULL,<br />
						MiddleName nvarchar2 (50) NULL,<br />
						LastName nvarchar2 (50) NOT NULL,<br />
						PrimaryEmail nvarchar2 (190) NULL,<br />
						PersonType int default 1 NOT NULL, <br />
						CreateDate date default sysdate NULL,	<br />
						CreatedBy numeric(19,0) default -1 NULL,<br />
						LastUpdate date NULL,<br />
						LastUpdateBy numeric(19,0) NULL,<br />
						<br />
						CONSTRAINT PK_PERSON PRIMARY KEY (Id),<br />
						CONSTRAINT UK_PERSON_PRIMARYEMAIL UNIQUE (PrimaryEmail)<br />
					)<br />


And my NHibernate mapping file (Googled a bit don't think it is problem with NHibernate, also this Save works fine with MySQL and M$SQL, only Oracle making trouble):
<br />
class name="Person" table="Person"<br />
    id name="Id" column="Id" type="Int64" unsaved-value="0"<br />
        generator class="sequence"<br />
             param name="sequence" SYSTEMUSER_SEQ /param<br />
        /generator<br />
    /id<br />
    property name="PrimaryEmail" column="PrimaryEmail" type="String(255)"/<br />
    <br />
    property name="Type" column="PersonType" type="Int32"/<br />
    <br />
    component name="Name" class="xxxxx.Util.Name"<br />
        property name="FirstName" column="FirstName" type="String(50)" /<br />
        property name="MiddleName" column="MiddleName" type="String(50)" /<br />
        property name="LastName" column="LastName" type="String(50)" /<br />
    /component<br />
    component name="BasicAudit" class="xxxxx.Util.Security.BasicAudit"<br />
        property name="CreateDate" column="CreateDate" type="DateTime"/<br />
        property name="CreatedBy" column="CreatedBy" type="Int64"/<br />
        property name="LastUpdate" column="LastUpdate" type="DateTime"/<br />
        property name="LastUpdateBy" column="LastUpdateBy" type="Int64"/<br />
    /component<br />
    joined-subclass name="xxxxx.Util.Security.SystemUser" table="SystemUser"<br />
        key column="PersonId" /<br />
        property name="Logon" column="Logon" type="String(50)" /<br />
        property name="PasswdHash" column="PasswdHash" type="Int32"/<br />
    /joined-subclass<br />
/class<br />


And here's application code:
<br />
public virtual long Save(ref IGenericTO oPerson)<br />
		{<br />
			...<br />
<br />
			try<br />
			{<br />
				// Wrapped in transaction scope and if I comment out transactionScope application simply hangs on ISession.Save/INSERT below. This is with Oracle only. M$SQL and MySQL okay!<br />
				using (oScope = new TransactionScope())<br />
				{<br />
					DBSession.Flush();<br />
					// This is NHibernate ISession.Save - "System.AccessViolationException: exception here! (Works fine with M$SQL and MySQL)<br />
					nGeneratedId = (long)DBSession.Save(oPerson);<br />
					DBSession.Flush();<br />
					<br />
					... other database operation done in ADO.NET ...<br />
					<br />
					oScope.Complete();<br />
				}<br />
			}<br />
			catch (Exception ex)<br />
			{<br />
				....Util.ApplicationException.Throw("Save failed", null, oPerson.ToString(), ex);<br />
			}<br />
<br />
			return nGeneratedId;<br />
		}<br />


(e) M$ Hot fix - as suggested by http://forums.asp.net/p/675515/675515.aspx

I downloaded "303312_intl_i386_zip.exe " from following M$ URL.
Unfortunately on my XP box with:
* .NET 3.5 SP1
* Oracle 10g Express
* System.Data.OracleClient Runtime version v2.0.50727
I had the following error while trying to install the fix:
"The upgrade patch canno be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade patch may update a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade path."
The fix does indicate that it is intended for .NET 2.0 however:
"Article ID: 923028 - Last Review: March 25, 2009 - Revision: 4.0 FIX: Error message when you run a .NET Framework 2.0 Remoting application: "Unhandled Exception: System.AccessViolationException"
Download fix:
https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=6003&amp;wa=wsignin1.0

Any suggestion? Help!


REF:
http://forums.oracle.com/forums/thread.jspa?threadID=415053&amp;tstart=0
http://www.devart.com/forums/viewtopic.php?p=42223&amp;sid=603c2d8bf01329ec2e98df036d5ef2da
http://forums.asp.net/p/675515/675515.aspx

Sorry for long stack trace
<br />
2009-04-09 07:31:24,609 [10] ERROR SimpleConsoleTest - xxxxx.Util.ApplicationException Exception context: xxxxx.Util.ApplicationExceptionContext, Subject: Save failed, Description: xxxxx.Util.Person, Id:-1, Name:xxxxx.Util.Name, FirstName:John, MiddleName:, LastName:Kennedy, PrimaryEmail:john.kennedy@gmail.com, Type:undefined, GenericObj:object type: xxxxx.Util.Generic.GenericObject, object name: , object classifier: Person, TypeName: xxxxx.Util.Person, DAOTypeName: xxxxx.Util.PersonDAO, Util, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, DAOCreateInstanceArg: , CreateDate: 4/9/2009 7:31:19 AM, Properties: , Parents count:0, Children:, DatabaseInitiated: False, BasicAudit:xxxxx.Util.Security.BasicAudit, CreateDate:4/9/2009 7:31:19 AM, CreatedBy:-1, LastUpdate:1/1/1753 12:00:00 AM, LastUpdateBy:-1, StackTrace:    at xxxxx.Util.ApplicationException.Throw(String strSubject, String strSummary, String strDescription, Exception oInnerException) in C:\dev\xxxxx\NET3.0\Util\ApplicationException.cs:line 176<br />
			   at xxxxx.Util.PersonDAO.Save(IGenericTO&amp; oPerson) in C:\dev\xxxxx\NET3.0\Util\PersonDAO.cs:line 349<br />
			   at xxxxx.NUnitTest.TestDAOUtil.TestSaveAndSelectByKey(IGenericTO&amp; o) in C:\dev\xxxxx\NET3.0\NUnitTest\TestDAOUtil.cs:line 349<br />
			   at xxxxx.NUnitTest.TestDAOUtil.TestDAO(Boolean bTestDelete) in C:\dev\xxxxx\NET3.0\NUnitTest\TestDAOUtil.cs:line 278<br />
			   at SimpleConsoleTest.Program.TestPeronDAO() in C:\dev\xxxxx\NET3.0\SimpleConsoleTest\Program.cs:line 131<br />
			   at SimpleConsoleTest.Program.Main() in C:\dev\xxxxx\NET3.0\SimpleConsoleTest\Program.cs:line 45<br />
			   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)<br />
			   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)<br />
			   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()<br />
			   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br />
			   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br />
			   at System.Threading.ThreadHelper.ThreadStart()<br />
			 {Inner Exception: NHibernate.ADOException: cannot open connection ---&gt; System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.<br />
			   at System.Data.Common.UnsafeNativeMethods.OraMTSEnlCtxGet(Byte[] lpUname, Byte[] lpPsswd, Byte[] lpDbnam, OciHandle pOCISvc, OciHandle pOCIErr, UInt32 dwFlags, IntPtr&amp; pCtxt)<br />
			   at System.Data.OracleClient.TracedNativeMethods.OraMTSEnlCtxGet(Byte[] userName, Byte[] password, Byte[] serverName, OciHandle pOCISvc, OciHandle pOCIErr, IntPtr&amp; pCtxt)<br />
			   at System.Data.OracleClient.OciEnlistContext..ctor(Byte[] userName, Byte[] password, Byte[] serverName, OciServiceContextHandle serviceContextHandle, OciErrorHandle errorHandle)<br />
			   at System.Data.OracleClient.OracleInternalConnection.Enlist(String userName, String password, String serverName, Transaction transaction, Boolean manualEnlistment)<br />
			   at System.Data.OracleClient.OracleInternalConnection.Activate(Transaction transaction)<br />
			   at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)<br />
			   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)<br />
			   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)<br />
			   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)<br />
			   at System.Data.OracleClient.OracleConnection.Open()<br />
			   at NHibernate.Connection.DriverConnectionProvider.GetConnection()<br />
			   at NHibernate.Impl.SessionFactoryImpl.OpenConnection()<br />
			   --- End of inner exception stack trace ---<br />
			   at NHibernate.Impl.SessionFactoryImpl.OpenConnection()<br />
			   at NHibernate.AdoNet.ConnectionManager.GetConnection()<br />
			   at NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd)<br />
			   at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)<br />
			   at NHibernate.Id.SequenceGenerator.Generate(ISessionImplementor session, Object obj)<br />
			   at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)<br />
			   at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)<br />
			   at NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)<br />
			   at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event)<br />
			   at NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event)<br />
			   at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)<br />
			   at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event)<br />
			   at NHibernate.Impl.SessionImpl.Save(Object obj)<br />
			   <b>at xxxxx.Util.PersonDAO.Save(IGenericTO&amp; oPerson) in C:\dev\xxxxx\NET3.0\Util\PersonDAO.cs:line 332 {Inner Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.</b><br />
			   at System.Data.Common.UnsafeNativeMethods.OraMTSEnlCtxGet(Byte[] lpUname, Byte[] lpPsswd, Byte[] lpDbnam, OciHandle pOCISvc, OciHandle pOCIErr, UInt32 dwFlags, IntPtr&amp; pCtxt)<br />
			   at System.Data.OracleClient.TracedNativeMethods.OraMTSEnlCtxGet(Byte[] userName, Byte[] password, Byte[] serverName, OciHandle pOCISvc, OciHandle pOCIErr, IntPtr&amp; pCtxt)<br />
			   at System.Data.OracleClient.OciEnlistContext..ctor(Byte[] userName, Byte[] password, Byte[] serverName, OciServiceContextHandle serviceContextHandle, OciErrorHandle errorHandle)<br />
			   at System.Data.OracleClient.OracleInternalConnection.Enlist(String userName, String password, String serverName, Transaction transaction, Boolean manualEnlistment)<br />
			   at System.Data.OracleClient.OracleInternalConnection.Activate(Transaction transaction)<br />
			   at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)<br />
			   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)<br />
			   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)<br />
			   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)<br />
			   at System.Data.OracleClient.OracleConnection.Open()<br />
			   at NHibernate.Connection.DriverConnectionProvider.GetConnection()<br />
			   at NHibernate.Impl.SessionFactoryImpl.OpenConnection()<br />


dev

QuestionLarge memory usage. Pin
Jacob Dixon8-Apr-09 14:55
Jacob Dixon8-Apr-09 14:55 
AnswerRe: Large memory usage. Pin
Jacob Dixon8-Apr-09 15:00
Jacob Dixon8-Apr-09 15:00 
AnswerRe: Large memory usage. Pin
Luc Pattyn8-Apr-09 15:04
sitebuilderLuc Pattyn8-Apr-09 15:04 
GeneralRe: Large memory usage. Pin
Jacob Dixon8-Apr-09 15:10
Jacob Dixon8-Apr-09 15:10 
GeneralRe: Large memory usage. Pin
Luc Pattyn8-Apr-09 15:15
sitebuilderLuc Pattyn8-Apr-09 15:15 
GeneralRe: Large memory usage. Pin
Jacob Dixon8-Apr-09 16:52
Jacob Dixon8-Apr-09 16:52 
GeneralRe: Large memory usage. Pin
Luc Pattyn8-Apr-09 17:17
sitebuilderLuc Pattyn8-Apr-09 17:17 
GeneralRe: Large memory usage. Pin
harold aptroot8-Apr-09 15:35
harold aptroot8-Apr-09 15:35 
GeneralRe: Large memory usage. Pin
Luc Pattyn8-Apr-09 15:58
sitebuilderLuc Pattyn8-Apr-09 15:58 
GeneralRe: Large memory usage. Pin
harold aptroot8-Apr-09 16:37
harold aptroot8-Apr-09 16:37 
GeneralRe: Large memory usage. Pin
Luc Pattyn8-Apr-09 17:05
sitebuilderLuc Pattyn8-Apr-09 17:05 
GeneralRe: Large memory usage. Pin
Dave Kreskowiak8-Apr-09 17:47
mveDave Kreskowiak8-Apr-09 17:47 
GeneralRe: Large memory usage. Pin
harold aptroot9-Apr-09 4:59
harold aptroot9-Apr-09 4:59 
GeneralRe: Large memory usage. Pin
Dave Kreskowiak9-Apr-09 13:16
mveDave Kreskowiak9-Apr-09 13:16 
GeneralRe: Large memory usage. Pin
harold aptroot9-Apr-09 13:38
harold aptroot9-Apr-09 13:38 
GeneralRe: Large memory usage. Pin
S. Senthil Kumar8-Apr-09 23:03
S. Senthil Kumar8-Apr-09 23:03 
GeneralRe: Large memory usage. Pin
harold aptroot9-Apr-09 5:00
harold aptroot9-Apr-09 5:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.