Advanced .NET debugging – presentation

I have prepared small presentation about advanced .NET debugging. As a example buggy program is used

Advanced .NET debugging – hidden tresure

Obfuscated variant encrypted

Protected: Advanced .NET debugging – examples

There is no excerpt because this is a protected post.

 

Advanced .NET debugging – presentation

August 17, 2012 in .NET, debugging

I have prepared small presentation about advanced .NET debugging.

As a example buggy program is used BuggyApplication [9/20/2012 updated] This application has only one reason and it’s to crash in different ways. For WCF exception at first start BuggyApplication\HostingBusinessLayer\bin\Release\HostingBusinessLayer.exe. In BuggyApplication WCF client test if connection is working. You have to have allowed TCP port 8080 in your firewall.

Presentation:

Advanced .NET debugging – hidden tresure

August 8, 2012 in Uncategorized

Obfuscated variant
encrypted

Protected: Advanced .NET debugging – examples

August 1, 2012 in .NET, c++, debugging

This post is password protected. To view it please enter your password below:


P2D2 2012

February 13, 2012 in PostgreSQL developing

Conference P2D2 2012 is over and best memories remains.

For whom is interested in there are slides from my presentation slides in czech

Looking forward for next year’s experience.

SnowStorm team spirit

January 16, 2012 in Graphics

Veselé Vánoce/merry xmas

December 24, 2011 in Uncategorized

Set project loading priority in Visual studio 2010

December 21, 2011 in Visual studio, VS2010

Do you have a weak nerves as I have? When you have 108 projects in solution it takes ages to open it, especially when you have ASP.NET project with bunch of resources and source control binding is checking every single file.

I develop VS2010 plugin, which can open all projects in unloaded or loaded only per request state. Opening is much faster and you can choose with wich projects you will work. Configuration is accessible at Tools::Weak nerves menu.

Edited 2012-01-09, included version 1.0.5

1.5_Release

 

Windbg .net debugging mini how-to

December 15, 2011 in .NET, debugging

If you are running 64-bit OS, install both the 32-bit and 64-bit verions of Windbg. You will need to attach the correct windbg version to your process depending on whether you are debugging 32- vs. 64- bit process. If you attach the wrong version, you can get the “clr module not found” error on trying to use .loadby sos clr command.
A useful debugging extension is sosex. Download from url and extract the 32-bit version into the 32-bit windbg install location. Extract the 64-bit version into 64-bit windbg location.
In windbg, launch your .exe to debug through windbg menu or attach windbg to a running process. Remember 32-bit windbg for 32-bit OS or process running as 32-bit in 64-bit OS.
Press F5 to start debuggee (your process), click Debug, break (or ctrl+break) to break into your process and freeze process threads. Now you are ready to use windbg.
At windbg command prompt type:

.load sosex
.loadby sos clr
Note – If you get the clr not found error, make sure you are .NET 4.0. If not, use .loadby sos mscorwks as stipulated earlier in the thread. you can also use the lm command in windbg to see loaded modules and clr should be in that list if you are .NET 4.0.

Some useful commands

~ displays all threads
!threads displays all managed threads
~#s where # is the thread number – switch between threads e.g., ~0s switches to thread 0
!clrstack walks stack for a managed thread – note you need to switch to the thread first using info from !threads on which are managed and using ~#s to switch to the one you want the stack for.
~*kP stack for all threads
.prefer_dml 1 dml formatting for windbg output.

What next

Read great book Advanced .NET Debugging

Advanced .NET Debugging

Advanced .NET Debugging

ISBN-13: 978-0-321-57889-1
ISBN-10: 0-321-57889-9

Solarwinds logo

October 6, 2011 in Graphics

Render of solarwinds logo, 16 hours of CPU time

static in different manner

October 3, 2011 in c++

It’s quite confusing, but static keyword have 3 different meanings in c++ source code file .cpp and c++ header .hpp, if you ever faced this error

Cannot declare member function static int Foo::bar() to have static linkage

then you are on right place to investigate why this happened.

 

Inside a function

Inside a function, the static keyword with a variable declaration means that the variable’s value doesn’t disappear when execution exits that function. Each time that function is called, the variable at the start of execution is the same as it was at the previous exit of the function.

Inside a class definition

Inside a class definition, the static keyword means that the variable is attached to the class as opposed to an instance. All instances of that class will simultaneously share that variable.

For global variables

When static is used with a global variable, it means that it is not visible to any code in other files. (Note: files, not classes.)

This use is deprecated. Instead, you should use anonymous namespaces to hide code from other parts of the program.

by url

So this is correct:


class SomeClass
{
public:
static int SomeFunction();
};
int
SomeClass::SomeFunction() { return 0;}

this is NOT correct:


class OtherClass
{
public:
static int OtherFunction();
};
static int
OtherClass::OtherFunction() { return 0;}