I’ve found this piece of code on Koders:
private ServiceProvider SiteServiceProvider { get { if (serviceProvider == null) { serviceProvider = new ServiceProvider(site as VSOLE.IServiceProvider); Debug.Assert(serviceProvider != null, 'Unable to get ServiceProvider from site object.'); } return serviceProvider; } }
I’m wondering, is there any possible way the Debug.Assert(serviceProvider != null could trigger? I’m under the impression that new could only be aborted by an exception, in which case the assert would never be reached.
It’s possible that the ServiceProvider overrides the !=/== operator, so that for an invalid state the comparison to null returns true.
Looks strange anyway.