InspectCode Exception

Using InspectCode 2023.1.1 on one of my project will generate the following output with an exception.
I'm using ReSharper C++ in Visual Studio 2022 without problems on the same solution, but when I try to execute inspectcode with the same solution and the exported settings from VisualStudio 2022, I got the exception.

inspectcode --config=inspectcode.cfg -o=output.xml myproject.sln
JetBrains Inspect Code 2023.1.1
Running on x64 OS in x64 architecture, .NET Framework 4.8.9139.0 under Microsoft Windows 10.0.22621
Custom settings layer is mounted. Used file D:\temp\ReSharperCpp.DotSettings
Using toolset version 17.0 from "C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64"
Configuration: Release, Platform: x64
Analyzing files

Analyzing ... 
Analyzing targetver.h
Inspecting ...
...

IHighlighting.ToolTip should match ToolTipFormatString. message = 'Cannot substitute template argument 'param' for type template parameter '_Tuple'', myFormatString = 'cannot substitute {0} for {1}'

--- EXCEPTION #1/3 [AssertionException]
Message = "IHighlighting.ToolTip should match ToolTipFormatString. message = 'Cannot substitute template argument 'param' for type template parameter '_Tuple'', myFormatString = 'cannot substitute {0} for {1}'"
ExceptionPath = Root.InnerException.InnerException
ClassName = JetBrains.Diagnostics.Assertion+AssertionException
HResult = COR_E_EXCEPTION=80131500
Source = JetBrains.Lifetimes
StackTraceString = "
  à JetBrains.Diagnostics.Assertion.Fail(String message) in Fail.il:line IL_0006 mvid 21AB
     à JetBrains.ReSharper.Daemon.SolutionAnalysis.IssueClass.ExtractFormatStringArguments(String message, IssueStrings issueStrings) in ExtractFormatStringArguments.il:line IL_001F mvid 8E77
     à JetBrains.ReSharper.Daemon.SolutionAnalysis.IssueClasses.BuildIssues(IEnumerable`1 highlightings, IPsiSourceFile psiSourceFile, IContextBoundSettingsStore settingsStore) in BuildIssues.il:line IL_0000 mvid 8E77
     à JetBrains.ReSharper.Daemon.SolutionAnalysis.InspectCode.InspectCodeDaemon.DoHighlighting(DaemonProcessKind daemonProcessKind, Action`1 issueConsumer) in DoHighlighting.il:line IL_0060 mvid 8E77
     à JetBrains.ReSharper.Daemon.SolutionAnalysis.InspectCode.InspectCodeFinder.<>c__DisplayClass9_2.<RunFindCodeIssues>b__2() in InspectCodeFinder.il:line IL_0129 mvid 8E77
     à JetBrains.Application.Threading.Tasks.TaskHost.AccessViolationCatcher(Action action) in AccessViolationCatcher.il:line IL_0000 mvid A7F4
     à JetBrains.Application.Threading.Tasks.TaskHost.<>c__DisplayClass38_0`1.<Create>b__0(Object state) in TaskHost.il:line IL_00B4 mvid A7F4
     à System.Threading.Tasks.Task`1.InnerInvoke() in InnerInvoke.il:line IL_002B mvid 4B76
     à System.Threading.Tasks.Task.Execute() in Execute.il:line IL_0010 mvid 4B76
"

--- Outer ---

--- EXCEPTION #2/3 [AggregateException]
Message = "Une ou plusieurs erreurs se sont produites."
ExceptionPath = Root.InnerException
ClassName = System.AggregateException
InnerException = "Exception #1 at Root.InnerException.InnerException"
HResult = COR_E_EXCEPTION=80131500
Source = JetBrains.Platform.Core
InnerExceptions.#0 = "Exception #1 at Root.InnerException.InnerException"
StackTraceString = "
  à JetBrains.Application.Threading.Tasks.TaskBarrier.WaitAll() in WaitAll.il:line IL_0161 mvid A7F4
     à JetBrains.Util.SafeDisposable.DisposeInternal() in DisposeInternal.il:line IL_0013 mvid A7F4
     à JetBrains.ReSharper.Daemon.SolutionAnalysis.InspectCode.InspectCodeFinder.<>c__DisplayClass9_1.<RunFindCodeIssues>b__1() in InspectCodeFinder.il:line IL_0069 mvid 8E77
     à JetBrains.Util.Logging.Logger.CatchButOperationCanceledException(Action action) in CatchButOperationCanceledException.il:line IL_000F mvid A7F4
