Results 1 to 3 of 3

Thread: How to import/use a DLL but not in debug mode?

  1. #1
    cjard's Avatar
    cjard is offline VB.NET Forum All-Mighty
    .NET Framework
    .NET 4.0
    Join Date
    Apr 2006
    Posts
    7,027
    Reputation
    1705

    How to import/use a DLL but not in debug mode?

    I'm facing an issue using the Transactions namespace with the System.Data.OracleClient

    Something on the system, I suspect an oracle DLL, does not like having a debugger attached to it; As soon as I attempt to run any database related statement within a transactionscope, while in debug mode (though not necessarily singlestepping), i receive an error message saying "Attempt to read or write protected memory"

    I'm presuming this is caused by the debugger attampting to attach to what oracle's driver dll code is doing. If i run the project in Release mode the code works perfectly. I havent had an answer from oracle, so i'm wondering if I can prevent the debugger from attaching to anything related to System.Data.OracleClient or any library within the transactions namespace?

  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    14,178
    Reputation
    2368
    You can only choose debug/release mode at application level for the process, the debugger attaches the process, not at the individual assemblies referenced by the application process. But you can choose different type exceptions to break on in the Debug Exceptions dialog. Which one to uncheck for this particular problem to not try to make a break should be CLR System.AccessViolationException but it doesn't mean the exception doesn't happen and is thrown, it just means that the debugger doesn't break into code on this exception.

  3. #3
    cjard's Avatar
    cjard is offline VB.NET Forum All-Mighty
    .NET Framework
    .NET 4.0
    Join Date
    Apr 2006
    Posts
    7,027
    Reputation
    1705
    Thing is - this is a progress-blocking exception; I cannot fix the cause of the exception because it occurs outside of code I wrote:


    Code:
    at System.Data.Common.UnsafeNativeMethods.OraMTSJoinTxn(OciEnlistContext pCtxt, IDtcTransaction pTrans)
    at System.Data.OracleClient.TracedNativeMethods.OraMTSJoinTxn(OciEnlistContext pCtxt, IDtcTransaction pTrans)
    at System.Data.OracleClient.OracleInternalConnection.Enlist(String userName, String password, String serverName, Transaction transaction, Boolean manualEnlistment)
    at System.Data.OracleClient.OracleInternalConnection.Activate(Transaction transaction)
    at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)
    at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
    at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
    at System.Data.OracleClient.OracleConnection.Open()
    at System.Data.Common.DbDataAdapter.UpdateConnectionOpen(IDbConnection connection, StatementType statementType, IDbConnection[] connections, ConnectionState[] connectionStates, Boolean useSelectConnectionState)
    at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
    at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
    at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
    at DDHub.HubDSTableAdapters.DDH_CLIENTSTableAdapter.Update(DDH_CLIENTSDataTable dataTable) in C:\Documents and Settings\matt.whittle\Desktop\Software Dev\Local\Visual Studio 2005\Projects\DDHub\DDHub\DDHub\HubDS.Designer.vb:line 9887
    at DDHub.frmClientDetail.DDH_CLIENTSBindingNavigatorSaveItem_Click(Object sender, EventArgs e) in C:\Documents and Settings\matt.whittle\Desktop\Software Dev\Local\Visual Studio 2005\Projects\DDHub\DDHub\DDHub\ModedForms\frmClientDetail.vb:line 275"

    As noted, the code works in release, but not in debug.. Is there an option other than declaring a variable in Settings called "DisableTransactions":

    If My.Settings.DisableTransactions Then
    'run update code
    Else
    'setup transaction
    'run updatecode
    'complete transaction
    EndIf

    seems a shame to have to implement that..

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking