Visual Studio 2005 Tip of the Day – Class Diagram

I just have a really brief entry for today. In my continued efforts of self-improvement, I have stumbled upon a rather interesting feature in VS that I never knew (or bothered to look at). For some developers, they need to visualize what they are doing in one way or another. Well the good people at Microsoft have developed a GUI for creating classes called Class Diagram.

Right mouse click on your solution in the Solution Explorer and select Class Diagram. In there you will discover that you will be able to create the shells of your classes very simply and quickly. You can add methods, background fields, properties to new or existing classes you have created. In each of these you can include parameters and comments.

Once you include some code in the classes, you can even test the results with Test Bench. Basically you can enter values into the parameters of functions and see the output, without even writing the old main function and running through test case after test case. You still might want to do that anyway, so you can repeat your tests.

Well that is it for now!


WinDbg – Dot Net Debugging Without Source Code

Debugging with WinDbg can be challenging but rewarding. One area where Windbg shines is in the area of debugging dot net without the source code.

I am very much a beginner on this but I will tell you some things that I have found invaluable. First one, Tess Ferrandez is a goddess! She is an ASP.Net Escallation Engineer at Microsoft. Her blog, If Broken It Is, Fix It You Should, is absolutely filled full of tips and tricks. She also has a very good video at DNR Tv.

Setting Up Your PC To Use WinDbg

If you are debugging  a Dot Net Program’s crash dump, you are going to need the following file off of that computer: mscordacwks*.dll. You are going to need the version of it that the program is using. The asterick (*) is where the versioning would be in the file name. You are going to want to place it in the same folder as WinDbg with the following syntax for the file name:

The x86 is obviously for the x86 system architecture, you can also use x64 or the IA64 for the Itanium line. Following that you have the version of Dot Net 2.0.50727 followed by the exact version number of the dll, in this case 3603.

You can then run the .loadby sos mscorwks

If you do not do this correctly you will see something like this trying to run one of the SOS (Dot Net, managed code commands):

Failed to load data access DLL, 0x80004005
Verify that 1) you have a recent build of the debugger (6.2.14 or newer)
2) the file mscordacwks.dll that matches your version of mscorwks.dll is
in the version directory
3) or, if you are debugging a dump file, verify that the file
mscordacwks_<arch>_<arch>_<version>.dll is on your symbol path.
4) you are debugging on the same architecture as the dump file.
For example, an IA64 dump file must be debugged on an IA64

You can also run the debugger command .cordll to control the debugger’s
load of mscordacwks.dll.  .cordll -ve -u -l will do a verbose reload.
If that succeeds, the SOS command should work on retry.

If you are debugging a minidump, you need to make sure that your executable
path is pointing to mscorwks.dll as well.

In this case change the name of the dll to the correct name and then run the .cordll -ve -u -l command.

David Douglass’ blog has a great cheat sheet for common commands in WinDbg: .Net On My Mind

I just want to take a minute to thank people following this blog, you are a few but devoted bunch! If you have any questions, comments, or topic suggestions, I will be more than happy to discuss them.

Things I have learned today – Console Apps Using a Timer and CurrentThread!!!

So today I was creating a console application using timers in Visual Basic.Net. It happened to be a really simple, very tiny program. It consisted of two timers (of the System.Timers.Timer variety). All the main function was doing was calling these two timers. One catch to this, this kind of timer is asynchronous (runs on a separate thread from the main function).
I needed the program to wait while these timers (separate threads finished). After thinking about it for a while and after some trial and error here is what I came up with:

System.Threading.CurrentThread.Join(time in milliseconds)

It completely rocks! It will not spike the CPU at all! You will spike the CPU if you were to do something like:
Dim isFinished as Boolean

While Not isFinished
End While

CurrentThread is awesome! You can quickly manipulate your program to be have in ways you couldn’t even imagine.


12/27/2009 – Happy Winter Solstice! Compiled vs. Interpreted Languages

Business meeting Sorry I haven’t had any recent posts lately with all the holiday festivities, I simply didn’t have the time. One thing I did take time to think about is the current state of programming. I must say that I am rather disappointed that a lot of the people graduating college these days have not experienced the joys and sorrows of compiling and linking program.

Modern programming has changed a lot through the years. I think a great deal of changes were brought about through the creation of Java. I have to give it props, it was the first widely popular and accepted interpreted languages. I know some people might say Perl or Lisp (I myself used to be a Perl Monger) came sooner and have a large fan base. Sun’s Java paved the way for the modern programming languages.

Microsoft was quick to follow Sun with their product Dot Net. This is where I spend most of my days anymore for work. They did come up with a slightly different product, an interpretive framework on which C#, Visual Basic, and now F# are a part. Visual Basic is now the most popular language from Microsoft and C# is now a distant second.

These interpreted languages are fast to develop in but still rely on a middle layer to interpret the code you wrote into something the CPU will understand. To this end it is both a strength and a weakness. With this you can adapt your code to change at runtime, which in reality maybe five percent of developers/programmers use this on a regular basis. Another strength is that it is heavily abstracted and which makes coding faster for experienced programmers and allows the novice to do something that they otherwise wouldn’t be able to do.

Not much has changed in compiled languages recently, I think part of this could be due to the fact that Dot Net and Java are so popular. C++ is still popular and in use today. Although its market share is really dwindling. C++ is great for being able to tell the computer exactly what you want. In C++ you are some much closer to the machine code, you can practically see the registers getting loaded and the flags being set on the processor.

Of course, once a compiled program is running, nothing comes between it and the CPU (except for the OS). Lots of control comes with the compiled language as does responsibility and tedium.

A lot of really good practices, patterns, and algorithms are heading to the scrap heap if compiled languages fade into obscurity. I know people will say they will never go away and you are right, they won’t; but they just will not be used by Joe Programmer, who is just trying to pay the mortgage.

These kids today don’t know how good they have it. I still hear the tales of yore; where one man would wire the circuits to just get program to work. I fortunately am not one of them. I am sure I would have learned a lot from experience like that; perhaps the newbies coming into field would benefit from the things I have learned in my personal tales of yore. mailbox