Archives
-
NetFrameworkv1 WMI Provider?
From: Andy Cheung [MSFT] (hangc@online.microsoft.com)
Subject: Re: new namespace for v1.1? -
psexec \\computer -u Administrator cmd
The above command launches an interactive command prompt on \\computer running as Administrator. Mark Russinovich and Bryce Cogswell over at Sysinternals never fail to amaze me. If you haven't already, go grab Pstools now!
-
Command Line Client for GDN Workspaces
Apologies for the rather cryptic announcement yesterday. It was late, it worked and I wanted to go to sleep! ;) As the more curious of you will have found out, I’ve set up a couple of new GDN Workspaces. One for NAntAddIn and another for a Workspaces command line client. You will find a pre-built version of 'wks'. I will try and get a release of NAntAddIn up tomorrow.
-
..
-
NAnt Add-In Taster
I've always been a fan of a picture tells 1000 words, so here's a little taster...
-
MSBuild == XMake
regarding "I guess xmake lost :(". I'm not sure where you have heard of XMake, but just to make you smile I'm happy to report that MSBuild == XMake. XMake was the original codename for MSBuild. So where did you hear about XMake??
-
NAnt Add-In
Over the last few days I have been working on a new add-in. This time the aim is to integrate NAnt in a similar way to how NUnit Add-In works. At the moment you can right click on a solution, project or inside a build target to run NAnt. I have already eaten a fair amount of dog food as it’s something I've written out of necessity. It is now at the point where it is useful. I’m looking for a few dedicated alpha testers who promise to beat me up if it doesn’t work! If you’re zealous enough for the task – drop me an email or comment here.
-
Code Visualization?
What do people use for code visualization? About the only thing I miss from the Java world is JBuilder's UML view. I used it all the time to navigate my code. What do we have for .NET?
-
Trace Monitor is Back!
Chris Szurgot has informed me that Trace Monitor is back online. This application monitors debug output from all running applications. If you're testing things running in multiple processes it is indispensable. You can find it here along with source and some of Chris's other projects. If you don't already use this application, I would be interested to know what you use as an alternative. Also drop me a line if you would like the add-in version... ;o)
-
Reflector Add-In + Reflector 3.3.1.0
If anyone has tried using the Reflector Add-In with the latest version of Reflector, they will have found that the automatic download isn't working. Reflector's download location and public key changed recently causing it to break. I'm sorry I haven't released an update sooner. I've been rather distracted with a complete rewrite of the Managed Add-Ins framework. At some point you can expect a leaner, meaner add-in machine. For the moment I've got a fixed version of the Reflector Add-In for you (plus source). Unfortunately something in Reflector has changed causing it to stop working inside VS.NET 2002 (I imagine most people are using 2003 now anyway). If you have any idea what the problem is please let me know!
-
Visual Studio Favorites
I didn't know you could do this...
-
Microsoft blogs
I've just stumbled on the GotDotNet blog list. You'll find a whole screen full of interesting looking blogs there. I must have been too engrosed in Chris Brumme's epic posts to ever think about clicking in the top right hand corner. The very first blog is dedicated to the pretty much undocumented Fusion assembly loader. It looks like I've got some catching up to do!
-
TestFixture SetUp and TearDown
I have finally got round to trying NUnit 2.1 with NUnit Add-In. I am relieved to report that it works out of the box with the current version of NUnit Add-In (the one you’re probably using). All you have to do is start using the ‘NUnit.Framework’ assembly from the 2.1 release. If you’re interested to see the code that binds to pretty much any version of NUnit, you can find it here. There’s obviously some reflection in there, but the more interesting bit is the RealProxy. I had to use that to deal with the evolving test listener interface. The reason I started using 2.1 was for the TestFixtureSetUp/TearDown attributes. I didn’t particularly want to be firing up new instance of Visual Studio for every little add-in unit test. With the new attributes I can do the set-up and the start of the test run and tear-down at the end. This goes for whether I’m running an individual test or all tests in an assembly. Here is an example of how to use the new attributes, plus some other stuff for fun.. ;o)
namespace Tests { using System; using System.IO; using System.Diagnostics; using System.Runtime.InteropServices; using NUnit.Framework; using EnvDTE; [TestFixture] public class TestVisualStudio { [TestFixtureSetUp] public void TestFixtureSetUp() { _dte = new DTEClass(); _dte.MainWindow.Top = 50; _dte.MainWindow.Left = 50; _dte.MainWindow.Height = 200; _dte.MainWindow.Width = 1024; } private DTE _dte; [TestFixtureTearDown] public void TestFixtureTearDown() { _dte.Quit(); Marshal.ReleaseComObject(_dte); } [Test] public void TestNUnitAddInEscapes() { Debug.WriteLine(_dte, "_com"); Debug.WriteLine("====================="); Debug.WriteLine(_dte, "_verbose"); } [Test] public void TestShowMeTheCode() { _dte.MainWindow.Visible = true; System.Diagnostics.StackFrame frame = new System.Diagnostics.StackFrame(0, true); string fileName = frame.GetFileName(); int lineNumber = frame.GetFileLineNumber() - 1; // make it zero based string[] lines = new StreamReader(fileName).ReadToEnd().Split(new char[] {'\n'}); string code = lines[lineNumber]; Debug.WriteLine(code); _dte.StatusBar.Text = code; System.Threading.Thread.Sleep(5000); _dte.MainWindow.Visible = false; } } }
-
Re: Enforcing a Build and Test Policy
In a previous entry I posted some code that would run unit tests after every successful build. I used ‘Register for COM Interop’ and a ‘ComRegisterFunction’ attribute. Ian Griffiths asks, “What does this add that you don't get with VS.NET 2003's build events?” You can think of this as running lower level build events. Instead of executing a batch file and passing it an assembly location, you’re executing a method and passing it a Type object. It also means you can create logic that will run as part of installation. If these unit tests don’t pass, then fail early and don’t even install!
-
Reflector 3.3.1.0 + Managed Add-Ins
I'm afraid the download location and public key of Reflector has changed in this latest version, meaning the automatic download and update feature of Reflector Add-In won’t work. I'll write a note here as soon as there’s an updated version available.
-
Enforcing a Build and Test Policy
I have just realised that VS.NET has everything in place to support a build and test policy without the use of any external add-ins! You can define and enforce your unit tests in code on a per project basis. This technique uses the little known ‘ComRegisterFunction’ attribute and ‘Register for COM interop’. If this method returns an exception then the build fails. A new app domain is created per build with a base directory of ‘bin\Debug’.
-
Being Promiscuous and Stopping Infection
I’ve just detected an infection of MSBlast quite by accident. It was on a machine that I thought had all the latest patches so I hadn’t bothered to check it. On a different machine I was using the free packet sniffer Ethereal snoop on an outgoing HTTP connection. Ethereal defaults to running in promiscuous mode so you can see all traffic on your local subnet. It was obvious there was a problem from the very first page of data (you can’t miss something scanning ranges of IP addresses!). Even if you're not worried about MSBlast it's interesting to see everything that is happening on your network.
-
Language Equivalents
Darren Neimke found this useful collection on MSDN...
-
Add-Ins Gallery Update
Here are a few more example add-ins...
- Lutz Roeder's Reflector runnain as an Add-In
- Lutz Roeder's Documentor runnain as an Add-In (it would be quite strait forward to keep in sync with the code you're editing if you fancy and add-in project)
- Screenshot of Control Inspector running as an add-in inspecting Visual Studio Convert which also appears as an add-in.
- Command Prompt Add-In using the Pavel Zolnikov's Command Prompt Explorer Bar control. Here is a version that can be run as an add-in.
- SqlBuddy running as an Add-In. SqlBuddy expects to find the Icons directory relative to the current directory. When running inside Visual Studio.NET the current directory is \Program Files\Microsoft Visual Studio .NET\Common7\IDE\. As a work around you can copy the Icons directory there. A better solution would be for the application to look for the Icons relative to AppDomain.CurrentDomain.BaseDirectory.
- Here is a screenshot of Messenger.NET running as an add-in. Messenger.NET is a messenger client. It is minimalist compared the the Microsoft Messanger, but that is it's beauty! It will happily run in a tool window without beeping, flashing and generaly bothering you!
-
Command Prompt Add-In
I've uploaded a build of Pavel Zolnikov's excelent Command Prompt Explorer Bar ready to drop in as an add-in. Be sure to check out the original version. It is now one of my can't live without utilities!
-
Add-In Toolbox Explained
Yesterday I posted a picture of the new add-in toolbox. I should really explain what the different items do...
-
New Add-In Toolbox
-
Gallery First Few...
- Lutz Roeder's Reflector runnain as an Add-In
- Screenshot of Control Inspector running as an add-in inspecting Visual Studio Convert which also appears as an add-in.
- Command Prompt Add-In using the Pavel Zolnikov's Command Prompt Explorer Bar control
-
Managed Add-Ins Gallery
You've got to start somewhere. Here's a rather sparse Managed Add-Ins Gallery. Please send your screenshots and links here.
-
GetAssemblyName
Ah, so that is how you do it! I was going through all sorts of convoluted ways to simply find out if a DLL was managed (without loading it). It looks like that one call will do the trick.
-
Quick Launch
I've uploaded new versions of Managed Add-Ins and the Reflector Add-In. I've added a 'Quick Launch' menu to quickly start and stop your add-ins. I think this was needed before going properly beta (i.e. feature complete). You can dowanlod the new versions from here.
-
Reflector Add-In RC1
If there are a few downloads and no complaints, this is the version that is going out. Please comment here and let me know how you get on...
-
Building the Reflector Add-In
I've just written an article for the Code Project describing how you can easily create an VS.NET add-in like the Reflector one I posted screen shots of a while ago. I'm sorry I haven't got back to many of you who expressed interest in it. This reason is because I haven't been happy with the installation procedure (it too many steps). I'm very close to having an installer ready that does everything. I will email you all when this is ready. Hopefully then you can put your beta testing skills to more interesting problems than installation! If you would like to know when this is ready please drop me an email here.
-
Building the Reflector Add-In
I've written an article for the Code Project describing how you can easily build an add-in like the Reflector one I posted screen shots of a while ago. I'm sorry I haven't got back to many of you who expressed interest in the add-in. The reason is I haven't been happy with the installation story (it involved too many steps). It only takes one person to say they're having problems installing and I know it isn't good enough! I am very close to having an installer that I am reasonably happy with. I will notify you all when this is ready. You can then use your beta testing skills on more interesting problems than installation!
-
A question about Xml Serialization
I haven't tried this yet, but...
-
ReflectorAddIn 0.1.3
I have been having fun and games getting assemblies to refresh after they have been compiled. I have found a work around get unsigned assemblies to reload. Unfortunately it only works with VS.NET 2003/.NET Framework 1.1. I'm still working on getting signed assemblies with a fixed version number to refresh (signed assemblies with a changing version number always worked). If you're a beta tester, look in the usual place for the new build. Comment here and let me know how you get on.
-
Reflector AddIn 0.1.1 beta
Note to beta testers. I've put up an updated build. This version contains a number of new options. The code context menu now looks like this...
-
More Reflection
Here's another teaser for you...
-
Reflect on This
Putting Reflector where it belongs...
-
Trace Writer & Synchronicity
-
AttachDBFileName
I never knew you could do the following with SQL Server connection strings! This should make unit testing DB code a whole lot easier...
-
Java, junit and J#
I've been doing some work on an ongoing Java project recently. Although JBuilder has some neat unit testing facilities built in, I was missing the ability to run a test without leaving the method. Since the code I was working on was business logic rather than GUI code I was able to quickly port it to J#. Luckily the Java collections classes are supported as well as the Java 1.1 API (this makes all the difference). I'm now happily unit testing my Java project from inside VS.NET 2003. Of cause it all still compiles with Java 1.3 as this is the target platform! I have used the odd .jsl file to mirror or stub out Java code that doesn't work or won't compile. The most annoying thing is that even though Java and .NET resources work in almost exactly the same way, Class.getResourceAsStream(...) isn't supported! It takes only a few lines of code to find a .NET resource using a java.lang.Class object. I'm baffled as to why this isn't supported.
-
Fun with Mono, Rotor and DTE
I've just posted a new build of NUnitAddin. You should find running individual tests with the debugger much faster. It now only builds the current project (rather than the whole solution as it did before).
-
The Roman Kiss Phenomenon
The Roman Kiss Phenomenon
A few days ago, Roman Kiss presented the world with the Remoting Probe.
This is just the latest in a line of articles he's published on codeproject.com. -
WordML + WebDAV
Don has just got a WordML to XHTML transform working. This means I could create a WebDAV front end to my blog and edit entries directly in Word! Just having the Word spell checking facility makes this worth doing for me. Is there any chance you send me that XSLT? ;)
-
Who Needs VB.NET Macros?
Prototyping addins can be frustrating. If you don't fancy learning VB.NET just to write macros, you're forced to work with a full blown addin. This is anoying if all you want is a quick spelunk inside the VS automation model. This is why I've added another test target. If you select 'Run With... VS.NET', your tests will run inside the current VS.NET process. I've made the DTE object accessable using AppDomain.Current.GetData("DTE").
-
Code 2 Html
Nauman Leghari writes "I am looking for an addin which can convert code to html from the VS.NET IDE". I've been thinking about this recently too. It would be easy to adapt the NUnitAddin code to do this. Look for AddControl("Code Window", 3) in the source. You could use the SgmlReader to filter the code (after copying it to the clipboard). It does copy as a kind of HTML, but with lots of horrible Office and style tags (look the the HTML of any if the snippets I have posted).
-
Good News / Bad News
The good news is the the first major release of NUnitAddin for quite some time is out (version 0.5 build 105). The bad news is that it only works if the .NET Framework 1.1 is installed. It works with VS.NET 2002 and 2003, but only if 1.1 is there. So far the issue has defeated me. It looks like a NullReferenceException is being thrown deep in the bowels of .NET Remoting. The exception is being thrown by the NUnitAddin.TestRunner.Server program. If anyone can find the problem I would be hugely grateful. You can set a breakpoint in the source and use the new 'Run With... Debugger' feature to step into the offending code. Good luck... ;)
-
.
-
Blogmarks & .NETWeblog Future
Scott made a post about the future of .NETWeblogs and a possible moderated feed. I agree the main feed is too noisy. There's just too much stuff. If I read every single post I wouldn't get any work done. I don't know if you saw, but I posted about a possible way to tackle the problem... Blogmarks
-
Command Line Parsing with XmlSerializer
Duncan Mackenzie commented about a command line switch parser he found. Has anyone thought of doing command line parsing using (my current favorite class) the XmlSerializer? The code that follows can handle strings, ints, uints, bools, enums and arrays. Best of all it's only a page of code! The code you are about to see was designed using Ad Hoc tests. The '_verbose' category is a hint to dump the object's fields and properties. You can find more information about point and click testing here.
-
Testing ASP.NET Pages
I've been working on getting ad hoc tests working with ASP.NET. In order to work, the code behind class must be annotated with several attributes. They let the test runner know which page to render, what query string to use and when to run the test. The test can be run during any page event (Init, Load, DataBinding, PreRender etc.). For example, say you right click on and run the following 'test()' method....
-
Mono & Rotor
My internet connection has been down for going on a week. On the plus side I've managed to get loads of work done on NUnitAddin. Here is a screen grab I took a number of days ago. As you can see I have finally got support for Mono working! It was an up hill battle, but it's finally done.
Unfortunately it isn't checked intoCVSyet and there isn't abuildup on SourceForge. So much has changed it is going to take me a while to check everything back in. If you're impatient, dropmea line and I'll send you the latest revision. If fact, I’d appreciate anyone willing to do some alpha testing. -
Blogmarks
As blog entries fly past, I often find myself wanting to mark them for future reference. When I first started blogging I used to copy them verbatum into my blog. I used my blog as a kind of online scrap book. There is so much activity here, I feel it would be a bit antisocial to do that. I'm left loosing all of the interesting entries I don't have time to comment on.
-
Unit Testing on .NET Compact Framework
Breaman has started a project on SourceForge to support unit testing on the .NET Compact Framework. I'm currently working to support multiple testing frameworks and platforms with NUnitAddin. In order to support Mono and Rotor I’ve been working on a test runner that relies on only the most basic .NET Framework assemblies. I imagine the .NET Compact Framework will include System.Net and System.Xml? If so, adding support for Breaman's NCFUnit would seem achievable. Is this something anyone would like to see?
-
Free NUnitAddin Shares!
For a (hopefully) limited time only, shares in NUnitAddin are selling for $0.00! I probably shouldn't be telling you this, but if you want some free stock you can pick it up here. You never know, one day it might be worth something.
-
BlogShares
If anyone would like to show their support for NUnitAddin, I'm now listed on BlogShares. BlogShares is a for fun trading of weblogs. Weblogs are valued on incoming links and traders investment in the virtual stock. Kind of like the Google ranking system with a twist. For some reason I would be able to buy MovableType shares, but not DotNetCentric ones. Is this because Ingo Rammer isn't signed up, or some other reason? Also last time I looked, the stats for NUnitAddin haven't appeared and I wasn't able to buy. Have they disallowed insider trading? Anyway, time to buy buy buy... ;o)
-
Upcoming Support for Mono and Rotor
I haven't posted any new builds of NUnitAddin for a while. The reason is because I've been working on a version that supports Rotor, Mono and multiple versions of the .NET Framework. It has been coming on well, but not quite ready for release. It is fun being able to test snippets of code with Mono from the safety of Visual Studio.NET. ;o) I must say I'm very impressed with the Mono runtime's startup speed (especially when compared to Rotor).
-
Debugging Tests
If anyone has been having difficulty with the 'Debug Tests' functionality, there's a much more stable version up with build 92. Go to the 'Tools' menu and 'Debug Tests'. This will start a new test process with the debugger attached. You can then set breakpoints, run tests and even compile new tests (which feels strange with the debugger still attached). You won't be able to compile if the process has stopped on a breakpoint (the files will be locked). It's not quite Edit & Continue, but if feels pretty close. Let me know if you have any problems.
-
Stopping on Failed Assertions
After reading the following entry in Dejan's weblog, I decided to see it if what he suggests is possible using NUnitAddin.
-
G: is for GAC
From Jeff Key's .net blog
Using Explorer to get to physical files in the GAC -
Switching Target Frameworks with VS.NET 2003
I can't believe I missed this neat feature of VS.NET 2003. There goes my reason for staying with the old version. 2003 here I come...
-
Spelunking with Ad Hoc Tests
Here's a screenshot showing how easy it is to start spelunking about using Ad Hoc tests. In the example below I've defined a class that creates and disposes of an app domain. All the Ad Hoc test does is return the AppDomain object (which dumps all of its fields and properties). If an Ad Hoc test method is static - the constructor and dispose methods won't be called. Ad Hoc test methods can be private (you won't have to modify your code). At the moment methods with parameters aren't supported. A future version may pop up a dialog box for the parameters.
-
Immediate - Ad Hoc Tests
Okay, as promised I've implemented Ad Hoc tests in the latest build. The idea is to allow any method to be used as an Ad Hoc test. If the class the method belongs to implements a constructor or the IDisposable interface, these will be used to set up and tear down the test (unless the method is static). If the method returns an object, its fields and properties will be displayed (in a similar format the the Immediate window).
-
Installing JUnit & NUnit TestRunners
I've now consolidated the nunit and junit test runners into a single installer. I originaly split them because the junit test runner has a dependence on having the J# runtime installed. I had hoped that splitting them into merge modules would do the trick. Unfortunately it's not as simple as that. From what I can work out there is no way of optinally including a merge module in an installer. Instead you must optionally include individual components (files, registry entries etc.) in the merge module or installer. This is a problem when what you want to optionally install is a merge module. I have resorted to using Orca (the MSI editor) to add dependencies to the J# dependency merge module. Now the installer will only check for the J# runtime if the junit test runner is selected.
-
NUnitAddin + Visual Studio.NET 2003
I've fixed NUnitAddin so that it works with Visual Studio.NET 2003 (and the original version). More later about the issues involved in getting it working. Let me know if you have any problems.
-
Stepping into IL while debugging
.NET Brain Droppings
This post came across the ADVANCED-DOTNET list several months ago and I had to post it. Many of us want to be able to step into the IL as we are debugging, but we can't. This suggestion was provided as a work around by Craig Andera and seconded by Mike Woodring. It's a great way to view the IL as your debugging; lets hope MS will make this easier in the 2nd drop of .NET. You can find the post in the archives here.(1) decompile your assembly using ildasm to get an IL source file that includes the original high level language in interspersed comments.
(2) recompile the IL into an assembly using ilasm.exe
(3) debug the assembly; now able to see source+IL+asm -
NUnitAddin J# Dependency (Fixed)
The previous build picked up a dependency on having the J# redistributable installed. In this build I've split support for J# NUnit and junit projects into a separate installer. Install both packages if you want support for junit and all J# 'New Project...' wizards.
-
Pluggable TestRunners
I've been moving towards a more extensible test runner framework. My first implementation using the new framework is support for junit. I was pleased to find that the 'junit.framework' assembly compiles out of the box with the J# compiler. I have made one minor tweak to it though. .NET behaves slightly different to Java when throwing exceptions. Java fills in the stack trace when an exception is created, whereas .NET does when it's thrown. I've modified junit so it stores the exception without rethrowing it. This preserves the useful stack trace information when a test fails.
-
eXtensible C# is cool!
I've had a go and it really works! I've made a tweak to NUnitAddin so they play nicely together (save all files before build). eXtensible C# handles its assertions using the TraceListener framework. These messages will show up when running a subset of tests using the code context menu. Adding failing non-terminal assertions to the Task List is on my todo list.
-
Save, Build, Test
The very anoying bug where source files weren't being saved before building and testing has been fixed! This was only ever an issue for J# and C++ projects from what I can work out.
-
IntelliSense in Immediate Window
VS.NET 2003 Delivers Solid Enhancements, Microsoft Promises Even More in 'Whidbey'
-
Pressing CTRL-C on a Windows Dialog Box
I've just received a bug report with the following note...
-
Trace and Debug Output
Too many times I've found myself adding and removing Console output to my tests. I've added it when I need more information about how an individual test is running. I've removed it when cleaning up the output from running all tests in an assembly. I've found what I think is an effective solution.
-
Attaching to a Process using VS.NET Automation Model
I've recently changed NUnitAddin so that it runs unit tests in an external process. It controls and communicates with this process using .NET remoting. Because tests are run in an external process it's possible to attach the VS.NET debugger set breakpoints on them. When I manually attach the CLR debugger (as follows) it works great.
-
Screenshots
I've started working on a guide to using the addin. All there is so far is a number of screenshots. You can tell pretty much how it all works just from them.
-
Enumerating AppDomains
Have you ever wondered how to enumerate all AppDomains in the current process? It can be done with a little COM interop...
-
Making Test a First Class Citizen
The aim of the project is to make Test a first class citizen inside Visual Studio.NET. Test should be as integrated and natural a part of your development environment as Build is today. Wherever you find a Build action you could also expect to find a Test action. For example there is an action to Run Tests in a Project or Solution. There is also an action to Run Test(s) on the code context menu. Which tests are run depend on whether you click inside a Test, TestFixture or Namespace. Obviously this doesn't correspond to Build (until we get Edit & Continue that is ;). The corresponding Build action will be performed before any tests are run (Test depends on Build).
-
NUnitAddin Weblog
Welcome to the NUnitAddin project weblog. My inspiration for starting this is Jeroen Frijters IKVM.NET Weblog. I have enjoyed watching his project progress over the months. Where as this is no way near as ambitious, I hope people will find it useful.