"

--- Outer ---

--- EXCEPTION #3/3 [LoggerException]
Message = "Une ou plusieurs erreurs se sont produites."
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = "Exception #2 at Root.InnerException"
HResult = COR_E_APPLICATION=80131600
StackTraceString = "
  à JetBrains.Util.LoggerBase.Log(LoggingLevel level, String message, Exception ex) in Log.il:line IL_0034 mvid A7F4
     à JetBrains.Util.Logging.Logger.LogException(Exception ex) in LogException.il:line IL_000C mvid A7F4
     à JetBrains.Util.Logging.Logger.CatchButOperationCanceledException(Action action) in CatchButOperationCanceledException.il:line IL_000F mvid A7F4
     à JetBrains.Application.Progress.ProgressIndicatorExtensions.StartStop(IProgressIndicator progress, Int32 totalWorkUnits, String taskName, Action action) in StartStop.il:line IL_0038 mvid A7F4
     à JetBrains.ReSharper.Daemon.SolutionAnalysis.InspectCode.InspectCodeFinder.<>c__DisplayClass9_0.<RunFindCodeIssues>b__0(IProgressIndicator progress) in InspectCodeFinder.il:line IL_0044 mvid 8E77
     à JetBrains.ReSharperAutomationTools.CommandLine.Common.Console.BatchTool.Progress.ToolTaskExecutor.ExecuteTask(String taskName, TaskCancelable cancelable, Action`1 task) in ExecuteTask.il:line IL_0014 mvid 07B8
     à JetBrains.CommandLine.InspectCode.Unattended.InspectCodeRunner.<>c__DisplayClass20_0.<RunFindCodeIssues>b__0() in InspectCodeRunner.il:line IL_0000 mvid 25A1
     à JetBrains.Util.Concurrency.ExecutionContextEx.<>c__DisplayClass0_0.<Run>b__0(Object _) in ExecutionContextEx.il:line IL_0011 mvid A7F4
     à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in RunInternal.il:line IL_0079 mvid 4B76
     à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in Run.il:line IL_0009 mvid 4B76 or Run.il:line IL_0034 mvid 4B76
     à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) in Run.il:line IL_0009 mvid 4B76 or Run.il:line IL_0034 mvid 4B76
     à JetBrains.Util.Concurrency.ExecutionContextEx.Run(ExecutionContext context, ContextCallback callback, Object state) in Run.il:line IL_0028 mvid A7F4
     à JetBrains.Threading.JetDispatcher.Closure.Execute() in Execute.il:line IL_00F9 mvid A7F4
     à JetBrains.Threading.JetDispatcher.ProcessQueue(Int32 nMinBucket) in ProcessQueue.il:line IL_017E mvid A7F4
     à System.Windows.Threading.DispatcherOperation.InvokeDelegateCore() in InvokeDelegateCore.il:line IL_0012 mvid 967D
     à System.Windows.Threading.DispatcherOperation.InvokeImpl() in InvokeImpl.il:line IL_0062 mvid 967D
     à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in RunInternal.il:line IL_0079 mvid 4B76
     à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in Run.il:line IL_0009 mvid 4B76 or Run.il:line IL_0034 mvid 4B76
     à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) in Run.il:line IL_0009 mvid 4B76 or Run.il:line IL_0034 mvid 4B76
     à MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) in Run.il:line IL_0058 mvid 967D
     à System.Windows.Threading.DispatcherOperation.Invoke() in Invoke.il:line IL_0020 mvid 967D
     à System.Windows.Threading.Dispatcher.ProcessQueue() in ProcessQueue.il:line IL_00F6 mvid 967D
     à System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in WndProcHook.il:line IL_0090 mvid 967D
     à MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in WndProc.il:line IL_0030 mvid 967D
     à MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) in DispatcherCallbackOperation.il:line IL_0036 mvid 967D
     à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) in InternalRealCall.il:line IL_0077 mvid 967D
     à System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) in TryCatchWhen.il:line IL_0002 mvid 967D
     à System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) in LegacyInvokeImpl.il:line IL_00BB mvid 967D
     à MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) in SubclassWndProc.il:line IL_0130 mvid 967D
     à JetBrains.Interop.WinApi.User32Dll.DispatchMessageW(MSG* lpmsg)
     à JetBrains.Interop.WinApi.User32Dll.DispatchMessageW(MSG* lpmsg)
     à JetBrains.Util.Concurrency.WinDispatcherImpl.WindowsDispatcherPlatformSpecific.InternalPumpMessagesOnce() in InternalPumpMessagesOnce.il:line IL_0020 mvid A7F4
     à JetBrains.Util.Concurrency.WinDispatcherImpl.WindowsDispatcherPlatformSpecific.JetBrains.Util.Concurrency.IJetDispatcherPlatformSpecific.Run()
     à JetBrains.Threading.JetDispatcher.RunLoopAction(IJetDispatcherPlatformSpecific staticMethods, TimeSpan timeSpan, Boolean b) in RunLoopAction.il:line IL_0006 mvid A7F4
     à JetBrains.Threading.JetDispatcher.RunAndRestartIfNeeded(TimeSpan timeout, Boolean bThrowOnTimeout, Func`4 runLoopAction) in RunAndRestartIfNeeded.il:line IL_0064 mvid A7F4
     à JetBrains.Threading.JetDispatcher.<>c__DisplayClass36_1.<CreateDispatcherThread>b__1() in JetDispatcher.il:line IL_002F mvid A7F4
     à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in RunInternal.il:line IL_0079 mvid 4B76
     à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in Run.il:line IL_0009 mvid 4B76 or Run.il:line IL_0034 mvid 4B76
     à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) in Run.il:line IL_0009 mvid 4B76 or Run.il:line IL_0034 mvid 4B76
     à System.Threading.ThreadHelper.ThreadStart() in ThreadStart.il:line IL_002A mvid 4B76
