System.UnauthorizedAccessException

We have two issues, which we think may be related with the NDependAPI

Firstly, the IIS worker process in which the program we're writing uses the NDepend API, runs on 4Gb+ of memory when the first request hits, and it goes up by around ~100-400mb every subsequent request.

Secondly, any requests after our first one result in the generation of a large number of System.UnauthorizedAccessExceptions to files with names like CQLinqAsm_[GUID].dll

Looking at C:WINDOWSTEMP there are a bunch of files, such as wz1p0cca.out , or ws1ju0z0.err and suchlike. Opening the files, they reference some .cs files too, but they are nowhere to be seen.

Jumping to conclusions, but this feels, on the face of it, as though something isn't being disposed properly, and locks on those files are being held. This could account for both the large memory footprint and the exceptions on anything but the first request.

However, looking at the NDepend API docs, I can't see anything which implements IDisposable , which suggests this may not be the case.

Reproducing the bug isn't hard, but a lengthly process, so I'll attempt to describe the flow of how we are using MVC/NDepend API.

  • After creating the MVC project, referencing the NDepend API, and loading it (noting the steps described here), we request results via an AJAX request to a WebAPI controller.

  • This controller then sends a request to a service class, which in turn sends it to our NDepend wrapper library.

  • In our wrapper library, the flow is much like the Getting Started program, except that we load the rules directly from the NDepend proj file:

    -> Load the Project, and attach the Coverage File (Coverage is automated through our Team City)

    -> Get the Analysis Results ( IAnalysisResults ), either by calling IAnalysisResultRef.Load() or running IProject.RunAnalysis() .

    -> Compile the Queries (by NDepend.Helpers.IEnumerable<string>.CompileMany() )

    -> Compute JustMyCode (by IProject.CodeQueries.CodeQueriesSet.ComputerJustMyCode() )

    -> Run the Queries (by IQueryCompiled.IQueryCompiledSuccess.Execute() )

    -> Return the results for rendering on the page

  • On first run everything works fine, however, should we refresh the page, as soon as it reaches NDepend.Helpers.IEnumerable<string>.CompileMany() , it begins generating System.UnauthorizedAccessExceptions.

    We could be horribly wrong, but anyone with some insight would be a godsend.

    链接地址: http://www.djcxy.com/p/37714.html

    上一篇: 分析后没有依赖关系图/指标

    下一篇: System.UnauthorizedAccessException的