Skip to content

Exception when switching projects #1935

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gene-pavlovsky opened this issue Jan 9, 2018 · 6 comments
Open

Exception when switching projects #1935

gene-pavlovsky opened this issue Jan 9, 2018 · 6 comments

Comments

@gene-pavlovsky
Copy link
Contributor

Running FD under VS in debug mode, I'm often (not always) getting exceptions when switching projects (dev project and tests project for it), or checking out another git branch.

Exception: System.InvalidOperationException: 'Collection was modified; enumeration operation may not execute.'
Stack trace:

System.InvalidOperationException occurred
  HResult=0x80131509
  Message=Collection was modified; enumeration operation may not execute.
  Source=<Cannot evaluate the exception source>
  StackTrace:
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at System.Collections.Generic.List`1.Enumerator.MoveNext()
   at HaXeContext.Context.ResolveImport(MemberModel item, MemberList imports) in C:\project\flashdevelop\External\Plugins\HaXeContext\Context.cs:line 834
   at HaXeContext.Context.ResolveImports(FileModel inFile) in C:\project\flashdevelop\External\Plugins\HaXeContext\Context.cs:line 767
   at HaXeContext.Context.ResolveType(String cname, FileModel inFile) in C:\project\flashdevelop\External\Plugins\HaXeContext\Context.cs:line 939
   at ASCompletion.Model.ClassModel.ResolveExtendedType(List`1 extensionList) in C:\project\flashdevelop\External\Plugins\ASCompletion\Model\ClassModel.cs:line 139
   at ASCompletion.Model.ClassModel.ResolveExtends() in C:\project\flashdevelop\External\Plugins\ASCompletion\Model\ClassModel.cs:line 105
   at ASCompletion.Helpers.ASTCache.UpdateClass(ClassModel cls, Dictionary`2 cache) in C:\project\flashdevelop\External\Plugins\ASCompletion\Helpers\ASTCache.cs:line 256
   at ASCompletion.Helpers.ASTCache.<UpdateOutdatedModels>b__10_0() in C:\project\flashdevelop\External\Plugins\ASCompletion\Helpers\ASTCache.cs:line 112
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
@SlavaRa
Copy link

SlavaRa commented Jan 9, 2018

I think I know the problem.

@gene-pavlovsky
Copy link
Contributor Author

Might be a separate issue, but sometimes (when checking out other branches) another exception occurs.
Exception:
Stack trace: System.InvalidOperationException: 'Collection was modified; enumeration operation may not execute.'

System.InvalidOperationException occurred
  HResult=0x80131509
  Message=Collection was modified; enumeration operation may not execute.
  Source=<Cannot evaluate the exception source>
  StackTrace:
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at System.Collections.Generic.List`1.Enumerator.MoveNext()
   at AS2Context.Context.GetModel(String package, String cname, String inPackage) in C:\project\flashdevelop\External\Plugins\AS2Context\Context.cs:line 655
   at HaXeContext.Context.ResolveType(String cname, FileModel inFile) in C:\project\flashdevelop\External\Plugins\HaXeContext\Context.cs:line 959
   at ASCompletion.Model.ClassModel.ResolveExtendedType(List`1 extensionList) in C:\project\flashdevelop\External\Plugins\ASCompletion\Model\ClassModel.cs:line 139
   at ASCompletion.Model.ClassModel.ResolveExtends() in C:\project\flashdevelop\External\Plugins\ASCompletion\Model\ClassModel.cs:line 105
   at ASCompletion.Helpers.ASTCache.UpdateClass(ClassModel cls, Dictionary`2 cache) in C:\project\flashdevelop\External\Plugins\ASCompletion\Helpers\ASTCache.cs:line 256
   at ASCompletion.Helpers.ASTCache.<UpdateCompleteCache>b__11_0() in C:\project\flashdevelop\External\Plugins\ASCompletion\Helpers\ASTCache.cs:line 165
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

@Neverbirth
Copy link
Contributor

I definitely know the problem, but it's not a simple change if wanted to keep performance. There are many cases involved here. Everything could be locked everywhere, but I think that's an unacceptable solution.

@gene-pavlovsky
Copy link
Contributor Author

Well you guys are very clever, you will figure out a solution :)

@Neverbirth
Copy link
Contributor

Neverbirth commented Jan 9, 2018

I created some PR regarding this issue, but it's just a WIP I did before Christmas and couldn't continue yet.

#1936

I will try to add more information later from home regarding all the issues I found, special cases, etc. It may give some ideas, shed some light on some problems, etc.

The main issue here is that a lot of core code in FD was never thought it could run under multi-threaded scenarios, but it's not shown in that PR. The bigger the project the bigger the possibilities for this problem to appear.

@gene-pavlovsky
Copy link
Contributor Author

@Neverbirth you can finish it, I have faith! We together!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants