Windbg command clrstack not working - c#

I need to do crash dump analysis for a .net exe using Windbg.
I read multiple blogs on MSDN to setup my Windbg but looks like it still has issues loading 'mscordacwks.dll'.
Upon running this command i get this:
Failed to load data access DLL, 0x80004005 Verify that 1) you have a
recent build of the debugger (6.2.14 or newer)
2) the file mscordacwks.dll that matches your version of mscorwks.dll is
in the version directory
3) or, if you are debugging a dump file, verify that the file
mscordacwks_.dll is on your symbol path.
4) you are debugging on the same architecture as the dump file.
For example, an IA64 dump file must be debugged on an IA64
machine.
You can also run the debugger command .cordll to control the
debugger's load of mscordacwks.dll. .cordll -ve -u -l will do a
verbose reload. If that succeeds, the SOS command should work on
retry.
If you are debugging a minidump, you need to make sure that your
executable path is pointing to mscorwks.dll as well.
Here are quick details of my environment:
EXE is 32 -bit so using x86 debugger
In the following path: C:\Windows\Microsoft.NET\Framework\v2.0.50727 the two DLLs are located
:
->mscorwks.dll
->mscordacwks.dll file version: 2.0.50727.5485
Symbol path is : c:\debug\symbols
Debugging tools(i.e. Windbg installation) is located at: C:\Program Files (x86)\Windows Kits\10\Debuggers\x86
Copied mscorwks.dll and mscordacwks.dll in this path and renamed to(as per some blog on MSDN) :
-> mscordacwks_x86_x86_2.0.50727.5485
-> mscorwks_x86_x86_2.0.50727.5485
Not sure if these names are correct or not.
Still it never worked.

Related

Coverity scan for .Netstandard 2.1 library

I am trying to use Coverity with my .NetStandard2.1 library.
using commands like:
set COVERITY_PATH="C:\Users\xxx\Desktop\cov-analysis-win64-8.5.0\bin"
set PATH=%PATH%;%COVERITY_PATH%
cov-configure --cs
cov-build --dir MY_EMIT_DIR dotnet build || (echo build failed )
echo "build successfully!!"
cov-analyze --dir MY_EMIT_DIR
cov-commit-defects --dir MY_EMIT_DIR --host 10.ccc.aaa.bbb --user xxxxx --password xxxxx --stream CSProject
After running the command getting the warning and error:
[WARNING] No files were emitted. This may be due to a problem with
your configuration or because no files were actually compiled by your
build command. Please make sure you have configured the compilers
actually used in the compilation. For more details, please look at:
C:/xxx/Src/MY_EMIT_DIR/build-log.txt
C:\xxx\Src>cov-analyze --dir MY_EMIT_DIR
Coverity Static Analysis version 8.5.0 on Windows 10 (Unknown Edition number 121), 64-bit (build 19042)
Internal version numbers: c8d197a567 p-kent-push-26368.915
Using 1 worker as limited by CPU(s)
Looking for translation units
Error: intermediate directory contains no translation units.
I also tried to set the compiler explicitly like,
cov-configure --compiler "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Roslyn\csc.exe"

Project upgrade from VS 2013 to VS 2015 windows 8.1 universal apps

I was about to update my existing windows 8.1 universal app to VS2015 along with its portable projects.But it fails with below error
"Error : DEP6810 : MdilXapCompile.exe failed with error code 1004. See log file 'C:\xxx\xxx.WindowsPhone\obj\ARM\Debug\MDIL\MDILXapCompileLog.txt' for more details"
The Log file Contents
Error: Compile filter argument specified non-existent file: C:\xxx\xxx\xxx.WindowsPhone\obj\ARM\Debug\MSIL\PhoneLibrary\Microsoft.SharePoint.Client.Portable.dll
Invalid argument
Microsoft (R) MDIL XAP Compiler - Version 4.0.0.0
Copyright (c) Microsoft Corporation. All rights reserved.
Usage: MDILXAPCompile /In:<InputPath> /Out:<OutputPath> /Config:<ConfigPath> [/CompileFilter:<Assembly Path>;<Assembly Path>] [/Timeout:<Timeout>] [/Log:<LogPath>] [/AppX]
/In - Path to directory containing files to process
/Out - Path to directory to place processed files in
/Config - Path to configuration file
/CompileFilter - Optional restrictive list of assembly files in InputPath,
separated by semi-colons, to be compiled.
/Timeout - Optional timeout in milliseconds before killing the Crossgen process. Overrides config file timeout value. Use -1 for infinite timeout, 0 for application default (2 hours).
/Log - Optional path to log file
/AppX - Specifies that assemblies correspond to an AppX package
Relative paths are relative to this executable's directory.
I get this error only when I debug the project but it works normal when i generate package and deploy it to device.
Answers are highly appreciated.
I got this solved. But may not be the direct way. Its quite strange.
I referred my dll's from the folder(named as PhoneLibrary) inside the app. As per log file location "C:\xxx\xxx\xxx.WindowsPhone\obj\ARM\Debug\MSIL\PhoneLibrary\Microsoft.SharePoint.Client.Portable.dll" it failed to create the folder.
So i just created folder in that location and copied my dll's in that folder and worked great.

