Visual Studio 2015 kernel debugger gets stuck - c++

I am attempting to write a KMDF driver using visual studio 2015. When I try to deploy the driver and start the debugger everything seems to work: visual studio is able to build the solution and deploy it to the target computer (wich is a virtual machine), but after the deployment of the files, it seems to get stuck: I can't pause the debugger and execute the debugger's commands.
My Question: How do I get the debugger to break/pause?
What I have tried:
I have tried connecting to the target computer both with the network and with pipes, but neither seems to change anything.
I have tried setting the test certificate to "WDKTestCert".
I have tried adding a package project to the solution.
Additional Information:
My configuration of the project is the exact same as shown on MSDN here.
My host computer and target computer are both running windows 8.1 64 bit.
The target computer is a VMWare virtual machine.
I am using visual studio 2015 Version 14.0.25123.00 Update 2.
I am using WDK 10.
The Debugger's Log:
Using NET for debugging
Opened WinSock 2.0
Waiting to reconnect...
[20:00:30:970]: Remove Existing Remote Package
[20:00:31:802]: Task "Remove Existing Remote Package" completed successfully
[20:00:31:824]: Copy Driver Package
[20:00:35:171]: Task "Copy Driver Package" completed successfully
[20:00:35:193]: Driver Removal
[20:00:35:194]: Removing any existing files from test execution folder.
[20:00:36:057]: Copying required files for "Driver Removal".
$KitRoot$\Testing\Runtimes\TAEF\te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks_downlevel.dll" /select:"#Name='DriverTestTasks::_DriverRemoval'" /p:"InfFile=KmdfDriver.inf" /p:"Debug=1" /p:"ImportDriver=1" /p:"RemoveDriver=1" /p:"CertificateFile=KmdfDriver.cer" /p:"PackageGuid=x64" /p:"HardwareId=Root\KmdfDriver" /rebootStateFile:%SystemDrive%\DriverTest\Run\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Run\Driver_Removal_00008.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[20:01:51:745]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[20:01:51:750]: Task "Driver Removal" completed successfully
[20:01:52:183]: Driver Preparation
[20:01:52:184]: Removing any existing files from test execution folder.
[20:01:53:029]: Copying required files for "Driver Preparation".
$KitRoot$\Testing\Runtimes\TAEF\te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks_downlevel.dll" /select:"#Name='DriverTestTasks::_DriverPreparation'" /p:"InfFile=KmdfDriver.inf" /p:"Debug=1" /p:"ImportDriver=1" /p:"RemoveDriver=1" /p:"CertificateFile=KmdfDriver.cer" /p:"PackageGuid=x64" /p:"HardwareId=Root\KmdfDriver" /rebootStateFile:%SystemDrive%\DriverTest\Run\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Run\Driver_Preparation_00008.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[20:02:07:150]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[20:02:07:154]: Task "Driver Preparation" completed successfully
[20:02:07:866]: Driver Install
[20:02:07:867]: Removing any existing files from test execution folder.
[20:02:08:709]: Copying required files for "Driver Install".
$KitRoot$\Testing\Runtimes\TAEF\te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks_downlevel.dll" /select:"#Name='DriverTestTasks::_RunProcess'" /p:"BinaryPath=%SystemDrive%\DriverTest\devcon.exe" /p:"Arguments=-f install %SystemDrive%\DriverTest\Drivers\KmdfDriver.inf Root\KmdfDriver" /p:"WorkingFolder=%SystemDrive%\DriverTest\Drivers" /rebootStateFile:%SystemDrive%\DriverTest\Run\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Run\Driver_Install_00008.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[20:02:22:809]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[20:02:22:813]: Task "Driver Install" completed successfully
[20:02:23:267]: Driver Post Install Actions
[20:02:23:268]: Removing any existing files from test execution folder.
[20:02:24:107]: Copying required files for "Driver Post Install Actions".
$KitRoot$\Testing\Runtimes\TAEF\te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks_downlevel.dll" /select:"#Name='DriverTestTasks::_DriverPostInstall'" /rebootStateFile:%SystemDrive%\DriverTest\Run\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Run\Driver_Post_Install_Actions_00008.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[20:02:36:377]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[20:02:36:380]: Task "Driver Post Install Actions" completed successfully
After this point it seems like nothing happens.
Any help would be appreciated.

Related

Visual Studio installer 15.8.28010.2036 stalls at 97.55%

I started the Visual Studio 15.8.5 offline layout with the command, where exe is the path to the installer and install_path is the install path:
%exe% update --installPath %install_path% --quiet --wait --norestart --noWeb
And it is stalling at 97.55% with two vs_emulatorsetup processes running.
Layout progress: 97.55%
Download of 'https://download.visualstudio.microsoft.com/download/pr/10629668/d68d54e233c956ff79799fdf63753c54/vs_emulatorsetup.exe' succeeded using engine 'WebClient'
Running 'D:\vs2017\enterprise\15.8.28010.2036\install\vs.emulator.android.bundle,version=1.1.1207.2,chip=x64\vs_emulatorsetup.exe' with parameters: /quiet /layout "D:\vs2017\enterprise\15.8.28010.2036\install\vs.emulator.android.bundle,version=1.1.1207.2,chip=x64"
Downloading the offline layout has not been a problem for me before this point.
Apparently it just takes a long time for those bits to download. I mean a really long time. Some additional progress indication would be nice however.

