# Suppress CA Warning doesn't work in Visual Studio 2017 (C++/CLI project)

• ### Question

• When I try to Suppress Warning > In Suppression File in my vcxproj (C++/CLI), I get an error message "A file with the name d:\path\to\ClassLibrary1\ already exists on disk." and then "Cannot suppress the warning".

Is it a known limitation of Visual Studio 2017? Or am I missing some configuration?

Steps to reproduce:

- create vcxproj in Visual Studio 2017 15.4.1 with Code Analysis enabled;

- modify the base "Microsoft Mixed (C++ /CLR) Recommended Rules to include CA1812;

- build Release configuration and try to suppress CA1812

template<class T> private ref class Editable {
public: virtual void BeginEdit() {  }
protected: Editable() {};
};

namespace ClassLibrary1 {

public interface class IPanelUser
{
property int UserID { int get(); void set(int); }
};

private ref class PanelUser : public  IPanelUser, Editable<int>
{
public:
PanelUser()
{
};

virtual property int UserID
{
int get() { return 0; }
void set(int value) { }
}
};

public ref class Project
{
public:
IPanelUser^ GetUser() { return gcnew PanelUser(); }
};
}


Sunday, October 22, 2017 12:04 PM

### All replies

• >When I try to Suppress Warning > In Suppression File in my vcxproj (C++/CLI), I get an error message "A file with the name d:\path\to\ClassLibrary1\ already exists on disk." and then "Cannot suppress the warning".

I can reproduce this with the current preview version.

Please submit a bug report on this using the VS "Report a Problem" facility.

If you can post a link back here to your bug report, I'll vote/validate it.

Thanks
Dave

Sunday, October 22, 2017 6:04 PM
• I think I followed instructions and when I try to check the checkbox for CA1812 I get "Object reference not set to an instance of an object".

If you suspect a bug then you should check in Visual Studio Questions - Developer Community. I don't find something describing the problem I have but the following are similar.

Code Analysis rulesets ignored - Developer Community

Cannot create rule set - Developer Community

Sam Hobbs
SimpleSamples.Info

Sunday, October 22, 2017 6:51 PM
• Dave,

Thank you for the confirmation!

Hopefully, you can find the report at https://developercommunity.visualstudio.com/content/problem/135815/suppress-ca-warning-doesnt-work-in-visual-studio-2.html

Sam,

it did take me couple attempts to edit the ruleset, but it's a different problem and the original question doesn't depend on the particular rule. It's just I could easily extract short code that shows the problem with CA1812.

Thank you, both!

--
Kirill

• Proposed as answer by Monday, October 23, 2017 3:06 AM
• Marked as answer by Monday, October 23, 2017 10:34 AM
Sunday, October 22, 2017 7:53 PM
• Sunday, October 22, 2017 10:18 PM
• Hi Kirill,

Thanks for your feedback for Visual Studio 2017 product.