System.AccessViolationException when profiling on x64

Here is the stack trace of the exception that is thrown when I try to profile my application.

It is easily reproducible. The problem occurs when I build my project for x32 and try to profile on a x64 bit platform with ANTS Profiler.

It does not have any problem running this application normally outside the profiler.

Here are the details of various version numbers:
ANTS Performance Profiler 5.2.0.26
MS Visual Studio 2008 Version 9.0.21022.8 RTM
MS .NET Framework Version 3.5 SP1
OS Name Microsoft(R) Windows(R) Server 2003 Standard x64 Edition
OS Version 5.2.3790 Service Pack 2 Build 3790
Exception caught: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at SNIOpenEx(SNI_CONSUMER_INFO* , UInt16* , SNI_Conn** , Int32 , UInt32 , Byte* , Byte* , Int32 , Int32 )
   at SNINativeMethodWrapper.SNIOpenEx(ConsumerInfo consumerInfo, String constring, IntPtr& pConn, Boolean fInitSec, Byte[] sspiBuffer, Byte[] instanceName, Boo
lean fOverrideCache, Boolean fSync)
   at System.Data.SqlClient.SNIHandle..ctor(ConsumerInfo myInfo, String serverName, Boolean integratedSecurity, Byte[] serverUserName, Boolean ignoreSniOpenTime
out, Int32 timeout, Byte[]& instanceName, Boolean flushCache, Boolean fSync)
   at System.Data.SqlClient.TdsParserStateObject.CreatePhysicalSNIHandle(String serverName, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Byte[]& instanceNam
e, Boolean integratedSecurity, Byte[] serverUserName, Boolean flushCache, Boolean async)
   at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Bool
ean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnectionowningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire,
 SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject
, SqlConnectionString connectionOptions, Int64 timerStart)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Bool
ean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String
 newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
 owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   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.SqlClient.SqlConnection.Open()
   at Toy1.Program.Main(String[] args) in E:\Arun\Toy1\Toy1\Toy1\Program.cs:line 21
   at SNIOpenEx(SNI_CONSUMER_INFO* , UInt16* , SNI_Conn** , Int32 , UInt32 , Byte* , Byte* , Int32 , Int32 )
   at SNINativeMethodWrapper.SNIOpenEx(ConsumerInfo consumerInfo, String constring, IntPtr& pConn, Boolean fInitSec, Byte[] sspiBuffer, Byte[] instanceName, Boo
lean fOverrideCache, Boolean fSync)
   at System.Data.SqlClient.SNIHandle..ctor(ConsumerInfo myInfo, String serverName, Boolean integratedSecurity, Byte[] serverUserName, Boolean ignoreSniOpenTime
out, Int32 timeout, Byte[]& instanceName, Boolean flushCache, Boolean fSync)
   at System.Data.SqlClient.TdsParserStateObject.CreatePhysicalSNIHandle(String serverName, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Byte[]& instanceNam
e, Boolean integratedSecurity, Byte[] serverUserName, Boolean flushCache, Boolean async)
   at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Bool
ean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire,
 SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject
, SqlConnectionString connectionOptions, Int64 timerStart)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Bool
ean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String
 newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
 owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   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.SqlClient.SqlConnection.Open()
   at Toy1.Program.Main(String[] args) in E:\Arun\Toy1\Toy1\Toy1\Program.cs:line 21
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Toy1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                string conn_str = "data source=MyOwnDS;initial catalog=TestDB;persist security info=False;user id=sa;password=secret007;packet size=4096;connect timeout=202";
                System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(conn_str);
                System.Data.SqlClient.SqlDataAdapter adapter = new System.Data.SqlClient.SqlDataAdapter(
                    @"SELECT * FROM tblTestTable1 
                  WHERE iSomeIntID in (560,504);",
                    conn);
                System.Data.DataTable table = new System.Data.DataTable();
                conn.Open();
                adapter.Fill(table);
                conn.Close();
                int N = table.Rows.Count;
                System.Console.WriteLine("Got " + N + " rows");

                foreach (System.Data.DataRow r in table.Rows)
                {
                    System.Console.WriteLine(r["strIP"]);
                }
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("Exception caught: " + e.ToString());
                System.Console.WriteLine(e.StackTrace);
            }
            System.Console.WriteLine("Press a key");
            string s = System.Console.ReadLine();

        }
    }
}

Running this program normally gives:
Got 2 rows
10.6.152.175
10.6.155.172
Press a key

Comments

Sign In or Register to comment.