Gravatar for sholmesby@hhogdev.com

Question by sholmesby, Jun 17, 2015 5:09 PM

How do you debug a .NET (C#) conversion script?

I have followed the tutorial to create a post converter script, from here:- https://developers.coveo.com/display/public/SC201506/Displaying+External+Content+in+a+Search+Interface

In the tutorial a script file is referenced as a plain .cs file.

I now want to be able to attach a debugger in my code so I can step through it and check out some info. I've found this question:- https://answers.coveo.com/questions/330/cant-debug-net-conversion-script-ces-7

It gave a little idea about how attaching the debugger, but I couldn't find anything listing all the steps involved. I assume I need to point the converter to my DLL, which will be alongside my PDB file.

I've tried setting:-

Configuration -> Converters -> Conversion Scripts -> Script File

to the DLL in my Class Library project's /bin/Debug folder.

and set:-

Configuration -> Converters -> Conversion Scripts -> Type Name

to the fully qualified 'namespace.class, assembly' value.

I then save it all, attach my debugger to the CESConverter7.exe process (under Managed mode), and then rebuild the source from the CES Admin tool.

The symbols don't get loaded, and so no breakpoints will ever be hit.

Can anyone tell me what I am missing?

2 Replies
Gravatar for sholmesby@hhogdev.com

Answer by sholmesby, Jun 18, 2015 10:08 AM

I worked out that:-

  1. the Script File needs to point to the DLL in the /Debug folder of my project
  2. the c# class library project needs to have a Target Framework of .NET 3.5
  3. When debugging, you need to select 'Managed (v3.5, v3.0, v2.0) code'. - Thanks @sdesilets for the tip

I've detailed the full setup in my blog post, here:- http://www.seanholmesby.com/debugging-a-custom-coveo-conversion-script/

Gravatar for sdesilets@coveo.com

Answer by Sebastien Desilets, Jun 17, 2015 6:21 PM

When building
Make sure your conversion assembly targets v3.5, v3.0 or v2.0 of the .Net framework.
The CESConverter7 process uses the CLR v2.0.

When debugging
Attach to CESConverter7.exe in "Managed (v3.5, v3.0, v2.0) code".

Gravatar for sholmesby@hhogdev.com

Comment by sholmesby, Jun 17, 2015 10:30 PM

It was 'Managed (v4.5, v4.0) code'. Should my project be .NET 3.5 based? Have I properly setup the DLL path and Type Name?

Gravatar for sdesilets@coveo.com

Comment by Sebastien Desilets, Jun 18, 2015 10:13 AM

Oops sorry I didn't notice the type name. No, don't specify the assembly name, only the full class name (namespace + class name).

It also helps to have the Index log opened when you rebuild or refresh the CES Source you added your conversion script to. In it you should see something like this: Rebuild on source YOURSOURCE(with conversion script YOURSCRIPTNAME) has been requested by YOU. Loading plugin 'YOURCOMPLETEDLLPATH'

or Loading plugin 'YOURCOMPLETEDLLPATH' [SERVERNAME] Error loading custom converter: Type names passed to Assembly.GetType() must not specify an assembly.

Ask a question