"

Inspection report was written to A:\....\output.xml

0
5 comments

Hello,

Sorry about that, I believe it's already fixed in 2023.2. You can try to use the latest 2023.2 EAP CLT from https://www.jetbrains.com/resharper/nextversion/.

0

Hi Igor, I tried the EAP 2 of the CommandLine tools, but I get the same error

0

Sorry, my bad - I've rechecked and the fix didn't get into EAP 2, but should be in EAP 3. EAP 3 got somewhat delayed and should be out early next week. The tracking issue is https://youtrack.jetbrains.com/issue/RSRP-491260

0

I found what generate the exception in my code when calling InspectCode (and the program doesn't compile too).

I write a simplified code to reproduce the issue :

#include <iostream>
#include <tuple>

using MyTuple = std::tuple<int, int, int>;

int main()
{
  MyTuple param = { 42,42,42 };
  constexpr auto size = std::tuple_size<param>::value;
  std::cout << "Hello World! " << size << "\n";
  return 0;
}

I used the name of the variable and not its type in the std::tuple_size template.
Now, I can workaround that exception, but it will be best to report an error than an exception.

0

Pascal Finet Yes, InspectCode reports an error ("Cannot substitute template argument") but fails due to an internal assert. 2023.2 EAP 3 should be out early this week. Please try it and let us know if you still have issues. Thanks!

0

Please sign in to leave a comment.