cmd.exe exited with code 9009

I am trying to compile XNABasics project in visual studio from this repository
https://code.google.com/p/kinect4bag/
But it gives me a error named:
Error 1 error MSB6006: "cmd.exe" exited with code 9009. C:\Program
Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 151 6 CGePhysics
and when i double click it redirects me to the page given below, i have checked the project properties does not have anything in custom build step and custom build tool area.
Just came across this thread now.
I had the exact same error. In my case, the swig.exe path that my project was looking for was wrong. My issue was fixed once i made sure the SWIG package was in the same path that my Project Properties' Macro was looking.
When I had this problem it was due to missing Direct X executable paths in the property manager. As suggested at this Stack Overflow thread: MSB6006: “cmd.exe” exited with code 9009
Upon inspecting my build log I found that 'fxc' is not recognized as an internal or external command which brought me to this solution: 'fxc.exe' is not recognized as an internal or external command
I went into my property manager to Microsoft.Cpp.Win32.user and added the proper DirectX SDK paths to Executables, Include, and Library (C:\Program Files\Microsoft DirectX SDK\Utilities\bin\x64, C:\Program Files\Microsoft DirectX SDK\Include, C:\Program Files\Microsoft DirectX SDK\Lib\x86 respectively)
This error shows that execution of a command in command line environment fails. You should view output logs(e.g., view->output in visual studio) and find this error. For example, following log illustrated that windows command cannot recognize 'make' syntax. So, I replaced it with 'nmake' and set PATH variable for it.
2> 'make' is not recognized as an internal or external command,
2> operable program or batch file.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(170,5): error MSB6006: "cmd.exe" exited with code 9009.

What are .ni.dll and .ni.exe files in a minidump?

I got a minidump from the Windows Store Apps submission process (sent by a reviewer) because of a crash in my app. I am having problems loading the symbols for my app, because the error occurs inside App.ni.exe, a file which I don't know where comes from.
My app only has a App.exe (and some DLLs), but the dump keeps referring to .ni.dll and .ni.exe. These files are nowhere to be found in my .appx or .appxsym files.
My app is built for each specific platform (x86, x64, and ARM). It is the x64 version that crashed in the stackdump.
My current attempts with windbg:
Symbol path:
Srv*C:\Users\Vegard\Appdata\local\temp\SymbolCache*http://msdl.microsoft.com/download/symbols`
Windbg attempt:
0:006> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************
Unable to load image Newtonsoft.Json.ni.dll, Win32 error 0n2
*** WARNING: Unable to verify checksum for Newtonsoft.Json.ni.dll
*** ERROR: Module load completed but symbols could not be loaded for Newtonsoft.Json.ni.dll
Unable to load image App.ni.exe, Win32 error 0n2
*** WARNING: Unable to verify checksum for App.ni.exe
*** ERROR: Module load completed but symbols could not be loaded for App.ni.exe
Unable to load image mscorlib.ni.dll, Win32 error 0n2
*** WARNING: Unable to verify checksum for mscorlib.ni.dll
Update: Trying to ngen App.exe (running as admin) I get the following error:
> ngen.exe install App.exe
[snip]
This operation is only valid in the context of an app container.
(Exception from HRESULT: 0x8007109A)
What is an app container in this case? Where should I run it from?
Update: After a long while troubleshooting, and figuring out the root cause through other means, I have concluded that the minidump file I got was missing this information. No matter of coaxing could get the debugger to load the symbols for the files.
Take a look at the tool description Ngen.exe (Native Image Generator):
The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead of using the just-in-time (JIT) compiler to compile the original assembly.
Keep in mind this processor-specific machine code.
If you need to debug minidump with NI images you need to get symbols (PDBs) for these images. The PDBs for managed DLL will not work, you need to generate Native PDB for NGEN'd image with NGEN tool, take a look on the article Creating NGEN PDBs for Profiling Reports. This article about how to get NGEN pdbs for Profiler Report, but for debugging it is the same.
As I said keep in mind that NGEN is a processor-specific machine code, so to generate PDBs for them:
Since NGEN’d images are native, it’s important you use the copy of ngen.exe that matches the architecture of the application you are profiling (x86/x64/ARM). For example if the application is running 64 bit on Windows 8 RTM then you would need to reference the copy of ngen.exe in “C:\Windows\Microsoft.NET\Framework64\v4.0.30319”
UPDATE:
From the link above:
if you remote profiled a Windows Store App, you have to do this on the machine you were running the app on while you were profiling. It will not work if you do it on the machine you are viewing the report on
So it looks like you need to generate ngen modules / pdbs on the same machine where you got the minidump.
Windows has a Native Image Service, which generates ni images for Windows Store Applications after some time when you install it on your machine. You can try to use procmon.exe to find how Windows generate ngen modules for applications from Windows Store. (just use filter for Process Name with ngen.exe).
NI=Native Image. In other words, NGEN'd images as the comments above indicate.

