We have a large solution with 50+ projects that started reporting phantom issues in TeamCity as of R# 2018.1.2. By phantom issues I mean issues that are not reported by R# in Visual Studio (or by command-line inspection runner after clearing its cache). The problem is that clearing the cache increases the inspection time from <5 minutes to ~25 minutes.
- R# 2018.1.2 analysis in Visual Studio 2017 finds no issues (below our severity threshold)
- R# 2018.1.2 analysis on TeamCity 2017.2.4 when inspection cache is cleared finds no issues (below our severity threshold) - same sources as Visual Studio case above
- R# 2018.1.2 analysis on TeamCity 2017.2.4 when inspection cache is present from previous build: reports random issues. It seems like inspection crashes for some files which leaves them incompletely analyzed which results in incorrect issue reporting.
Example crash from TeamCity build log:
[12:52:32] : [Step 3/3] ERROR! Invisible analysis failed with exception: c8677f85-f274-492b-b930-dcc117fb44fb(LandWorks.GIS.ToolSet.PET)-71CF9FBC[.NETFramework,Version=v4.6.1]/d:Utilities/f:LWMetesAndBoundsUtils.cs
[12:52:32]W: [Step 3/3] One or more errors occurred. Index was outside the bounds of the array.
[12:52:32]W: [Step 3/3]
[12:52:32]W: [Step 3/3] --- EXCEPTION #1/3 [IndexOutOfRangeException]
[12:52:32]W: [Step 3/3] Message = "Index was outside the bounds of the array."
[12:52:32]W: [Step 3/3] ExceptionPath.1 = Root.InnerException.InnerException
[12:52:32]W: [Step 3/3] ExceptionPath.2 = Root.InnerException.InnerExceptions.#0
[12:52:32]W: [Step 3/3] ClassName = System.IndexOutOfRangeException
[12:52:32]W: [Step 3/3] HResult = COR_E_INDEXOUTOFRANGE=80131508
[12:52:32]W: [Step 3/3] Source = JetBrains.Platform.Core
[12:52:32]W: [Step 3/3] StackTraceString = "
[12:52:32]W: [Step 3/3] at JetBrains.Text.StringBuffer.get_Item(Int32 index)
[12:52:32]W: [Step 3/3] at JetBrains.Text.ProjectedBuffer.get_Item(Int32 index)
[12:52:32]W: [Step 3/3] at JetBrains.Util.StringSearcher.Find(IBuffer buffer, Int32 startOffset, Int32 endOffset)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Psi.Impl.Shared.InjectedPsi.LiteralsInjectedFileContext.LiteralsInjectedElementCollector.InteriorShouldBeProcessed(ITreeNode element, HashSet`1 context)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Psi.RecursiveElementProcessorExtensions.ProcessDescendants[TContext](ITreeNode root, IRecursiveElementProcessor`1 processor, TContext context)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Psi.RecursiveElementProcessorExtensions.ProcessThisAndDescendants[TContext](ITreeNode root, IRecursiveElementProcessor`1 processor, TContext context)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Psi.Impl.Shared.InjectedPsi.IndependentInjectedFileContext.CollectInjectedNodes()
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Psi.Impl.Shared.InjectedPsi.IndependentInjectedFileContext.GetAllInjects()
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Psi.Files.PsiFiles.AppendInjectedFiles(IFile originalFile, Type toLanguage, IReadOnlyCollection`1 providersToBuild, LocalList`1& results)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Psi.Files.PsiFiles.<>c__DisplayClass37_1.<AppendInjectFiles>b__1(IFile domFile)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Psi.CachedPsiValue`1.GetValue[TNode](TNode element, Func`2 calculator)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Psi.Files.PsiFiles.AppendInjectFiles(IPsiSourceFile sourceFile, Type injectedLanguageType, DocumentRange range, LocalList`1& files)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Psi.Files.PsiFiles.GetPsiFiles(IPsiSourceFile sourceFile, Type languageType, DocumentRange range, PsiLanguageCategories categories)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Psi.Files.PsiFiles.GetPsiFiles[TLanguage](IPsiSourceFile sourceFile, PsiLanguageCategories categories)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Daemon.Css.Impl.CssDaemonStageBase.CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Feature.Services.Daemon.DaemonProcessBase.RunStage(IDaemonStage stage, DaemonProcessKind processKind, Action`2 commiter, IContextBoundSettingsStore contextBoundSettingsStore, JetHashSet`1 disabledStages)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Feature.Services.Daemon.DaemonProcessBase.<>c__DisplayClass44_2.<DoHighlighting>g__Stage4(IDaemonStage stage)
[12:52:32]W: [Step 3/3] at JetBrains.Application.Threading.Tasks.TaskBarrier.<>c__DisplayClass22_0.<EnqueueDependentJobs>b__2()
[12:52:32]W: [Step 3/3] at JetBrains.Application.Threading.Tasks.TaskHost.AccessViolationCatcher(Action action)
[12:52:32]W: [Step 3/3] at JetBrains.Application.Threading.Tasks.TaskHost.<>c__DisplayClass33_0.<Create>b__1(Object state)
[12:52:32]W: [Step 3/3] at System.Threading.Tasks.Task.Execute()
[12:52:32]W: [Step 3/3] "
[12:52:32]W: [Step 3/3]
[12:52:32]W: [Step 3/3] --- Outer ---
[12:52:32]W: [Step 3/3]
[12:52:32]W: [Step 3/3] --- EXCEPTION #2/3 [AggregateException]
[12:52:32]W: [Step 3/3] Message = "One or more errors occurred."
[12:52:32]W: [Step 3/3] ExceptionPath = Root.InnerException
[12:52:32]W: [Step 3/3] ClassName = System.AggregateException
[12:52:32]W: [Step 3/3] InnerException = "Exception #1 at Root.InnerException.InnerException"
[12:52:32]W: [Step 3/3] HResult = COR_E_EXCEPTION=80131500
[12:52:32]W: [Step 3/3] Source = JetBrains.Platform.Core
[12:52:32]W: [Step 3/3] InnerExceptions.#0 = "Exception #1 at Root.InnerException.InnerException"
[12:52:32]W: [Step 3/3] StackTraceString = "
[12:52:32]W: [Step 3/3] at JetBrains.Application.Threading.Tasks.TaskBarrier.DisposeUnmanagedResources()
[12:52:32]W: [Step 3/3] at JetBrains.Util.SafeDisposable.DisposeInternal()
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Feature.Services.Daemon.DaemonProcessBase.<>c__DisplayClass44_1.<DoHighlighting>b__2()
[12:52:32]W: [Step 3/3] at JetBrains.Application.Notifications.PerformanceUserNotifications.WithPerformanceNotification(TimeSpan performanceThreshold, String title, String body, Action action)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Feature.Services.Daemon.DaemonProcessBase.DoHighlighting(DaemonProcessKind processKind, Action`1 commiter, IContextBoundSettingsStore contextBoundSettingsStore, Action onFastStagesCompleted)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Feature.Services.Daemon.DaemonProcessBase.DoHighlighting(DaemonProcessKind processKind, Action`1 commiter, Action onFastStagesCompleted)
[12:52:32]W: [Step 3/3] at JetBrains.ReSharper.Daemon.SolutionAnalysis.SolutionAnalysisServiceImpl.AnalyzeInvisibleFile(IPsiSourceFile file)
[12:52:32]W: [Step 3/3] at JetBrains.CommandLine.InspectCode.Unattended.InspectCodeRunner.<>c__DisplayClass17_0.<ExecuteSWEAUnderProgress>b__1()
[12:52:32]W: [Step 3/3] at JetBrains.Util.Logging.Logger.CatchButOperationCanceledException(Action action)
[12:52:32]W: [Step 3/3] "
[12:52:32]W: [Step 3/3]
[12:52:32]W: [Step 3/3] --- Outer ---
[12:52:32]W: [Step 3/3]
[12:52:32]W: [Step 3/3] --- EXCEPTION #3/3 [LoggerException]
[12:52:32]W: [Step 3/3] Message = "One or more errors occurred."
[12:52:32]W: [Step 3/3] ExceptionPath = Root
[12:52:32]W: [Step 3/3] ClassName = JetBrains.Util.LoggerException
[12:52:32]W: [Step 3/3] InnerException = "Exception #2 at Root.InnerException"
[12:52:32]W: [Step 3/3] HResult = COR_E_APPLICATION=80131600
[12:52:32]W: [Step 3/3] StackTraceString = "
[12:52:32]W: [Step 3/3] at JetBrains.Util.Logging.Logger.LogException(Exception ex)
[12:52:32]W: [Step 3/3] at JetBrains.Util.Logging.Logger.CatchButOperationCanceledException(Action action)
[12:52:32]W: [Step 3/3] at JetBrains.Application.Progress.ProgressIndicatorExtensions.StartStop(IProgressIndicator progress, Int32 totalWorkUnits, String taskName, Action action)
[12:52:32]W: [Step 3/3] at JetBrains.CommandLine.InspectCode.Unattended.InspectCodeRunner.ExecuteSWEAUnderProgress(IProgressIndicator progress)
[12:52:32]W: [Step 3/3] at JetBrains.CommandLine.InspectCode.Unattended.InspectCodeRunner.<ExecuteSWEA>b__16_2(IProgressIndicator indicator)
[12:52:32]W: [Step 3/3] at JetBrains.Threading.ReentrancyGuard.Execute[TState,TResult](String name, TState state, Func`2 func)
[12:52:32]W: [Step 3/3] at JetBrains.CommandLine.InspectCode.Unattended.InspectCodeRunner.<>c__DisplayClass16_0.<ExecuteSWEA>b__1(IProgressIndicator progress)
[12:52:32]W: [Step 3/3] at JetBrains.CommandLine.Common.Console.BatchTool.Progress.ToolTaskExecutor.ExecuteTask(String taskName, TaskCancelable cancelable, Action`1 task)
[12:52:32]W: [Step 3/3] at JetBrains.CommandLine.InspectCode.Unattended.InspectCodeRunner.ExecuteSWEA()
[12:52:32]W: [Step 3/3] at JetBrains.CommandLine.InspectCode.Unattended.InspectCodeRunner.Run(IEnumerable`1 inspectScope, IProjectFile[] files, InspectCodeOutputFormat format, Boolean useAbsolutePaths, FileSystemPath outputFile)
[12:52:32]W: [Step 3/3] at JetBrains.CommandLine.InspectCode.Unattended.InspectCodeProductMain.Main(Lifetime lifetime, IThreading invocator, IComponentContainer container, IShellLocks shellLocks, ILogger logger, IInspectCodeSettings settings, IProductCommandLineArguments argumentsRaw)
[12:52:32]W: [Step 3/3] at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
[12:52:32]W: [Step 3/3] at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
[12:52:32]W: [Step 3/3] at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[12:52:32]W: [Step 3/3] at JetBrains.Application.Environment.RunsPublicStaticIntMain.<>c__DisplayClass0_0.<.ctor>b__0()
[12:52:32]W: [Step 3/3] at JetBrains.Util.Logging.Logger.Catch(Action action)
[12:52:32]W: [Step 3/3] at JetBrains.Threading.JetDispatcher.Closure.Execute()
[12:52:32]W: [Step 3/3] at JetBrains.Util.Concurrency.WinJetDispatcher.ProcessQueue(Int32 nMinBucket)
[12:52:32]W: [Step 3/3] at System.Windows.Threading.DispatcherOperation.InvokeDelegateCore()
[12:52:32]W: [Step 3/3] at System.Windows.Threading.DispatcherOperation.InvokeImpl()
[12:52:32]W: [Step 3/3] at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
[12:52:32]W: [Step 3/3] at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
[12:52:32]W: [Step 3/3] at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
[12:52:32]W: [Step 3/3] at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
[12:52:32]W: [Step 3/3] at System.Windows.Threading.DispatcherOperation.Invoke()
[12:52:32]W: [Step 3/3] at System.Windows.Threading.Dispatcher.ProcessQueue()
[12:52:32]W: [Step 3/3] at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
[12:52:32]W: [Step 3/3] at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
[12:52:32]W: [Step 3/3] at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
[12:52:32]W: [Step 3/3] at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
[12:52:32]W: [Step 3/3] at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
[12:52:32]W: [Step 3/3] at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
[12:52:32]W: [Step 3/3] at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
[12:52:32]W: [Step 3/3] at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
[12:52:32]W: [Step 3/3] at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
[12:52:32]W: [Step 3/3] at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
[12:52:32]W: [Step 3/3] at JetBrains.DataFlow.Lifetimes.Using(Action`1 ?)
[12:52:32]W: [Step 3/3] at JetBrains.Application.Environment.IJetHostEx.RunHostMessageLoop(IComponentContainer containerEnv)
[12:52:32]W: [Step 3/3] at JetBrains.Application.Environment.HostParameters.JetHostParametersCaller.RunMainLoop(ComponentContainer containerEnv)
[12:52:32]W: [Step 3/3] at JetBrains.Application.Environment.JetEnvironment.InternalRun(JetHostParametersCaller host, ComponentContainer containerEnv)
[12:52:32]W: [Step 3/3] at JetBrains.Application.Environment.JetEnvironment.CreateAndRun(Full hostparams)
[12:52:32]W: [Step 3/3] at JetBrains.CommandLine.Common.Console.Application.CommandLineProgram.Main(Assembly assembly, Type environmentZoneType, HostInfo hostInfo, IProductInfo productInfo, String[] args)
[12:52:32]W: [Step 3/3] at JetBrains.CommandLine.Common.Console.Application.CommandLineProgram.Run[TZone,TProductInfo](String productHostShortName, String[] args)
[12:52:32]W: [Step 3/3] at JetBrains.CommandLine.InspectCode.InspectCodeProgram.Main(String[] args)
[12:52:32]W: [Step 3/3] "