I'm still working thru the sample code. In the ShoppingCart sample,
there is an Invoice message type, but there is no BrokerMethod
associated with it. Complicating this, I cannot figure out how to
debug the service side of things. Any help with these issues would be
greatly appreciated.
Hi Dwight,
If your service code is written in SQLCLR, the way I debug is through Visual
Studio using "Attach to process". You must attach to the SQL Server process
itself (SQLSERVER.EXE) and if the SQL Server service isn't running as you
(it shouldn't be), you need to check "show processes from all users" to be
able to select it. You should only do this type of debugging on your own
test instance because, as the message box says "using attach to process
could be harmful to SQL Server" (I've had it bring down the SQL Server
process on occasion, due to "pilot error"). You must be running VS as a SQL
Server sysadmin for debugging to work.
Ensure you have the .pdb file for your assembly cataloged (using ALTER
ASSEMBLY ADD FILE ...). Start the debugger, set breakpoints, hit the queue
with a message and the service program should spin up and hit your
breakpoint.
If you're using T-SQL activation proc you can directly debug service
programs, but you can insert PRINT statements into the T-SQL code. The PRINT
statement output will appear in the SQL Server log file. Use SSMS to read
the log.
I haven't got ShoppingCart in front of me, but if there is no BrokerMethod
for the Invoice message type, it's likely being sent by the application not
processed from a BrokerService activator. Search the source for BEGIN DIALOG
CONVERSION (DIALOG keyword is optional) followed by a separate SEND of the
message type.
Hope this helps,
Bob Beauchemin
SQLskills
> I'm still working thru the sample code. In the ShoppingCart sample,
> there is an Invoice message type, but there is no BrokerMethod
> associated with it. Complicating this, I cannot figure out how to
> debug the service side of things. Any help with these issues would be
> greatly appreciated.
Dwight Johnson - 18 Jul 2008 14:48 GMT
Bob,
Thanks again.
I was able to get my process debugged based on your suggestions, as
follows:
1. Add pdb file to Assembly:
ALTER ASSEMBLY
ShoppingCartAssembly
ADD FILE FROM
'C:\Documents and Settings\[...]ShoppingCartService\bin\debug
\ShoppingCartService.pdb'
2. Set breakpoint in client if necessary.
3. Start application. [I had to do this first to get the winform to
open.]
4. Set breakpoint(s) in service code.
5. Select Debug > Attach to Process...
6. Check "Show processes from all users". Locate and select
Sqlsevr.exe and hit Attach button.
7. Step thru code. [And it did!]
Dwight