Thursday, September 24, 2009

Debugger issues

Debugger cannot start if

Protected ReadOnly Property Logger() As ILogger
Get
CreateLogger()
Return mLogger
End Get
End Property

Why? This is not good. First, this property is intended to be get only, not set so VB requires adding ReadOnly key. Fine so far! But CreateLogger() is a function call that ensures mLogger comes out alive i.e. if mLogger is not already instantiated, then the function instantiates it, sets to specific log file etc. But we cannot test that, the VS debugger does not like that function and just simply says the debugger cannot be started! The release version bombs as well and prompts you with that dialog box asking if you want to see the error with a debugger (however, I noticed the dialog had VS2003 debugger!! I'm using VS2008 IDE!!)

Solution: Write "Me.CreateLogger()"

No comments: