Debugging or troubleshooting custon c# code


https://www.nevron.com/Forum/Topic12075.aspx
Print Topic | Close Window

By Igor VASILIEV - 7 Years Ago
Hi

I'm using a trial version of the Nevron Vision for SSRS 2016.1 for SQL2012 VS2010.
I need to inspect NRSChartCodeContext object passed to public static void RSMain.
Ideally I want to browse object hierarchy.
I assume debugging the code in Visual Studio is not possible.
Can you recommend any technique for that? Apart of using MessageBox.Show()

Thank you.
By Nevron Support - 7 Years Ago
Hi Igor,

Generally it is possible to use the debugger but for this purpose, but you need to create your own dll which is called by the custom code. The reason for this is that the SSRS designer code generates an in memory assembly and we're not sure if Visual Studio can locate PDB information for such an assembly.

The following tasks outline this approach:
1. Create a dll [CustomCodeSSRS]

2. Define an entry point there:

using System;
using System.Collections.Generic;
using System.Text;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.ReportingServices;

namespace SSRSCustomCode
{
    public class Class1
    {
        /// <summary>
  /// Main entry point
  /// </summary>
  /// <param name="context"></param>
  public static void RSMain(NRSChartCodeContext context)
  {
            // Do something here just like in SSRS
  }
    }
}
3. Call that entry from the SSRS designer:


using System;
using System.Drawing;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.ReportingServices;
using SSRSCustomCode;

namespace MyNamespace
{
 /// <summary>
 /// Sample class
 /// </summary>
 public class MyClass
 {
  /// <summary>
  /// Main entry point
  /// </summary>
  /// <param name="context"></param>
  public static void RSMain(NRSChartCodeContext context)
  {
   Class1.RSMain(context);
  }
 }
}

4. Reference the CustomCodeSSRS dll in the SSRS designer "Build \ Referenced Assemblies" add "[AppDir]\SSRSCustomCode.dll"
5. Deploy the CustomCodeSSRS dll to the SSRS designer and report server folders. For example:
C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\
c:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin

You should be able to attach a debugger to Visual Studio and debug from there. Hope this helps - let us know if you meet any problems or have any questions.