locked
UnsafeNativeMethods.OCIServerAttach Receive an exception message System.AccessViolationException RRS feed

  • Question

  • The program receives an exception System.AccessViolationException,help

    Application: CenterInterfaceService.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.AccessViolationException
    Stack:
       at System.Data.Common.UnsafeNativeMethods.OCIServerAttach(System.Data.OracleClient.OciHandle, System.Data.OracleClient.OciHandle, Byte[], Int32, MODE)
       at System.Data.Common.UnsafeNativeMethods.OCIServerAttach(System.Data.OracleClient.OciHandle, System.Data.OracleClient.OciHandle, Byte[], Int32, MODE)
       at System.Data.OracleClient.TracedNativeMethods.OCIServerAttach(System.Data.OracleClient.OciHandle, System.Data.OracleClient.OciHandle, System.String, Int32, MODE)
       at System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(System.String, System.String, System.String, Boolean, Boolean, Boolean)
       at System.Data.OracleClient.OracleInternalConnection..ctor(System.Data.OracleClient.OracleConnectionString)
       at System.Data.OracleClient.OracleConnectionFactory.CreateConnection(System.Data.Common.DbConnectionOptions, System.Object, System.Data.ProviderBase.DbConnectionPool, System.Data.Common.DbConnection)
       at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionPoolGroup)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(System.Data.Common.DbConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory)
       at System.Data.OracleClient.OracleConnection.Open()
       at X.DAL.Provider.DAL.DataBaseInformation.ExecDbCommand(System.Data.IDbCommand)
       at X.DAL.Provider.DataAccess.Submit(X.DAL.Provider.Modle.Entity, System.String, System.Type)
       at DomainModel.Business.S.Temp.TempZwPoCustomerV.SaveTransData(X.DAL.Provider.DataAccess)
       at TaskManagement.ProcLoadManagement.ProcHelp(DomainModel.BasicData.FileMessage, System.Type, System.String[], Int32)
       at TaskManagement.ProcLoadManagement.ReadProcFile(DomainModel.BasicData.FileMessage)
       at TaskManagement.ProcLoadManagement.<LoadData>b__2(<>f__AnonymousType0`2<System.String,System.Collections.Generic.List`1<DomainModel.BasicData.FileMessage>>)
       at System.Threading.Tasks.Parallel+<>c__DisplayClass32`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<PartitionerForEachWorker>b__30()
       at System.Threading.Tasks.Task.InnerInvokeWithArg(System.Threading.Tasks.Task)
       at System.Threading.Tasks.Task+<>c__DisplayClass11.<ExecuteSelfReplicating>b__10(System.Object)
       at System.Threading.Tasks.Task.Execute()
       at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
       at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
       at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
       at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
       at System.Threading.ThreadPoolWorkQueue.Dispatch()

    Friday, June 23, 2017 1:56 AM

All replies

  • Did you try running the program with Run As Administrator?
    Friday, June 23, 2017 3:35 AM
  • Hi willyer111,

    An AccessViolationException exception can occur only in unsafe managed code or when verifiable managed code interacts with unmanaged code:

    • An access violation that occurs in unsafe managed code can be expressed as either a NullReferenceException exception or an AccessViolationException exception, depending on the platform.
    • An access violation in unmanaged code that bubbles up to managed code is always wrapped in an AccessViolationException exception.

    In either case, you can identify and correct the cause of the AccessViolationException exception as follows:

    • Make sure that the memory that you are attempting to access has been allocated.
    • Make sure that the memory that you are attempting to access has not been corrupted.

    For more details, please refer to the MSDN article.

    https://msdn.microsoft.com/en-us/library/system.accessviolationexception(v=vs.110).aspx

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, June 28, 2017 6:38 AM