L
LarryF
I just solved a mysterious exception in a call to AddAdvise(). All my
calls to AddAdvise() threw an unhelpful "An exception occurred"
exception, so I'll post the solution to maybe save some other poor soul
the trouble of tracking it down.
Other posts have mentioned that AddAdvise() may throw this exeption
with the Visio 2003 DrawingControl if you specify
[assembly:ComVisible(false)] in your AssemblyInfo.cs. But I was getting
it because my event sink class wasn't public. It's fine if you pass a
private instance of your event sink class to AddAdvise(), but you'll
cause this run-time exception if the class definition itself isn't
public.
Now that I have your attention, I'm going to gripe yet again about the
lazy Visio programmers that throw exceptions without good explanations.
Any library programmer that throws an "An exception occurred" exception
with no additional information should be fired, and any company that
lets their developers do it needs to review its policies. Apparently
since the Visio programmers have the luxury of developing code that
doesn't have to depend on many other libraries, they have forgotten how
much trouble their laziness can cause. Or maybe they just don't care. I
have wasted literally days chasing down misleading or ambigous
exceptions thrown by Visio. Please, Visio developers, clean up your
exceptions and give us at least a hint as to what went wrong!
Larry
calls to AddAdvise() threw an unhelpful "An exception occurred"
exception, so I'll post the solution to maybe save some other poor soul
the trouble of tracking it down.
Other posts have mentioned that AddAdvise() may throw this exeption
with the Visio 2003 DrawingControl if you specify
[assembly:ComVisible(false)] in your AssemblyInfo.cs. But I was getting
it because my event sink class wasn't public. It's fine if you pass a
private instance of your event sink class to AddAdvise(), but you'll
cause this run-time exception if the class definition itself isn't
public.
Now that I have your attention, I'm going to gripe yet again about the
lazy Visio programmers that throw exceptions without good explanations.
Any library programmer that throws an "An exception occurred" exception
with no additional information should be fired, and any company that
lets their developers do it needs to review its policies. Apparently
since the Visio programmers have the luxury of developing code that
doesn't have to depend on many other libraries, they have forgotten how
much trouble their laziness can cause. Or maybe they just don't care. I
have wasted literally days chasing down misleading or ambigous
exceptions thrown by Visio. Please, Visio developers, clean up your
exceptions and give us at least a hint as to what went wrong!
Larry