How to debug Xcode: "An internal error occurred. Source editor functionality is limited"

Does anyone recognize the below stack and know what might be causing that
particular crash? Is there any way to log what file the SourceKitService is
working on, so I can see what it's doing before the crash?

After manually going through all my code and individually adding files back
to the project I've found (fingers crossed!) a fix. I don't understand all
the conditions neccessary, but the problem is related to defining class
extensions in files separate from where the class is originally defined.

So I didn't change any code to fix the problem, but I did move a number of
class extensions out of separate files and just append the extensions text
to the end of the original file where the class was defined.

Hope this helps someone to avoid all the fun I just went through!

Jesse

If you can reduce this down to a small test case, and especially if you get the same crash when you try to compile your code, it'd be very helpful if you could file a bug at bugs.swift.org. The compiler's repository has a big folder full of examples that crash it, and we do get around to fixing them!

···

On Apr 7, 2017, at 11:21 AM, Jesse Grosjean via swift-users <swift-users@swift.org> wrote:

Does anyone recognize the below stack and know what might be causing that
particular crash? Is there any way to log what file the SourceKitService is
working on, so I can see what it's doing before the crash?

After manually going through all my code and individually adding files back to the project I've found (fingers crossed!) a fix. I don't understand all the conditions neccessary, but the problem is related to defining class extensions in files separate from where the class is originally defined.

So I didn't change any code to fix the problem, but I did move a number of class extensions out of separate files and just append the extensions text to the end of the original file where the class was defined.

Hope this helps someone to avoid all the fun I just went through!

--
Brent Royal-Gordon
Architechies

Ok, I've got a pretty short test case that I've posted here:

It doesn't crash the compiler, but it consistently crashes SourceKitService
when you try to add a function to the extension.

Jesse

···

On Fri, Apr 7, 2017 at 11:58 PM Brent Royal-Gordon <brent@architechies.com> wrote:

On Apr 7, 2017, at 11:21 AM, Jesse Grosjean via swift-users < > swift-users@swift.org> wrote:

Does anyone recognize the below stack and know what might be causing that
particular crash? Is there any way to log what file the SourceKitService is
working on, so I can see what it's doing before the crash?

After manually going through all my code and individually adding files
back to the project I've found (fingers crossed!) a fix. I don't understand
all the conditions neccessary, but the problem is related to defining class
extensions in files separate from where the class is originally defined.

So I didn't change any code to fix the problem, but I did move a number of
class extensions out of separate files and just append the extensions text
to the end of the original file where the class was defined.

Hope this helps someone to avoid all the fun I just went through!

If you can reduce this down to a small test case, and especially if you
get the same crash when you try to compile your code, it'd be very helpful
if you could file a bug at bugs.swift.org. The compiler's repository has
a big folder full of examples that crash it, and we do get around to fixing
them!

--
Brent Royal-Gordon
Architechies