none
How do I debug an exception that is thrown in System.Data.Dll? RRS feed

  • Question

  • I am working with SqlDependency in .NET 2.0 and running a simple app that just calls start and stop on the dependency object.  The result is 3 exceptions in System.Data.Dll

     

    A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll

    Additional information: A severe error occurred on the current command. The results, if any, should be discarded.

    Operation cancelled by user.

     

    A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll

    Additional information: A severe error occurred on the current command. The results, if any, should be discarded.'

    Operation cancelled by user.

     

    A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll

    Additional information: A severe error occurred on the current command. The results, if any, should be discarded.

    Operation cancelled by user.

     

    To duplicate this problem, do the following:

     

    1) Create a database on SQL Server 2005 Express

    2) Make sure the database has "ENABLE_BROKER" set.

    3) Turn on CLR exceptions in your debugger (debug->Exceptions->Common Language Runtime Exceptions)

    4) Create a C# windows app.  Add the following in form1_load.

    string connectstring = "Server=<SERVER>;Integrated security=true;database=<DATABASE>";

    SqlDependency.Start(connectstring);

    SqlDependency.Stop(connectstring);

     

    5) Add using System.Data.SqlClient at the top of form1.cs

    6) Run the app.

     

    -Kent

    Thursday, January 3, 2008 8:30 PM

Answers