Hello,
Trying to figure out why project's documents enumerating code doe not work with Roslyn CTP - September 2012 I'm debugging the sample project form September CTP with name OrganizeSolutionCS. That sample is just simple code iteration through each document for each project in test solution:
private static void Main(string[] args) { // The test solution is copied to the output directory when you build this sample. var workspace = Workspace.LoadSolution(@"TestSolution\Test.sln"); // Take a snapshot of the original solution. var originalSolution = workspace.CurrentSolution; // Declare a variable to store the intermediate solution snapshot at each step. ISolution newSolution = originalSolution; foreach (var project in originalSolution.Projects) { // Note how we can't simply iterate over project.Documents because it will return // IDocument objects from the originalSolution, not from the newSolution. We need to // use the DocumentId (that doesn't change) to look up the corresponding snapshot of // the document in the newSolution. foreach (var documentId in project.DocumentIds) { …
The code looks simple, but it is just ending without accessing any document in the solution. Then I try to debug the project putting the breakpoint in the line whereoriginalSolution.Projects are enumerated, I'm getting the following error message:
An unhandled exception of type 'System.Threading.LockRecursionException' occurred in Roslyn.Services.dll
What is wrong with my Roslyn.Services.dll? How can I make that sample functioning as it is supposed?
Thanks.