This project is read-only.

SecuritySafeCritical on Interpreter.Dispose?

Feb 13, 2012 at 5:49 AM

I am *not* a security expert. I don't have a firm grasp of all the issues surrounding security. However, when I call NMEAInterpreter.Dispose() from my Winform client code, it throws a security exception about transparent assembly calling into security critical code (RuntimeHelpers.PrepareConstrainedRegions, and _pausedWaitHandles.SafeWaitHandle).

I tried adding [SecuritySafeCritical] to Interpreter.Dispose, but somewhere back in the inheritance chain there is a [SecurityCritical] and you can't override that. 

I solved the problem by simply breaking out the Dispose code into a separate function, ala

	protected override void Dispose(bool disposing)

	private void DoDispose(bool disposing)
                // Rest of Dispose code....

But I'm concerned this isn't quite the "safe" or correct way to do things. Any thoughts? My app (a home grown navigation/gps app for tracking the behavior of marine mammals from airplanes) has been running great, but I'm trying to move over to using DotSpatial for some of the things it does better than myself (gps functionality, for example).

Any gurus want to comment, point at how I'm looking wrong direction, call me nasty names for not completely grokking why in the world my assembly might be see-through (transparent, maybe level 1 or 2, whatever the heck those levels mean)...or whatever?

Thanks :-)