Program: 130395
Project: 130395
Buggy source:
public static void addTypesForUsing(final CompletionParameters parameters,final CompletionResultSet result,final InheritorsHolder inheritorsHolder){
  final PrefixMatcher matcher=result.getPrefixMatcher();
  final CSharpReferenceExpression parent=(CSharpReferenceExpression)parameters.getPosition().getParent();
  final Project project=parent.getProject();
  final GlobalSearchScope resolveScope=parent.getResolveScope();
  final DotNetShortNameSearcher shortNameSearcher=DotNetShortNameSearcher.getInstance(project);
  final IdFilter projectIdFilter=new GlobalSearchScopeFilter(resolveScope);
  final boolean insideUsing=PsiTreeUtil.getParentOfType(parent,CSharpUsingListChild.class) != null;
  final Set<String> names=new THashSet<String>(1000);
  shortNameSearcher.collectTypeNames(new Processor<String>(){
    private int count=0;
    @Override public boolean process(    String key){
      if (count++ % 512 == 0) {
        ProgressManager.checkCanceled();
      }
      if (matcher.prefixMatches(key)) {
        names.add(key);
      }
      return true;
    }
  }
,resolveScope,projectIdFilter);
  int i=0;
  for (  String key : names) {
    if (i++ % 512 == 0) {
      ProgressManager.checkCanceled();
    }
    shortNameSearcher.collectTypes(key,resolveScope,projectIdFilter,new Processor<DotNetTypeDeclaration>(){
      @Override @RequiredReadAction public boolean process(      DotNetTypeDeclaration typeDeclaration){
        if (inheritorsHolder.alreadyProcessed(typeDeclaration)) {
          return true;
        }
        consumeType(parameters,parent,result,insideUsing,typeDeclaration);
        return true;
      }
    }
);
  }
}

Fixed version (ground truth):
@RequiredReadAction public static void addTypesForUsing(final CompletionParameters parameters,final CompletionResultSet result,final InheritorsHolder inheritorsHolder){
  final PrefixMatcher matcher=result.getPrefixMatcher();
  final CSharpReferenceExpression parent=(CSharpReferenceExpression)parameters.getPosition().getParent();
  final Project project=parent.getProject();
  final GlobalSearchScope resolveScope=parent.getResolveScope();
  final DotNetShortNameSearcher shortNameSearcher=DotNetShortNameSearcher.getInstance(project);
  final IdFilter projectIdFilter=new GlobalSearchScopeFilter(resolveScope);
  final boolean insideUsing=PsiTreeUtil.getParentOfType(parent,CSharpUsingListChild.class) != null;
  final Set<String> names=new THashSet<String>(1000);
  shortNameSearcher.collectTypeNames(new Processor<String>(){
    private int count=0;
    @Override public boolean process(    String key){
      if (count++ % 512 == 0) {
        ProgressManager.checkCanceled();
      }
      if (matcher.prefixMatches(key)) {
        names.add(key);
      }
      return true;
    }
  }
,resolveScope,projectIdFilter);
  final Set<DotNetTypeDeclaration> targets=new THashSet<DotNetTypeDeclaration>(names.size());
  int i=0;
  for (  String key : names) {
    if (i++ % 512 == 0) {
      ProgressManager.checkCanceled();
    }
    shortNameSearcher.collectTypes(key,resolveScope,projectIdFilter,new Processor<DotNetTypeDeclaration>(){
      @Override @RequiredReadAction public boolean process(      DotNetTypeDeclaration typeDeclaration){
        if (inheritorsHolder.alreadyProcessed(typeDeclaration)) {
          return true;
        }
        targets.add(typeDeclaration);
        return true;
      }
    }
);
  }
  i=0;
  for (  DotNetTypeDeclaration target : targets) {
    if (i++ % 512 == 0) {
      ProgressManager.checkCanceled();
    }
    consumeType(parameters,parent,result,insideUsing,target);
  }
}