Disable a warning
Thanks,
Lance
Thanks,
Lance
<NoWarn>42015,42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
If you do this, please be careful as this is indeed a valid warning. Consider the following code snippet:
Module
Sub Main()
Dim b As New Base
Dim d As New Derived
Dim bd As Base = TryCast(d, Base)
Dim bc As Object = d.Clone
Dim bdc As Object = bd.Clone
End Sub
Public Shadows Function Clone() As Object Implements System.ICloneable.Clone
End
ModuleWhat type of object would you expect bdc to be after running this application? (Hint - it will *not* be of type Derived, even though the object bd is referencing is of type Derived) A better pattern is for the base class's ICloneable.Clone method to call a protected overridable CloneInternal method that does the real work. Best regards,
Johan Stenberg
I have a similar problem, except it's a warning to do with CLS-compliancy due to using a Docking control (by Weifen Luo) which is not CLS-compliant. So I get:
frmX is not CLS-Compliant because it derives from 'DockContent', which is not CLS-compliant.
I don't think there's anything I can do to fix the code to make it CLS-compliant, so really I just want to disable that specific warning.
So I edited the .vbproj to add Error ID 40026 (as per: ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vbalr/html/debcd5e4-75e7-4b14-a6cc-18f1009fe52c.htm
) to the NoWarn section but unfortunately the warning is still showing up after saving the vbproj, reloading and rebuilding...
(I know it's possible to do this by editing the AssemblyInfo by marking the CLSCompliant attribute as false, but I was wondering if it was possible to just suppress the warning?)
Any ideas?