When you’re working with Visual Studio, you will always run into odd problems – this is one of them.

When working with Javascript, C# and VS you sometimes want to debug the Javascript directly in the IDE… but you get the silly:

the breakpoint will not currently be hit no symbols have been loaded

the breakpoint will not currently be hit no symbols have been loaded

One way around this (an easy, but dirty way) is to open up Internet Explorer, and go to tools (if you’re using Internet Explorer 8 and above you may need to press the ALT button to show the file menu) then click the ‘Advanced’ tab, and check ‘Display a notification about every script error’.

Then, when you get an error… it will pop up and ask whether you’d like to debug it. Follow the prompts and debug it in a new instance of Visual Studio. You will be able to see the breakpoint, and you’ll be able to use the built-in debugging features, like step in.

 

Tags: , , ,

· · · ◊ ◊ ◊ · · ·

At work the other day, we had an issue regarding reporting services. We have two servers, one is the test and one is the live server.

The requirement was:

  1. When debugging the web application, point to the test Reporthost
  2. When running in ‘Release’, point to the live Reporthost

We figured that we could use web.config transformations – that is, two different web.config files for the two solution configurations: Web.Config, Web.Debug.Config, and Web.Release.config.

Unfortunately, we found that this wouldn’t work after a lot of research and trial and error – it only works when the project is published (deployed).

Refusing to be beaten by Visual Studio, we decided to use the Build Event feature, and for whatever solution configuration the project was currently set to, we would search the specified files and replace the text (i.e. From TestReporthost to LiveReporthost). We shortly realized that we would need a third party tool to help with this, and that was the FART tool (http://fart-it.sourceforge.net/).

The prebuild event:

if $(ConfigurationName) == Debug (
$(SolutionDir)debug.bat
) ELSE (
$(SolutionDir)release.bat
)

The bat file(s):

X:\App\fart.exe -i <pathtofile> <find> <replace>
EXIT 0

Everything worked beautifully, and the requirements were met.

Tags: , , , , , , , , ,

· · · ◊ ◊ ◊ · · ·

This snippet of code allows you to show a report dynamically using the Report control with Reporting Services and ASP.NET (C#):

        protected void Page_Load(object sender, EventArgs e)
        {
            reportServerUrl = "<report server>"; // e.g. localhost
            reportPath = "/path/to/report";
            reportViewer = "sdsdffsd";

            if (!IsPostBack)
            {
                this.ReportViewer1.ServerReport.ReportServerUrl = new System.Uri(reportServerUrl);
                this.ReportViewer1.ServerReport.ReportPath = reportPath;

                Microsoft.Reporting.WebForms.ReportParameter[] RptParameters = new Microsoft.Reporting.WebForms.ReportParameter[3];
                RptParameters[0] = new Microsoft.Reporting.WebForms.ReportParameter("From", "01-01-2011"); // any param
                RptParameters[1] = new Microsoft.Reporting.WebForms.ReportParameter("To", "01-01-2011"); // any param
                RptParameters[2] = new Microsoft.Reporting.WebForms.ReportParameter("Links", "True"); // any param

                this.ReportViewer1.ServerReport.SetParameters(RptParameters);
                this.ReportViewer1.ServerReport.Refresh();
            }
        }

Your parameters will be different than mine, you can remove those, or edit them. This code assumes your Report Viewer control is called ReportViewer1.

Tags: , , , , ,

· · · ◊ ◊ ◊ · · ·