Errors with JetBrains Inspect Code 9.1.3 in SonarQ

2019-06-09 00:00发布

问题:

I encounter errors using Inspect Code 9.1.3 (last version of JetBrains ReSharper Command Line Tool) with SonarQube 4.3.3.

1: "The remote name could not be resolved: 'www.jetbrains.com'"

OK, my server is offline and I cannot change that (enterprise policy)...

2: "Unknown C# language level: Default"

No hint for this one... My solution contains .NET 3.5 and .NET 4.5 C# projects (I'm using the sonar plugin "Analysis Bootstrapper For Visual Studio Projects")

How can I configure my SonarQube/sonar-runner/sonar-project to avoid this errors? Thanks for your help!

Here are some trace logs extracts:

14:12:23.940 INFO  - --- EXCEPTION #1/2 [WebException]
14:12:23.975 INFO  - Message = "The remote name could not be resolved: 'www.jetbrains.com'"
14:12:23.975 INFO  - ExceptionPath = Root.InnerException
14:12:23.976 INFO  - ClassName = System.Net.WebException
14:12:23.976 INFO  - HResult = COR_E_INVALIDOPERATION=80131509
14:12:23.977 INFO  - Source = System
14:12:23.978 INFO  - StackTraceString = "
14:12:23.978 INFO  -   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
14:12:23.978 INFO  -      at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
14:12:23.979 INFO  -      at System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)
14:12:23.979 INFO  - "
14:12:23.979 INFO  - 
14:12:23.980 INFO  - --- Outer ---
14:12:23.980 INFO  - 
14:12:23.980 INFO  - --- EXCEPTION #2/2 [LoggerException]
14:12:23.981 INFO  - Message = "The remote name could not be resolved: 'www.jetbrains.com'"
14:12:23.981 INFO  - ExceptionPath = Root
14:12:23.981 INFO  - ClassName = JetBrains.Util.LoggerException
14:12:23.981 INFO  - InnerException = "Exception #1 at Root.InnerException"
14:12:23.982 INFO  - HResult = COR_E_APPLICATION=80131600
14:12:23.983 INFO  - StackTraceString = "
14:12:23.983 INFO  -   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
14:12:23.983 INFO  -      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
14:12:23.983 INFO  -      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
14:12:23.984 INFO  -      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
14:12:23.984 INFO  -      at System.Windows.Threading.DispatcherOperation.Invoke()
14:12:23.984 INFO  -      at System.Windows.Threading.Dispatcher.ProcessQueue()
14:12:23.984 INFO  -      at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
14:12:23.986 INFO  -      at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
14:12:23.986 INFO  -      at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
14:12:23.986 INFO  -      at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
14:12:23.986 INFO  -      at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
14:12:23.986 INFO  -      at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
14:12:23.987 INFO  -      at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
14:12:23.987 INFO  -      at JetBrains.Interop.WinApi.User32Dll.DispatchMessageW(MSG* lpmsg)
14:12:23.987 INFO  -      at JetBrains.Interop.WinApi.User32Dll.DispatchMessageW(MSG* lpmsg)
14:12:23.987 INFO  -      at JetBrains.Threading.JetDispatcher.InternalPumpMessagesOnce()
14:12:23.987 INFO  -      at JetBrains.CommandLine.InspectCode.Unattended.InspectCodeProductMain.Main(IThreading invocator, IComponentContainer container, IShellLocks shellLocks, ILogger logger, IInspectCodeSettings settings, IProductCommandLineArguments argumentsRaw)
14:12:23.987 INFO  -      at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
14:12:23.987 INFO  -      at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
14:12:23.988 INFO  -      at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
14:12:23.988 INFO  -      at JetBrains.Application.Environment.RunsPublicStaticIntMain.<>c__DisplayClass7.<.ctor>b__0()
14:12:23.988 INFO  -      at JetBrains.Util.Logging.Logger.Catch(Action action)
14:12:23.988 INFO  -      at JetBrains.Threading.JetDispatcher.Closure.Execute()
14:12:23.988 INFO  -      at JetBrains.Threading.JetDispatcher.ProcessQueue()
14:12:23.988 INFO  -      at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
14:12:23.988 INFO  -      at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
14:12:23.989 INFO  -      at System.Windows.Threading.DispatcherOperation.InvokeImpl()
14:12:23.989 INFO  -      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
14:12:23.989 INFO  -      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
14:12:23.989 INFO  -      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
14:12:23.989 INFO  -      at System.Windows.Threading.DispatcherOperation.Invoke()
14:12:23.989 INFO  -      at System.Windows.Threading.Dispatcher.ProcessQueue()
14:12:23.989 INFO  -      at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
14:12:23.990 INFO  -      at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
14:12:23.990 INFO  -      at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
14:12:23.990 INFO  -      at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
14:12:23.990 INFO  -      at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
14:12:23.990 INFO  -      at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
14:12:23.990 INFO  -      at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
14:12:23.990 INFO  -      at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
14:12:23.991 INFO  -      at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
14:12:23.991 INFO  -      at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
14:12:23.991 INFO  -      at JetBrains.DataFlow.Lifetimes.Using(Action`1 ?)
14:12:23.992 INFO  -      at JetBrains.Application.Environment.IJetHostEx.RunHostMessageLoop(IComponentContainer containerEnv)
14:12:23.992 INFO  -      at JetBrains.Application.Environment.HostParameters.JetHostParametersCaller.RunMainLoop(ComponentContainer containerEnv)
14:12:23.992 INFO  -      at JetBrains.Application.Environment.JetEnvironment.InternalRun(JetHostParametersCaller host, ComponentContainer containerEnv)
14:12:23.992 INFO  -      at JetBrains.Application.Environment.JetEnvironment.CreateAndRun(Full hostparams)
14:12:23.992 INFO  -      at JetBrains.CommandLine.InspectCode.InspectCodeProgram.Main(Assembly assembly, HostInfo hostInfo, String[] args)
14:12:23.993 INFO  -      at JetBrains.CommandLine.InspectCode.InspectCodeProgram.<Main>b__1(RunnerContext ctx)
14:12:23.993 INFO  - "
...
14:12:46.683 INFO  - --- EXCEPTION #1/2 [InvalidOperationException]
14:12:46.683 INFO  - Message = "Unknown C# language level: Default"
14:12:46.683 INFO  - ExceptionPath = Root.InnerException
14:12:46.683 INFO  - ClassName = System.InvalidOperationException
14:12:46.684 INFO  - HResult = COR_E_INVALIDOPERATION=80131509
14:12:46.684 INFO  - Source = JetBrains.ReSharper.Psi.CSharp
14:12:46.684 INFO  - StackTraceString = "
14:12:46.685 INFO  -   at JetBrains.ReSharper.Psi.CSharp.CSharpExtensionMethods.GetCSharpVersion(CSharpLanguageLevel level)
14:12:46.685 INFO  -      at JetBrains.ReSharper.Psi.CSharp.Impl.Tree.AttributeStub.MyConstructorReference.Resolve(IResolveContext resolveContext)
14:12:46.685 INFO  -      at JetBrains.ReSharper.Psi.ExtensionsAPI.Resolve.Managed.ResolveContext.ResolveWithInfoCalculator(IManagedReferenceImpl reference, Object state, IResolveContext resolveContext)
14:12:46.685 INFO  -      at JetBrains.ReSharper.Psi.Impl.Resolve.Managed.CalculationProcess.Get[TKey,TParameter,TValue](CascadingCacheKey cacheKey, TKey key, TParameter param, IResolveContext resolveContext, Func`4 calculator)
14:12:46.685 INFO  -      at JetBrains.ReSharper.Psi.ExtensionsAPI.Resolve.Managed.ResolveContext.ResolveWithInfo(IManagedReference reference)
14:12:46.685 INFO  -      at JetBrains.ReSharper.Daemon.CSharp.Stages.SmartResolverProcess.ScopeResolver.VisitElement(ITreeNode element)
14:12:46.686 INFO  -      at JetBrains.ReSharper.Psi.Resolve.Resolver.ProcessAfterInterior(ITreeNode element)
14:12:46.686 INFO  -      at JetBrains.ReSharper.Daemon.CSharp.Stages.SmartResolverProcess.ScopeResolver.ProcessAfterInterior(ITreeNode element)
14:12:46.686 INFO  -      at JetBrains.ReSharper.Psi.RecursiveElementProcessorExtensions.ProcessDescendantForResolve(IRecursiveElementProcessor processor, ITreeNode descendant)
14:12:46.686 INFO  -      at JetBrains.ReSharper.Psi.ExtensionsAPI.Tree.TreeElement.ProcessDescendantsForResolve(IRecursiveElementProcessor processor)
14:12:46.686 INFO  -      at JetBrains.ReSharper.Psi.RecursiveElementProcessorExtensions.ProcessDescendantForResolve(IRecursiveElementProcessor processor, ITreeNode descendant)
14:12:46.687 INFO  -      at JetBrains.ReSharper.Psi.ExtensionsAPI.Tree.TreeElement.ProcessDescendantsForResolve(IRecursiveElementProcessor processor)
14:12:46.687 INFO  -      at JetBrains.ReSharper.Psi.RecursiveElementProcessorExtensions.ProcessDescendantForResolve(IRecursiveElementProcessor processor, ITreeNode descendant)
14:12:46.687 INFO  -      at JetBrains.ReSharper.Psi.ExtensionsAPI.Tree.TreeElement.ProcessDescendantsForResolve(IRecursiveElementProcessor processor)
14:12:46.687 INFO  -      at JetBrains.ReSharper.Psi.RecursiveElementProcessorExtensions.ProcessDescendantForResolve(IRecursiveElementProcessor processor, ITreeNode descendant)
14:12:46.687 INFO  -      at JetBrains.ReSharper.Psi.ExtensionsAPI.Tree.TreeElement.ProcessDescendantsForResolve(IRecursiveElementProcessor processor)
14:12:46.687 INFO  -      at JetBrains.ReSharper.Psi.RecursiveElementProcessorExtensions.ProcessDescendantForResolve(IRecursiveElementProcessor processor, ITreeNode descendant)
14:12:46.687 INFO  -      at JetBrains.ReSharper.Psi.ExtensionsAPI.Tree.TreeElement.ProcessDescendantsForResolve(IRecursiveElementProcessor processor)
14:12:46.687 INFO  -      at JetBrains.ReSharper.Psi.RecursiveElementProcessorExtensions.ProcessDescendantForResolve(IRecursiveElementProcessor processor, ITreeNode descendant)
14:12:46.687 INFO  -      at JetBrains.ReSharper.Psi.ExtensionsAPI.Tree.TreeElement.ProcessDescendantsForResolve(IRecursiveElementProcessor processor)
14:12:46.688 INFO  -      at JetBrains.ReSharper.Psi.RecursiveElementProcessorExtensions.ProcessDescendantForResolve(IRecursiveElementProcessor processor, ITreeNode descendant)
14:12:46.688 INFO  -      at JetBrains.ReSharper.Psi.ExtensionsAPI.Tree.TreeElement.ProcessDescendantsForResolve(IRecursiveElementProcessor processor)
14:12:46.688 INFO  -      at JetBrains.ReSharper.Psi.Resolve.Resolver.Process(ITreeNode topElement)
14:12:46.688 INFO  -      at JetBrains.Application.Threading.Tasks.TaskHost.<>c__DisplayClass11.<Create>b__e(Object state)
14:12:46.688 INFO  - "
14:12:46.689 INFO  - 
14:12:46.689 INFO  - --- Outer ---
14:12:46.689 INFO  - 
14:12:46.689 INFO  - --- EXCEPTION #2/2 [LoggerException]
14:12:46.689 INFO  - Message = "Unknown C# language level: Default"
14:12:46.689 INFO  - ExceptionPath = Root
14:12:46.689 INFO  - ClassName = JetBrains.Util.LoggerException
14:12:46.690 INFO  - InnerException = "Exception #1 at Root.InnerException"
14:12:46.690 INFO  - HResult = COR_E_APPLICATION=80131600
14:12:46.690 INFO  - StackTraceString = "
14:12:46.690 INFO  -   at System.Threading.Tasks.Task.Execute()
14:12:46.691 INFO  -      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
14:12:46.691 INFO  -      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
14:12:46.691 INFO  -      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
14:12:46.691 INFO  -      at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
14:12:46.691 INFO  -      at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
14:12:46.692 INFO  -      at System.Threading.Tasks.TaskScheduler.TryRunInline(Task task, Boolean taskWasPreviouslyQueued, Object threadStatics)
14:12:46.692 INFO  -      at System.Threading.Tasks.Task.WrappedTryRunInline(TaskScheduler currentScheduler, Object currentSchedulerStatics)
14:12:46.692 INFO  -      at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
14:12:46.692 INFO  -      at JetBrains.Application.Threading.Tasks.TaskBarrier.DisposeUnmanagedResources()
14:12:46.692 INFO  -      at JetBrains.Util.SafeDisposable.DisposeInternal()
14:12:46.693 INFO  -      at JetBrains.ReSharper.Daemon.CSharp.Stages.SmartResolverProcess.Execute(Action`1 committer)
14:12:46.693 INFO  -      at JetBrains.ReSharper.Feature.Services.Daemon.DaemonProcessBase.<>c__DisplayClassc.<DoHighlighting>b__5(IDaemonStage stage)
14:12:46.693 INFO  -      at JetBrains.Application.Threading.Tasks.TaskBarrier.<>c__DisplayClassc.<>c__DisplayClasse.<EnqueueDependentJobs>b__a()
14:12:46.693 INFO  -      at JetBrains.Application.Threading.Tasks.TaskHost.<>c__DisplayClass11.<Create>b__e(Object state)
14:12:46.693 INFO  -      at System.Threading.Tasks.Task.Execute()
14:12:46.694 INFO  -      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
14:12:46.694 INFO  -      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
14:12:46.694 INFO  -      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
14:12:46.694 INFO  -      at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
14:12:46.695 INFO  -      at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
14:12:46.695 INFO  -      at JetBrains.Application.Threading.Tasks.Scheduler.JetSchedulerThread.ThreadPoolProc()
14:12:46.695 INFO  -      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
14:12:46.695 INFO  -      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
14:12:46.695 INFO  -      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
14:12:46.696 INFO  -      at System.Threading.ThreadHelper.ThreadStart()
14:12:46.696 INFO  - "

回答1:

Try installing JB InspectCode 9.2. At least "Unknown C# language level: Default" exception should be fixed there https://youtrack.jetbrains.com/issue/RSRP-442801



回答2:

It sounds like you are facing issues from the JetBrains ReSharper Command Line Tools itselve - which doesn't relate to the SonarQube integration.

Nevertheless, I'd just like to add that the "Analysis Bootstrapper For Visual Studio Projects" plugin is deprecated and that it has been replaced by the "MSBuild SonarQube Runner", which natively integrates with MSBuild.

You can find an example on how to analyze C# project using the ReSharper Command Line Tools & the MSBuild SonarQube Runner here: http://docs.sonarqube.org/display/PLUG/ReSharper+Plugin