NonComVisibleBaseClass was detected; How do I fix this?

Hcabnettek picture Hcabnettek · Jun 26, 2009 · Viewed 8k times · Source

My class derives from System.Web.Security.MembershipUser I am getting this error when submitting the form. The popup form uses ASPPDFand the application did not have this problem before implementing the custom MembershipProvider goodies. Note this is a debugging error only. It seems to work when I am not debugging. Does anyone know how I can fix this?

NonComVisibleBaseClass was detected Message: A QueryInterface call was made requesting the default IDispatch interface of COM visible managed class 'XyAmpUser'. However since this class does not have an explicit default interface and derives from non COM visible class 'System.Web.Security.MembershipUser', the QueryInterface call will fail. This is done to prevent the non COM visible base class from being constrained by the COM versioning rules.

Thanks, ~ck in San Diego

Answer

Jeremy picture Jeremy · Jun 28, 2010

I have recently discovered this error in a totally unrelated scenario to yours.

  1. Navigate to Debug->Exceptions...
  2. Expand "Managed Debugging Assistants"
  3. Uncheck the NonComVisibleBaseClass Thrown option.
  4. Click [Ok]

Here is more information, which may help.

Just to keep this up to date:

In Visual Studio 2019: Debug Menu, Windows --> Exception settings, opens the Exception settings window. There expand "Managed Debugging Assistants" and finally uncheck NonComVisibleBaseClass