SqlCommand.ExecuteNonQueryAsync causes APPCRASH in 32-bit exes
See original GitHub issueDescribe the bug
A .Net framework console application with the “Prefer 32-bit” build option set (which is the default) will crash if automatic tracing is enabled and SqlCommand.ExecuteNonQueryAsync
is called. Running as a 64-bit process works.
To Reproduce
- Create a console application and add this code
using (var connection = new SqlConnection("Data Source=localhost; Initial Catalog=master; Integrated Security=True;")) { connection.Open(); using (var command = new SqlCommand("select @@version", connection) { CommandType = CommandType.Text }) { Console.WriteLine("before"); var r = command.ExecuteNonQueryAsync().Result; Console.WriteLine("after"); } }
- Open a command prompt and enable tracing
set COR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8} set COR_ENABLE_PROFILING=1
- Run your program
Expected behavior Should see “before” and “after” in the console
Actual behavior
- Only “before” is seen
- Windows application event log contains
INFO: .NET Runtime version 4.0.30319.0 - The profiler was loaded successfully. Profiler CLSID: '{846F5F1C-F9AE-4B07-969E-05C26BC060D8}'. Process ID (decimal): 32992. Message ID: [0x2507].
ERROR: Application: 32Test.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an internal error in the .NET Runtime at IP 689D7FF4 (689C0000) with exit code 80131506.
Faulting application name: 32Test.exe, version: 1.0.0.0, time stamp: 0xa08db0d7
Faulting module name: clr.dll, version: 4.8.4121.0, time stamp: 0x5deace54
Exception code: 0xc0000005
Fault offset: 0x00017ff4
Faulting process ID: 0x80e0
Faulting application start time: 0x01d5ed51047d17f2
Faulting application path: C:\32Test\bin\Debug\32Test.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Report ID: fd970585-beca-4ed3-aea4-a5925ce63cca
Faulting package full name:
Faulting package-relative application ID:
INFO Fault bucket 2264445055422349415, type 1
Event Name: APPCRASH
Response: Not available
Cab Id: 0
Problem signature:
P1: 32Test.exe
P2: 1.0.0.0
P3: a08db0d7
P4: clr.dll
P5: 4.8.4121.0
P6: 5deace54
P7: c0000005
P8: 00017ff4
P9:
P10:
Runtime environment (please complete the following information):
- Instrumentation mode: MSI
- Tracer version: 1.13.2
- OS: Windows 10 1903; Windows 2016
- CLR: .NET Framework 4.8
Additional context
This statement is used by the NServiceBus SQL Server transport which we use extensively.
I enabled trace debuging which yielded the following:
[32Test.exe] 6352: [debug] JITCompilationStarted skipping function call: argument counts don't match. function_id=41960924 token=100663298 target_name=System.Data.Common.DbCommand.ExecuteNonQueryAsync() expected_number_args=1 target_arg_count=0
[32Test.exe] 6352: [info] *** JITCompilationStarted() replaced calls from System.Data.Common.DbCommand.ExecuteNonQueryAsync() to System.Data.Common.DbCommand.ExecuteNonQueryAsync() 100675060 with calls to Datadog.Trace.ClrProfiler.Integrations.AdoNet.DbCommandIntegration.ExecuteNonQueryAsync() 167775165
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (1 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi everyone, I prepared and merged a fix into
master
that makes sure that theSystem.Threading.CancellationToken
is passed correctly to our integration methods, and I’ve added regression tests for this particular callsite into our CI runs. This fix will be included in the next release, which we expect to happen later this week. Thank you again for your helpful reproductions that helped isolate the issue!@lucaspimentel is there any update on this? We are in the middle of trying to rollout DataDog and just installed the tracer in our production environment and it took down several applications (didn’t see any issue in our lower environments for some reason). We had
<add key="DD_TRACE_ENABLED" value="false" />
set in all apps but one hoping that the tracer would only affect the one app we had it turned on for. Unfortunately the apps that ended up crashing were ones that had tracing turned off. This is going to be a blocker to implmenting DataDog for us.