Can I disable analysis on certain files without opening them?

I would like to enable solution wide analysis but disable it for a handful of specific files.  And more specifically, I'd like to disable the analysis on those files without actually opening the files or running the full analysis first.

We have a situation where we have binary data (encrypted xml) in a file with an xml extension attached to the project.  The files are up to 5MG.  R# attempts to analyze them and never gives up, generating 250K+ warnings/errors per file.  This ultimately tanks the IDE performance, including OutOfMemoryExceptions.  You can reproduce this problem by giving any zip file an xml extension and attaching it to a sample .csproj.  The memory management wrapper did help with the OutOfMemoryExceptions (thanks) but not CPU usage.

I have found that if I bring up the Errors In Solution pane I can right click and ignore errors that way.  Unfortunately this takes a very long time as first the files need to be analyzed, and then the act of ignoring the errors itself runs for a long time (20 minutes so far, it's still running).  Ctrl+8 Disable Code Analysis in Current File requires the file to be open first, and these files don't open (VS xml editor probably chokes on the binary data in a similar fashion, but gives up far sooner and the files just don't open)  I was able to open the files via Open With... and choosing Xml Editor with Encoding, and then clicking through a few dialogs.

Perhaps the R# options files created alongside my projects and solutions can be hand edited to add the ignore entries?  I haven't looked into that but I will.  I found the <SkipFilesAndFolders> element in the .resharper file at the solution level.  Hand editing this file seems to accomplish what I need.

Thanks for any assistance you can provide.

2 comments

I have some more information on what's happening.  It's still a (big) problem for me.

Sometimes R# parses the binary xml files even though they are explicitely ignored in the settings file.  The conditions where this happens seems to be 1) sometimes when first opening the solution and 2) when the files change, like when my external build script recreates them.

My hypothesis is that R# parses them and builds it's cache before it ignores them.  And when files change, it still analyzes them but does not present the results.  Can someone comment on that?

By the way, they are attached to the project as embedded resource files, like so:

    <EmbeddedResource Include="..\..\..\Bin\Utilities\Output\PolicyServerUpdateFiles.xml">
      <Link>Resources\PolicyServerUpdateFiles.xml</Link>
    </EmbeddedResource>

Not sure if that's useful to know or not.

My current workaround is to close VS before every build, and then delete my binary xml files before opening it.  This isn't ideal as I can't do any VS related tasks while the external build runs.  Also, just letting the analysis complete isn't viable as it takes a really long time and more often than not results in OutOfMem errors (less of them that before I go your mem management wrapper, but they still happen).

So, the feedback I would like from you is "how can I completely stop analysis of certain files?".

If there is more or better feedback I can give you (can't send you my project though, sorry) please let me know.

Thanks,
Josh

0

Hello,

There are two stages, parsing and analysis. The parsing is performed on every
change, and analysis runs when the file is opened or when Solution Analysis
inspects the file. I think our options govern the analysis part only, and
do not affect the parsing stage.

So, if the parsing falls off the memory limits, we're in trouble. I'm not
aware of any possible workarounds on the R# side, but there could be some
on Visual Studio side.

From your description it seems that you do not need to include the file in
Visual Studio solution (as you can't use it in Visual Studio because of its
size), and it's not actually an XML file. So I can think of two workarounds:

1) Change the file extension to something like .bin so that R# skipps it
when parsing. If your embedded resource built from this file has to have
a specific name (eg ending with .xml), you could specify the resource name
explicitly, as the resource name does not have to match the file name or
default namespace and folder sturcture, or whatever else, and can be freely
overridden with a string of your liking.

element
into it.

Hope this helps for now.


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0

Please sign in to leave a comment.