Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Warnings and messages from static contract checking don't appear in the VS2015 error list #137

Closed
jbcutting opened this issue Jul 15, 2015 · 10 comments

Comments

@jbcutting
Copy link

I've been testing the last two releases in VS2015 RC. I've noticed that while warnings and messages from the static analysis are appearing in the Output window, they do not show up in the Error List window. The messages do still appear in the Error List in VS2013, so this seems to be specific to VS2015.

This is easy to repro. Just create a new console app and add the class below. Turn on static contract checking in the project properties, then build. In the output window, you'll see the following warning, but it won't show up in VS2015's error list (it will if you do the same thing in 2013).

Projects\ConsoleApplication2\Program.cs(20,4): warning : CodeContracts: Missing precondition in an externally visible method. Consider adding Contract.Requires(list != null); for parameter validation

public class Foo
{
    public void DoStuff(List<int> list)
    {
        Console.WriteLine(list.Count);
    }
}
@sharwell
Copy link
Member

Grabbed

@sergey-kolodiy
Copy link

I have installed the latest Code Contracts version from https://visualstudiogallery.msdn.microsoft.com/1ec7db13-3363-46c9-851f-1ce455f66970 and still can reproduce this issue. All the Code Contracts messages are printed to the Task List, not to the Error List. Was this fix published to the production?

@SergeyTeplyakov
Copy link
Contributor

@dr-noise This was fixed in RC that was not published to visualstudio gallery.

@ProductiveRage
Copy link

@SergeyTeplyakov Sorry if this is a silly question but where can a version with this fix be downloaded? The README of this project still links to https://visualstudiogallery.msdn.microsoft.com/1ec7db13-3363-46c9-851f-1ce455f66970 to download from - but that appears to be an old version that still exhibits this problem.

I ask because I'm having the same issue, I think; the Output window shows the CodeContracts output (and includes a warning that I was expecting it to in my simple example) but it doesn't show up in the Error List (VS 2015 Update 2).

@DanTup
Copy link

DanTup commented Jun 19, 2016

@ProductiveRage There's a vsix linked in the latest release here on GH from 26 days ago (I haven't tried it yet though).

@ProductiveRage
Copy link

The vsix link didn't help.. but reinstalling using Contracts.devlab9ts.msi did - working now! :)

@julealgon
Copy link

I just installed CodeContracts from scratch in VS2015 (new, recent Visual Studio installation and all) but I still see the warnings appearing inside the Task List window. I tried uninstalling CodeContracts from control panel and reinstalling but I still get the same behavior.

Am I missing something? I'm trying to use the latest release build, 1.9.10714.2.

@dirkstrauss
Copy link

dirkstrauss commented Feb 10, 2017

@julealgon - Ensure that Perform Static Contract Checking is selected from the Code Contracts properties tab (under your project properties). I also had Check in background checked. You can also download the free eBook. It might help (bottom of page 12): Code Contracts Succinctly

@julealgon
Copy link

@dirkstrauss I copied the files over to another machine and tested again. The warnings were being written correctly in the Errors Window.

I suspect something is wrong in my VS configuration and it could be tied to my login account (some info is now saved on your profile in VS). When I check the extensions pane in Visual Studio, it says I have an out of date version, even though I just installed the latest one from the .msi file:

image

Will take a look to see if I can resolve this as it seems to be a common problem with the CodeContracts installer.

@julealgon
Copy link

Installing the pre-release version v.1.10.20606.1-rc2 seems to have fixed the problem. I can still see the same dialog in Visual Studio Extensions pane, but the warnings are appearing correctly now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants