Bug 4662 - Cyclic references crash MD type system
Summary: Cyclic references crash MD type system
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: unspecified
Hardware: PC Mac OS
: High normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-04-26 06:24 UTC by Paul Sinnema
Modified: 2012-05-07 11:28 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Crash information (75.34 KB, text/plain)
2012-04-26 06:24 UTC, Paul Sinnema
Details
Solution with a cyclic reference (8.66 KB, application/zip)
2012-05-03 20:07 UTC, Mikayla Hutchinson [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Paul Sinnema 2012-04-26 06:24:25 UTC
Created attachment 1750 [details]
Crash information

MonoDevelop crashes when a clean is done. I don't understand how it happened but somehow I (or MonoDevelop) added a circular reference to the project (My Project MCTabular had a reference to itself). During the clean of the project MonoDevelop crashes without warning. I attached the crash information. The build failed (of cource) with the correct error message (circular references are not allowed).

Regards
Paul
Comment 1 Mikayla Hutchinson [MSFT] 2012-04-26 14:56:21 UTC
Looks like a stack overflow.
Comment 2 Mikayla Hutchinson [MSFT] 2012-05-03 18:07:29 UTC
I created a project with a cyclic reference and I could not reproduce the issue. Do you have a project we could test?
Comment 3 Mikayla Hutchinson [MSFT] 2012-05-03 20:07:01 UTC
Created attachment 1803 [details]
Solution with a cyclic reference

Here's a solution with a cyclic reference. It didn't crash on clean, but after I closed it again, it now crashes every time I try to load it.
Comment 4 Mikayla Hutchinson [MSFT] 2012-05-06 17:28:01 UTC
Here are the repeating frames:

ICSharpCode.NRefactory.CSharp.dll!ICSharpCode.NRefactory.CSharp.CSharpProjectContent.CreateCompilation() Line 94 + 0x22 bytes
MonoDevelop.Ide.dll!MonoDevelop.Ide.TypeSystem.TypeSystemService.ProjectContentWrapper.Compilation.get() Line 664 + 0x1a bytes
MonoDevelop.Ide.dll!MonoDevelop.Ide.TypeSystem.TypeSystemService.UnresolvedAssemblyDecorator.assembly.get() Line 581 + 0xd bytes
MonoDevelop.Ide.dll!MonoDevelop.Ide.TypeSystem.TypeSystemService.UnresolvedAssemblyDecorator.Resolve(ICSharpCode.NRefactory.TypeSystem.ITypeResolveContext context) Line 628 + 0x9 bytes
ICSharpCode.NRefactory.dll!ICSharpCode.NRefactory.TypeSystem.Implementation.SimpleCompilation.SimpleCompilation(ICSharpCode.NRefactory.TypeSystem.ISolutionSnapshot solutionSnapshot, ICSharpCode.NRefactory.TypeSystem.IUnresolvedAssembly mainAssembly, System.Collections.Generic.IEnumerable<ICSharpCode.NRefactory.TypeSystem.IAssemblyReference> assemblyReferences) Line 71 + 0xf bytes
ICSharpCode.NRefactory.CSharp.dll!ICSharpCode.NRefactory.CSharp.CSharpProjectContent.CreateCompilation() Line 94 + 0x22 bytes
MonoDevelop.Ide.dll!MonoDevelop.Ide.TypeSystem.TypeSystemService.ProjectContentWrapper.Compilation.get() Line 664 + 0x1a bytes
MonoDevelop.Ide.dll!MonoDevelop.Ide.TypeSystem.TypeSystemService.UnresolvedAssemblyDecorator.assembly.get() Line 581 + 0xd bytes
MonoDevelop.Ide.dll!MonoDevelop.Ide.TypeSystem.TypeSystemService.UnresolvedAssemblyDecorator.Resolve(ICSharpCode.NRefactory.TypeSystem.ITypeResolveContext context) Line 628 + 0x9 bytes
ICSharpCode.NRefactory.dll!ICSharpCode.NRefactory.TypeSystem.Implementation.SimpleCompilation.SimpleCompilation(ICSharpCode.NRefactory.TypeSystem.ISolutionSnapshot solutionSnapshot, ICSharpCode.NRefactory.TypeSystem.IUnresolvedAssembly mainAssembly, System.Collections.Generic.IEnumerable<ICSharpCode.NRefactory.TypeSystem.IAssemblyReference> assemblyReferences) Line 71 + 0xf bytes
Comment 5 Mike Krüger 2012-05-06 17:37:07 UTC
The bug was reported against 2.8.8.4 - there was no 'type system' there. 

But y, it's a bug - but why are cyclic references allowed by the project system at all ?
Comment 6 Mike Krüger 2012-05-07 02:04:04 UTC
fixed in the type system - but this is something that should be done in the project system. Otherwise each consumer needs a cyclic check.

Project.GetReferencedItems <- should never give a cyclic ref.
Comment 7 Mikayla Hutchinson [MSFT] 2012-05-07 11:00:36 UTC
MD doesn't allow cyclic references to be created, but they can exist in hand-edited csproj files. The build system explicitly for cyclic references before recursing, to prevent stack overflows. I'm not sure where we could pre-check, maybe during project load/add?
Comment 8 Mike Krüger 2012-05-07 11:28:56 UTC
yes I know that it doesn't support it 
(I think my wife implemented the topological sort some years back ^^ - I should really try to get her interrested in md again.)

But it would be better if the project system would've a semantic layer on top that makes project handling easier. Atm the project system is like the old 'dom' it's a thin layer on top of the msbuild files.