Unable to use Bordecal rules with VS2010

Jan 3, 2013 at 3:55 PM

Hello,

 

I have DL the recomended package. I have put the whole content in "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\Rules" 

I have created a new VS C# project, I have configured my ruleset to check only "BC1003 Dispose disposable fields" 

When i click on "Run Code Analysis" I get the following error :

Error 1 CA0053 : Unable to load rule assembly 'c:\program files (x86)\microsoft visual studio 10.0\team tools\static analysis tools\fxcop\rules\bordecal.fxcop.sdk.dll': The assembly contains no FxCop rules.

Coordinator
Feb 1, 2013 at 12:43 PM
That's because the SDK assembly doesn't actually contain any rules. ;)

If you really want to add the rules under your Visual Studio install directory (which I wouldn't really recomment, but ymmv), here's what should work:
  • Bordecal.FxCop.Rules.dll in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\Rules.
  • Bordecal.FxCop.Sdk.dll in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop (i.e.: one folder up from Rules).
HTH,
Nicole
Feb 6, 2013 at 7:46 AM
Edited Feb 6, 2013 at 7:55 AM
Thanks, VS now runs CA.
If we try to install Bordecal in VS install directory, it's because it's on a build server and we hope that it will allow us to integrate Bordecal rules in any of our solutions/products without doing anything else. Perhaps we are wrong ? If you have a guideline for us...

Another problem we got is that, the BC1003 (Dispose dispsable fields) is not detecting a problem that is also missed by the "regular" CA of VS.
No error at all are detected in the following code
//Error CA1001 but No BC1003 error
class MyFirstDisposableContainer
{
    private Stream Stream;

    public MyFirstDisposableContainer() { Stream = new MemoryStream(); }

    public void Foo() { }
}

//No error reported 
class MySecondDisposableContainer
{
    private Stream Stream { get; set; }

    public MySecondDisposableContainer() { Stream = new MemoryStream(); }

    public void Foo() { }
}

//No error reported
class MyThirdDisposableContainer
{
    private Stream _Stream;
    private Stream Stream
    {
        get { return _Stream; }
        set { _Stream = value; }
    }

    public MyThirdDisposableContainer() { Stream = new MemoryStream(); }

    public void Foo() { }
}
Could you help us ?

Jojo