Showing posts with label Debug. Show all posts
Showing posts with label Debug. Show all posts

Wednesday, 22 April 2015

Catastrophic failure when attaching Visual Studio Debugger to IISExpress

Symptom: Unable to attach to the process. Catastrophic failure.
Resolution: Change project settings to enable edit and continue, then press F5 to start the web project in debug mode.
image
I also deleted my solution.suo file from the solutions directory as it was over 3MB! - more about that here -http://merrickchaffer.blogspot.co.uk/2012/02/visual-studio-hanging-running-slowly.html


Monday, 9 June 2014

Reporting services log file location

The log file for reporting services SSRS 2008 R2 can be found in this default directory...

C:\Program Files\Microsoft SQL Server\MSRS10_50.SSRSBI\ Reporting Services\LogFiles

Tuesday, 20 May 2014

Macros in Visual Studio 2012 / 2013

Use the following visual studio extension in order to recreate the macros that you were used to using in VS 2010 and below
http://vlasovstudio.com/visual-commander/
image
Also to run the macro, try using the Ctrl+Q shortcut menu in VS 2013, as follows
image

Or customise your toolbar


The attach to process macro will now look like this as a new Visual Commander command using VB v4.0 language
Imports EnvDTE
Imports EnvDTE80
Imports Microsoft.VisualBasic

Public Class C
    Implements VisualCommanderExt.ICommand

    Sub Run(DTE As EnvDTE80.DTE2, package As Microsoft.VisualStudio.Shell.Package) Implements VisualCommanderExt.ICommand.Run
        AttachToProcess("MyProcessName.exe", DTE)
    End Sub

    Private Sub AttachToProcess(ByVal ProcessName As String, DTE As EnvDTE80.DTE2, Optional ByVal Script As Boolean = False)
        Try
            Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger
            Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default")
            Dim dbgeng(1) As EnvDTE80.Engine
            If Script Then
                dbgeng(0) = trans.Engines.Item("Script")
                'Array.Resize(dbgeng, 1)
            Else
                dbgeng(0) = trans.Engines.Item("Managed")
            End If
            Dim proc2 As EnvDTE80.Process2 = dbg2.GetProcesses(trans, System.Environment.MachineName).Item(ProcessName)
            Call proc2.Attach2(dbgeng)
        Catch ex As System.Runtime.InteropServices.COMException
            Select Case ex.ErrorCode
                Case -2147352565
                    ShowMessage(ProcessName & " is not currently a running process")
                Case -1989083106
                    ShowMessage("You are already attached to " & ProcessName)
                Case Else
                    ShowMessage("Unhandled error message from Attach to process macro")
            End Select
        Catch ex As System.Exception
            MsgBox("Unhandled exception occurred: " & ex.Message)
        End Try

    End Sub
    Private Sub ShowMessage(ByVal message As String)
        Call MsgBox(message, MsgBoxStyle.Exclamation, "Attach to process macro")
    End Sub


End Class

Tuesday, 29 May 2012

JQuery event debugging

http://james.padolsey.com/javascript/debug-jquery-events-with-listhandlers/

CODE

Here’s a useful debugging plugin for jQuery. It will list the handler/’s of any event bound to any element:

/ UPDATED -> NOW WORKS WITH jQuery 1.3.1
$.fn.listHandlers = function(events, outputFunction) {
return this.each(function(i){
var elem = this,
dEvents = $(this).data('events');
if (!dEvents) {return;}
$.each(dEvents, function(name, handler){
if((new RegExp('^(' + (events === '*' ? '.+' : events.replace(',','|').replace(/^on/i,'')) + ')$' ,'i')).test(name)) {
$.each(handler, function(i,handler){
outputFunction(elem, '\n' + i + ': [' + name + '] : ' + handler );
});
}
});
});
};

USAGE


It’s pretty simple to use, you can specify the elements (as you usually would, via a selector), the events to be listed and the output function to which the plugin will feed the data.

If you’re using firebug then it’s best to use either the console.log function or console.info.

// List all onclick handlers of all anchor elements:
$('a').listHandlers('onclick', console.info);   // List all handlers for all events of all elements:
$('*').listHandlers('*', console.info);   // Write a custom output function:
$('#whatever').listHandlers('click',function(element,data){
$('body').prepend('<br />' + element.nodeName + ': <br /><pre>' + data + '<\/pre>');
});

Note, this will only work if you’ve used jQuery’s native event registration methods, e.g.$(elem).click() / $(elem).bind('click').

image

Friday, 11 May 2012

Alternatives to .NET Reflector

ILSpy = http://wiki.sharpdevelop.net/ILSpy.ashx

Decompilation to C#

  • Supports lambdas and 'yield return'
  • Shows XML documentation

 

JetBrains dotPeek = http://www.jetbrains.com/decompiler/

Uses similar keyboard shortcuts to JetBrains Resharper.

Monday, 27 February 2012

NuGet training video

 

I was watching perhaps the best training video I've ever watched on the weekend http://channel9.msdn.com/Events/MIX/MIX11/FRM09, and one of the libraries they were saying they can't live without is ELMAH (Error Logging Modules and Handlers) …

Also checkout Scott Hansleman coding from a dos prompt about 18 mins into the first video link… Class

 

Also worth noting that codeplex.com is based on a hybrid of both ASP.NET webforms and MVC.

Assuming you guys all have NuGet installed for VS 2010 extensions, then I can thoroughly recommend the MoodSwings package written by Phil Haack (mate of Scott H's).

To install, open the package manager console window, and simply type Install-Package MoodSwings

The command .. Set-Mood Rick will then provide you hours of fun ;)

image

image

image

Wednesday, 12 October 2011

Visual Studio Shortcuts

Just found a new short cut in VS 2008 quite by mistake.

Ctrl + /, puts you up here...

clip_image001

And then you get intellisense commands that you can get the visual studio ide to do, e.g. Debug.AttachtoProcess

Nice.

Thursday, 26 May 2011

Debugging IIS w3wp.exe process

When debugging  IIS and taking a while to look at your code, you may sometimes get this message

clip_image002

To fix this simply switch off the ping enabled setting in your IIS, application pool, advanced settings

clip_image004

How to find the last interactive logons in Windows using PowerShell

Use the following powershell script to find the last users to login to a box since a given date, in this case the 21st April 2022 at 12pm un...