Monday, 5 November 2007

Microsoft Visual Basic Compiler has stopped working

It would be me that happens to make the Visual Basic compiler crash!

As I've mentioned in the Rhino Mocks group, the crash appears to be caused by an interesting combination of a generic interface, another interface that inherits from the generic one, and a mock object that implements that interface. When you then try to use the new void method handling code (a new feature of Rhino Mocks 3.3) the compiler barfs (that's a compiler technical term).

I've attached a simple project to the MS bug report that reproduces the crash. Please contact me if you are interested in the code.

The workaround is to revert to the pre-3.3 way of handing void method expectations:

eg. instead of this:

Using Mocks.Record()
 
 Expect.Call(MockedObject.Subroutine)
 
End Using

Do this:

Using Mocks.Record()
 
 MockedObject.Subroutine
 
End Using

2 comments:

Jason Stangroome said...

We just got bitten by this problem in VS2008. We'll add to your submission in MS Connect to make sure they get this sorted.

- Jason

David Gardiner said...

From their comments, I think they've fixed it, but you either have to wait for the next service pack, or try and obtain a hotfix for it I'd guess.

-dave