Closed jmecosta closed 2 months ago
Can you run the command with logs and share these? dotnet-coverage collect -ll Verbose -l log.txt app.exe
@fhnaseer it looks like verifiable probes are enabled. This should not happen as dotnet-coverage disables in config verifiable probes. What you need to check is why we got it enabled. I think you will not find anything interesting in logs.
@jmecosta This was happening because UseVerifiableInstrumentation
was true by default for dotnet-coverage
. It will be false by default now and hence application will not load Microsoft.VisualStudio.CodeCoverage.Shim
. It will be available in the next release (17.12.4).
You can use following settings with current version to fix this crash.
<?xml version="1.0" encoding="utf-8"?>
<Configuration>
<CodeCoverage>
<UseVerifiableInstrumentation>False</UseVerifiableInstrumentation>
</CodeCoverage>
</Configuration>
Hi,
My application doesnt have any dependencis on Microsoft.VisualStudio.CodeCoverage.Shim, however when running the application in using dotnet-coverage tool i get a crash [20:50:25][Step 7/8] [27.8.2024 20.46.59]: E:\prod\ts-build\BuildDrop\Work\bin_release_x64: dotnet-coverage collect "E:\prod\ts-build\BuildDrop\Work\bin_release_x64\TeklaStructuresLauncher.exe" --output-format xml --output E:\prod\ts-build\BuildDrop\Work\bin_release_x64\cov-FTC_90005-1.xml [20:50:26][Step 7/8] [27.8.2024 20.47.00]: SessionId: 15a5854a-5fa6-47bd-8bee-a15d132cabc6 [20:50:28][Step 7/8] [27.8.2024 20.47.03]: Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.CodeCoverage.Shim, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at TeklaStructuresLauncher.App.ApplicationStartup(Object sender, StartupEventArgs e) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Application.OnStartup(StartupEventArgs e) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Application.<.ctor>b__1_0(Object unused) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Threading.DispatcherOperation.InvokeImpl() [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Threading.DispatcherOperation.Invoke() [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Threading.Dispatcher.ProcessQueue() [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Application.RunDispatcher(Object ignore) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at System.Windows.Application.RunInternal(Window window) [20:50:28][Step 7/8] [27.8.2024 20.47.03]: at TeklaStructuresLauncher.App.Main()
The interesting part is that it works just fine in my local machine (VS enterprise), the agents have VS professional. Ive installed the tool with dotnet install global so i was expecting everything to work out of the box.
Also if i copy the dll into the same location as the executable it works.
Is there are requirements to use dotnet-coverage which are not documented?
Few things about the app: .net full framework 4.8, with some native calls.
Thanks in advance
Regards Jorge Costa
AB#2238339