3

I was using the VS 2019 to debug a SQL Server CLR C# .NET code. I got an upgrade notification from VS which I did and rebooted. I now get the error when trying to debug

Unable to debug .NET code. Could not attach to SQL Server on '....'. The 64 bit version of the Visual Studio Remote Debugger (MSVSMON.EXE) can not be used to debug 32-bit process or 32-bit dumps. Please use the 32-bit version instead.

Now my SQL Server (2019) is 64-bit and the SQLCLR Platform target is x64, so what is going on to make it think that a 32 bit process is involved?

Also the SQL Server and the VS 2019 are on the same machine do it not a remote machine issue.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Ben Watson
  • 150
  • 2
  • 10
  • For a more complete list of requirements for debugging SQLCLR, please see my answer to the following S.O. question: [How to debug a CLR Stored procedure in VS 2013](https://stackoverflow.com/a/45305204/577765). – Solomon Rutzky Dec 18 '20 at 03:12

2 Answers2

5

I needed to run VS 2019 as an administrator - that fixed the issue. The error message is very misleading.

I tried changing the firewall settings but did not work.

Ben Watson
  • 150
  • 2
  • 10
0

Looks like you are trying to debug using the 64 bit remote debugger tools instead of the 32 remote bit debugger tools.

The connection component to SQL is likely 32 bit that's why it is crapping out.

https://visualstudio.microsoft.com/downloads/#remote-tools-for-visual-studio-2019

dynamiclynk
  • 2,275
  • 27
  • 31
  • Why would the OP be required to use _32 bit_ Remote Debugger Tools? Though the error message claims _"32-bit"_, don't forget the OPs environment is Windows 64-bit, SQL Server 64-bit (+ SQLCLR 64-bit). Additionally, OP's environment was working prior to reboot. Remote debug settings are saved in Visual Studio project settings so it is unlikely it was changed just because of a VS-upgrade + reboot. –  Dec 18 '20 at 00:39
  • Because it trying to use a 64bit remote debugger session against a 32bit agent. Otherwise they can make sure to debug as x86 and not AnyCPU. – dynamiclynk Dec 18 '20 at 00:57
  • The _"32bit agent"_ is SQL Server x64. In any event, this is all moot as everything is _local machine_. Remote Debugger is not required nor was being used directly by the OP –  Dec 18 '20 at 01:12
  • I understand your thought but based on the error it is stating a 32bit debug session is required to hit the 32bit debug tools agent. The SQL Server is 64bit but that doesn't mean the remote process that hosts the debug session is. – dynamiclynk Dec 18 '20 at 01:15