CUDAfy.NET giving Win32Exception: The system cannot find the file specified

I've added a reference to the CUDAfy.NET library via NuGet.
<package id="CUDAfy.NET" version="1.12.4695.21111" targetFramework="net45" />
When I run my program, I hit a Win32Exception:
The system cannot find the file specified
This happens on the first actual line of the program:
CudafyModule km = CudafyTranslator.Cudafy();
There's no indication from the exception object as to what file they're attempting to load.
How can I get past this problem?
EDIT
I see the same exception when running the bundled examples from the Codeplex download in VS2010 using .NET 4.0.
The strack trace is:
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Cudafy.CudafyModule.Compile(eGPUCompiler mode, Boolean deleteGeneratedCode)
at Cudafy.Translator.CudafyTranslator.Cudafy(ePlatform platform, eArchitecture arch, Version cudaVersion, Boolean compile, Type[] types)
at Cudafy.Translator.CudafyTranslator.Cudafy(ePlatform platform, eArchitecture arch, Type[] types)
at Cudafy.Translator.CudafyTranslator.Cudafy()
Setting VS to break on thrown exceptions shows the ProcessStartInfo object at the top of the stack in the locals pane of the debugger.
The relevant properties are:
FileName = nvcc
Arguments = -m64 -arch=sm_12 "c:\<path>\CUDAFYSOURCETEMP.cu" -o "c:\<path>\CUDAFYSOURCETEMP.ptx" --ptx
Some information from this article explains that the CUDA Toolkit must be installed. Fair enough.
Ensure that the C++ compiler (cl.exe) is on the search path. This set-up of NVCC is actually the toughest stage of the whole process, so please persevere. Read any errors you get carefully - most likely they are related to not finding cl.exe or not having either 32-bit or 64-bit CUDA Toolkit.
That article discusses version 4 of the toolkit, but version 5 is available now and supported since CUDAfy v1.1.
Download from https://developer.nvidia.com/cuda-downloads
Note that the 64-bit version of the CUDA Toolkit 5.0 is a 942 MB download. If you install everything you'll need an additional 2815 MB. The toolkit alone requires 928 MB.
EDIT After installing the CUDA Toolkit 5.0, the program failed with a CudafyCompileException at the same source line:
Compilation error: nvcc : fatal error : Cannot find compiler 'cl.exe' in PATH
Searching my system drive:
C:\>dir /s cl.exe
This shows many different versions of the compiler/linker, both from VS 10.0 and 11.0. Apparently only cl.exe versions 9 and 10 are supported, so I opted for the VS10.0 amd64 version, I included the following in my PATH environment variable:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64
Your path may be different, depending upon your CPU. I recommend running the search to see your options.
Note that you will have to restart VS after changing the PATH environment variable if you already have it open.
After taking these steps, my basic program ran successfully.
This may also happen if you had at some point installed CUDA Toolkit v7.5, but realized that the most recent version of CUDAfy supports CUDA 7.0.
On uninstalling CUDA 7.5 from the control panel, some files/folders may still remain. You should delete these manually. You may use CUDAfyViewer to see which version of CUDA Toolkit is being accessed.

Categories

Resources