MSB4018 The "ResolveComReference" task failed unexpectedly

I am currently trying to upgrade our c++ mfc solution from visual studio 2010 to a visual studio 2013 solution. When i try to build it i get the error MSB4018 The "ResolveComReference" task failed unexpectedly. I enabled fusion logging and this is what it tells me:
=== Pre-bind state information ===
LOG: DisplayName = System
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/12.0/bin/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. ===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System/System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System/System.EXE.
I understand that msbuild has been moved, but i dont understand why it is trying to find System.dll in the msbuild path, how can i make it look for it in its proper location?
Edit:
I have now also tried upgrading to visual studio 2012 which worked without bigger problems and I did not run into the same problem. However i noticed that when running devenv /upgrade (with vs2013) it seems to completely change everything under vc++ directories (it stayed unchanged when upgrading to vs2012). Could this have something to do with this issue?
Edit2:
Tried to build the project in vs2013 after upgrading it to 2012 (without running devenv /upgrade), this also didnt work so I guess the problem is not related to that...
After enabling diagonostic build output i found that it was 3 broken COM references in the project that where failing to load. Removing these references solved the building issue. These where only showing up as warnings in vs2010 but resulted in MSB4018 in vs 2013 for some reason.
This is your problem:
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/12.0/bin/
Fix the base folder in your build system if you really need it to point to another filder. However it would probably be better to redo you build system targeting 2013 instead of patching the 2010 version.

