Solution-wide analysis – deal with post build hidden errors on views

Published by boczek on

There are some hidden errors that won’t be shown after solution build. One of them are errors on views which are shown only when the file is open…
But we won’t open every file to check if there is any error. Fortunately, there are ways to check it with less effort. One of them is to use an external tool or more precisely one feature of ReSharper. The feature is called solution-wide analysis and you can check it on JetBrains site.

But let’s jump to some example…


I’ll show you quick example which can lead you to the silent error that will be deployed on production.
We’ve got view model that is shown below and everything works just fine.

public class AboutViewModel
    public string Info { get; set; }
    public IEnumerable<string> Details { get; set; }

Then we change its property name or set it to “private” instead of “public”. This operation can lead us to few build errors (especially when we do it without using”rename” function), we fix them because of errors in our error view tab and run application (or even deploy on production)…

You haven’t fixed all errors and the view is down.

Solution-wide analysis

It is the Resharper feature that has to be enabled in Code Inspection | Settings page of options or on the right bottom corner of visual studio:

Just be careful on running or rather have it always ON, on large solutions. But running it from time to time, to make sure everything is alright, is ok 🙂

When the analysis is done you can see the number of errors. To get it on more readable you have to click on the bottom right and select “Show Errors View”

And what you get is this beautiful error view with all detected errors and warnings:

Then you can go and fix every error in sequence:)

This solution has one drawback – it takes some time and resources to analyze whole solution. Although after the first time it goes much quicker  I don’t recommend having it always on.

follow us in feedly


Leave a Reply

Your email address will not be published.