Executing coded UI test from a target machine's mstest(standalone). Dll's/Files needed!! :(

i set up mstest on target machine as standalone program without installing visual studio. So i copied the files(*.exe's,dll's) mstest needed to the target machine and register all dlls in gac which mstest needs to run unit tests.
Works fine so far for normal unit tests.
Acually i try to setup mstest to run coded ui test. I copied some new dll's to the target machine:
- Microsoft.VisualStudio.QualityTools.CodedUITestFramework.dll
- Microsoft.VisualStudio.TestTools.UITest.Common.dll,TestTools.UITest.Extensions.dll
- Microsoft.VisualStudio.TestTools.UITesting.dll
- Microsoft.VisualStudio.HostingProcess.Utilities.Sync
But when i try to execute a test on cmd.exe via mstest.exe on my target machine, the test will run but always fail (works fine on my local machine, Visual Studio 2012). Its a pretty simple test:
- just click on "Start",
- type in "calc press enter"
Both machines use the same operating system.
I guess MSTest.exe still needs some dll's to perform codedUiTests. The bad thing is the missing dll's arent show up in cmd.exe, no errors, no hints just nothing :/
The test runs like normal but will fail all tests.
cmd-output:
Microsoft (R) Test Execution Command Line Tool Version 11.0.50727.1
Copyright (c) Microsoft Corporation. All rights reserved.
Loading D:\Users\Jenkins\Desktop\CodedUITestProject1\CodedUITestProject1\bin\Debug\CodedUITestProject1.dll...
Starting execution...
Results Top Level Tests
------- ---------------
Failed CodedUITestProject1.CodedUITest1.CodedUITestMethod1
0/1 test(s) Passed, 1 Failed
Summary
-------
Test Run Failed.
Failed 1
---------
Total 1
Results file: C:\VS2011Stub\Common7\IDE\TestResults\Jenkins_MSGP166C 2013-05-24 12_36_28.trx
Test Settings: Default Test Settings
Does anyone know what files mstest.exe needs to run codeduitests in a correct way?
Edit: I checked the *.trx file and copied the missing dll's to my target machine.
I tried to run the test again, it failed again. I was checking the trx file again and got an awesome message :/
<Results>
<UnitTestResult executionId="4652eeb1-e1b4-4782-a288-dbd4bb0bda5a" testId="484ddbfe-fdc6-0f5d-9e7b-bab4da5b5905" testName="CodedUITestMethod1" computerName="MSGP166C" duration="00:00:00.0887388" startTime="2013-05-24T16:30:24.1716290+02:00" endTime="2013-05-24T16:30:24.6266745+02:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Failed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="4652eeb1-e1b4-4782-a288-dbd4bb0bda5a">
<Output>
<ErrorInfo>
<Message>Error calling Initialization method for test class CodedUITestProject1.CodedUITest1: System.IO.FileNotFoundException: Das System kann die angegebene Datei nicht finden. (Ausnahme von HRESULT: 0x80070002)</Message>
<StackTrace> bei System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
bei System.Reflection.Assembly.LoadFile(String path)
bei Microsoft.VisualStudio.TestTools.UITest.Framework.UITestExtensionPackageManager.LoadAssembly(String assemblyFile)
</StackTrace>
</ErrorInfo>
</Output>
</UnitTestResult>
</Results>
So what Assembly is missing now?? It was not mentioned.
Thanks in Advance
Instead of trying to copy over the dlls I would install VS Test Agents. It's much lighter than visual studio and will get you mstest. This is the approach I use when running CodedUI tests on a test machine.
http://search.microsoft.com/en-us/DownloadResults.aspx?q=test+agents
Download the version of test agents that you built the project in.
(doesn't really matter)
There will be 3 options when you open the installer. You want test agents.
You should now have everything you need for mstest and codedui
Another that works well is putting all of your codedui tests into an ordered test and passing that into mstest.
MSTest /TestContainer:OrderedTest1.orderedtest
should do the trick

MSTest.exe exited with ExitCode 1

I am manually running tests from msbuild/tfsbuild by manually invoking mstest.exe but it is failing unexpectedly with error MSB3073 and ExitCode 1 when I am expecting 0.
I have this target that searches for all DLLs with a postfix of *UnitTests.DLL in the $(OutDir) folder. It builds up a commandline statement that is then executed:
<Target Name="RunUnitTests">
<CreateItem Include="$(OutDir)\*.UnitTests.dll"
AdditionalMetadata="TestContainerPrefix=/testcontainer:">
<Output TaskParameter="Include"
ItemName="UnitTestAssemblies" />
</CreateItem>
<Exec Timeout="120000"
Command=""$(VS110COMNTOOLS)..\IDE\mstest.exe" #(UnitTestAssemblies->'%(TestContainerPrefix)"%(FullPath)"',' ') /testsettings:"$(OutDir)..\..\Sources\mysettings.testsettings"" >
<Output TaskParameter="ExitCode" PropertyName="ExitCode"/>
</Exec>
<Error Condition=" '$(ExitCode)' != '0' And '$(ExitCode)' != '2'" Text="An error [$(ExitCode)] occurred running unit tests." />
<OnError ExecuteTargets="MarkBuildStepAsFailed" />
</Target>
I've added a Timeout property above because some googling suggested this but it didnt make a difference.
This gets equated in the buildlog file as below (quotes included) (the folders names I have changed but left spaces where relevant but they don't look too long):
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\..\IDE\mstest.exe" /testcontainer:"C:\b\someprojectfolder\anotherfolder\Binaries\..\..\debug\some.unittests.dll" /testsettings:"C:\b\someprojectfolder\anotherfolder\Sources\..\..\mysettings.testsettings"
The tests DO run on the build server as part of the build process (i.e. calling the target above) as I can see the test results folder get created on disk. All unit tests pass as expected. I can see the MSTest.exe console output in my build log as well (e.g. Starting execution, list of tests and results, the results file is listed etc)
Additionally I can RDC onto the build server as the build service account and manually run the commandline above using a CMD and it works. (the test results (*.trx) and folder are there).
They also work when I manually invoke the commandline above using CMD them on my local developer machine as myself. It creates the test results file and folders.
FYI We are using Visual Studio 2012 Ultimate on my local machine and installed on the build server as well.
FYI We are using TFS 2012 with an upgrade process definition
I've got a feeling its to do with the "parsing"/escaping of quotes and/or apostrophes or could it be the use of using ..\ in the paths?
I have checked the event log on the build server and it displays no errors/information. Is there any other logs I can check? or properties I can define to "see" the actual error code?
NOTE: I know I could use the <RunTest> style msbuild/tfs build syntaxbut I manual trigger these tests at a more convenient time in the build process
this wasnt to with do quotes or apostrophes in paths. My .testsettings file connects to a remote test controller (on another server running Windows Server 2008 R2). I was collecting all data and diagnostics (video recorder etc, network emulation, event log, system diagnostics etc)
When I checked the event log on the test controller/agent server it was full of errors saying MSTest had to be run as administrative permissions. Thats what i am now investigating.

Windows KMFD HelloWorld Driver Deployment Task Failed

I need to write a Kernel Driver for Windows. Since this is my first time attempting something like this, I started with Windows' HelloWorld example:
https://msdn.microsoft.com/en-us/library/windows/hardware/hh439665(v=vs.85).aspx
I encounter my problem when installing the driver to the target machine. The console on the target machine gives the following output:
Test Authoring and Execution Framework v5.3 for x64
StartGroup: DriverTestsTasks:: _DriverRemoval Driver
Certificate File: KmfdHelloWorld.cer Driver Inf
File:KmfdHelloWorld.inf Driver Hardware ID:
Root\KmdfHelloWorld Driver package GUID: x64 Import Driver To
Store: 1 Uninstall Driver: 1 Debug Deployment: 1 COM
failure occurred. HRESULT: 0x80040154 Class not registered
Class not registered
Failed: A failure occured while removing the previous driver
installation EndGroup: DriverTestTasks:: _DriverRemoval [Failed]
Non-passing Tests: DriverTestTasks::_DriverRemoval [Failed]
SummaryL Total=1, Passed=0, Failed=1, Blocked=0, Not Run=0, Skipped=0
As explained in the tutorial, I am using Visual Studio 2015. My test machine is running Windows 10 in a VM. All the other tests pass. The driver is copied to the target machine and gets installed, but fails this one procedure and hence I can't use the Debugger explained at the end of the tutorial.
you can remove the step of remove the previous installation by remove checkbox at "project setting"-> Driver install-> Deployment