NVidia NVML nvmlDeviceGetMemoryInfo() loads and unloads nvapi64.dll immediately - c++

I use some NVIDIA Management Library features to produce metrics in my application.
Every 1 second I call nvmlDeviceGetMemoryInfo() in a thread, and after a few minutes, in the output of Visual Studio, I can read hundreds of :
'MyApp.exe' (Win32): Loaded 'C:\Windows\System32\nvapi64.dll'.
'MyApp.exe' (Win32): Unloaded 'C:\Windows\System32\nvapi64.dll'
...
'MyApp.exe' (Win32): Loaded 'C:\Windows\System32\nvapi64.dll'.
'MyApp.exe' (Win32): Unloaded 'C:\Windows\System32\nvapi64.dll'
'MyApp.exe' (Win32): Loaded 'C:\Windows\System32\nvapi64.dll'.
'MyApp.exe' (Win32): Unloaded 'C:\Windows\System32\nvapi64.dll'
...
Other functions from NVML like nvmlDeviceGetCount(), nvmlDeviceGetHandleByIndex(), nvmlDeviceGetClockInfo() or nvmlDeviceGetUtilizationRates() don't produce this ponctual loading/unloading of the nvapi64.dll.
Is it possible to avoid unloading this dll, to keep it available for my next call to nvmlDeviceGetMemoryInfo() ?
EDIT :
I call this function to retreive gpu memory statistics like that :
nvmlMemory_t memInfo;
if (nvmlDeviceGetMemoryInfo(device, &memInfo) == NVML_SUCCESS) {
this->gpuMemUsed = memInfo.used;
this->gpuMemTotal = memInfo.total;
}
I see these output line in Debug and Release, each time I call nvmlDeviceGetMemoryInfo() there is on couple of Loaded nvapi64.dll / Unloaded nvapi64.dll
NVML comes with Cuda V10.2 .

you can simply call LoadLibraryW(L"nvapi64.dll"); after this dll already will be not unloaded (RbMm)
This did the trick

Related

visual studio 2019 project

Everytime I run debugger I receive this message in the output:
'Project1.exe' (Win32): Loaded 'C:\Users\123em\OneDrive\Project1.exe'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'.
The thread 0x23e1c has exited with code 0 (0x0).
The program '[139372] Project1.exe' has exited with code 0 (0x0).
How can I see the result of my project? I am building a code to rotate an array.
I don't know what kind of result you expect, so I listed two methods for your reference.
Set a breakpoint and add the variable you want to monitor in "Add item to watch", so that you can observe the value of the variable, and it needs to be used with F11, I suggest you refer to this document for this.
Right-click the breakpoint, then select Action, and enter your ideal output format. When executing the program, you can see the output you set in output.

How can I overcome the issue of output console disappearing after taking input or compiling in Visual Studio-2013 for C++?

I am new to C++ coding and in Visual studio environment. My simple code to find a sqrt of a number is being compiled and even run but the console disappears after taking number as input and I am left with the debugging messages and final message of Program terminated with exit code 0. Basically no output is shown.
#include <cmath>
#include <iostream>
int main()
{
double x{ 0.0 };
std::cout << "Enter x-";
std::cin >> x;
if (x >= 0)
std::cout << "\nSqrt(" << x << ") = " << std::sqrt(x) << std::endl;
else
std::cout << "\nWrong Value - cannot compute sqrt\n";
}
The code seems okay, it runs on online compilers. I have tried checking 'console' option from Linker->System->Sub-system->Console (/SUBSYSTEM:CONSOLE). But nothing works.
There are also certain debugging messages that seem to be generated some of them I am showing below -
......
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\CtxGraphicsHelper.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\mmhook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\Sfrhook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wtsapi32.dll'. Symbols loaded.
The thread 0x498 has exited with code 0 (0x0).
The thread 0x2500 has exited with code 0 (0x0).
The thread 0x30f0 has exited with code 0 (0x0).
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\ShellHook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\windows.storage.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\scardhook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\twnhook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\cxinjime.dll'. Cannot find or open the PDB file.
The program '[10912] Project2.exe' has exited with code 0 (0x0).
I tried checking the Tools->debugging->symbols->Microsoft Symbol Servers. Some PDF files were found and some were not. I want to get to the root of this issue and basically get my program to behave the way as its coded with output console taking input and showing the result.
You can temporarily add a simple line at the end of code:
system("pause");
Don't forget to include: #include <cstdlib>

Debug Assertion Failed. nullptr

I'm starting to program and I'm using Visual Studio. I have this simple program that some days ago worked, but after working with another project, it returns me an error:
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <math.h>
int main() {
double a = 3;
FILE *A;
scanf("%lf", &a);
A = fopen("B:\\Mis Documentos\\Coding\\Test 200.txt", "wt");
fprintf(A, "Hello World, I have %lf", a);
fclose(A);
}
But I can't compile it, it returns me this error. This is the log:
'Project1.exe' (Win32): Loaded 'B:\Mis Documentos\Documents\Visual Studio 2015\Projects\Project1\Debug\Project1.exe'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-timezone-l1-1-0.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-file-l2-1-0.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-localization-l1-2-0.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-synch-l1-2-0.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-processthreads-l1-1-1.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-file-l1-2-0.dll'. Symbols loaded.
Debug Assertion Failed!
Program: ...ments\Visual Studio 2015\Projects\Project1\Debug\Project1.exe
File: minkernel\crts\ucrt\src\appcrt\stdio\output.cpp
Line: 31
Expression: stream != nullptr
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.
You're not checking if the file was actually opened. You should check if file was actually opened after calling fopen
FILE *A = NULL;
....
A = fopen("B:\\Mis Documentos\\Coding\\Test 200.txt", "wt");
//Check if file was actually opened
if(A) {
....
}
Check documentation on this function, for example here. You should also initialize A variable, it's a good practice.
At the end it was my fault, I didn't create the folder "Coding" where I wanted the file. I can finish what I wanted to do now, but I saw that if I want to create the file in my Google Drive folder, sometimes works an others don't. Not sure why, maybe because it's connected to internet?
Anyway, thanks a lot for your fast help!

C++ program Hello World exception after main returned

After installing Visual Studio 2013 Express on my Windows 7 64-bit PC, I tested the following simple Hello World C++ program:
1 #include <iostream>
2 using namespace std;
3
4 int main() {
5 cout << "Hello World" << endl;
6 return 0;
7 }
When I run this code in normal execution (using ctr+F5), the programs runs fine. However, when I run it with the debugger (using F5 only), I get the following message box that appears :
"First-chance exception at 0x778412C7 in ConsoleApplication1.exe: 0xC0000008: An invalid handle was specified.
If there is a handler for this exception, the program may be safely continued."
I press continue and then another message box appear saying :
Unhandled exception at 0x778412C7 in ConsoleApplication1.exe: 0xC0000008: An invalid handle was specified.
If there is a handler for this exception, the program may be safely continued.
I press continue again and the console output is the following :
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Users\212426625\Desktop\ConsoleApplication1\Debug\ConsoleApplication1.exe'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\DgApi.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\psapi.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ws2_32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nsi.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\mpr.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\userenv.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp120d.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr120d.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\AE_MailSensor_Plugin.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\AME_OutlookSensor.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\AME_SmtpSensor.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\8E4EA70A-6128-4B57-BD3F-8E9E0F0DA6BB\OS_Plugin.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\8E4EA70A-6128-4B57-BD3F-8E9E0F0DA6BB\COM_Sensor.dll'. Cannot find or open the PDB file.
The thread 0x1f34 has exited with code 0 (0x0).
First-chance exception at 0x778412C7 in ConsoleApplication1.exe: 0xC0000008: An invalid handle was specified.
Unhandled exception at 0x778412C7 in ConsoleApplication1.exe: 0xC0000008: An invalid handle was specified.
The program '[1836] ConsoleApplication1.exe' has exited with code 0 (0x0).
So I tried to figure out what's going on by putting a break point at line #5 and stepping with F10. I can step passed the closing bracket of the main() and then enter in a file called "crtexe.c" (see code block below). I continue stepping through this file until the exception pops up at line #649:
645 #else /* !defined (_WINMAIN_) && defined (_CRT_APP) */
646 if ( !managedapp )
647 {
648 #ifndef _CRT_APP
649 exit(mainret);
650 #else
What is the explanation for this behavior and how can I get it to work as expected?
Edit:
The stack trace is as follow (Since I can't post pictures, I wrote it down):
Call Stack
Name Language
ntdll.dll!ZwClose#4() Unknown
KernelBase.dll!_CloseHandle#4() Unknown
kernel32.dll!_CloseHandleImplementation#4() Unknown
AME_OutlookSensor.dll!732cc94d() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for AME_OutlookSensor.dll]
AME_OutlookSensor.dll!732b91bc() Unknown
AME_OutlookSensor.dll!732b928f() Unknown
AME_OutlookSensor.dll!732b44c4() Unknown
AME_OutlookSensor.dll!732b461f() Unknown
AME_OutlookSensor.dll!732b468a() Unknown
[External Code]

Unhandled exception DirectX11.1 Rendering 2D graphics

I'm using DirectX11.1 in Visual studio 2013, developing a Windows 8 store App.
I've been trying for a couple of days to get my head around creating a 2D UI using DirectX, and just as I thought I might have got it, I'm coming across a unhandled exception I can't seem to shake.
"Unhandled exception at 0x002E2901 in First.exe: 0xC0000005: Access violation reading location 0x00000000."
Update: It seems that after 'd2dFactory->CreateDevice(dxgiDevice.Get(), &dev2d);' dev2d is coming out as null.
Update: Using HRESULT the create device method is giving the error "E_INVALIDARG".
(I've been following http://msdn.microsoft.com/en-us/library/windows/apps/hh780340.aspx )
Below is my code from the header and .cpp file. I haven't included anything past creating an ID2D1DeviceContex as this is where the error arises (it is only when I include it that the exception occurs.
.h
#pragma once
#include <d2d1.h>
#include <d2d1_1.h>
#include "DeviceResources.h"
#include "DirectXHelper.h"
using namespace Microsoft::WRL;
using namespace Windows::UI::Core;
using namespace Platform;
using namespace DirectX;
class CGame
{public:
ComPtr<ID3D11Device1> dev; // the device interface
ComPtr<ID3D11DeviceContext1> devcon; // the device context interface
ComPtr<IDXGISwapChain1> swapchain; // the swap chain interface
ComPtr<ID3D11RenderTargetView> rendertarget; // the render target interface
ComPtr<ID3D11Buffer> vertexbuffer; // the vertex buffer interface
ComPtr<ID3D11Buffer> vertexbuffer2; //For triangle
ComPtr<ID3D11Buffer> vertexbuffer3; //For laser
ComPtr<ID3D11Buffer> vertexbuffer4; //ship 2
ComPtr<ID3D11VertexShader> vertexshader; // the vertex shader interface
ComPtr<ID3D11PixelShader> pixelshader; // the pixel shader interface
ComPtr<ID3D11InputLayout> inputlayout; // the input layout interface
//2D Stuff
ComPtr<IDXGISurface> dxgiBackBuffer;
ComPtr<ID2D1Factory1> d2dFactory;
ComPtr<ID2D1Device> dev2d;
ComPtr<ID2D1DeviceContext> devcon2d;
ComPtr<ID2D1Bitmap1> targetBitmap;
ComPtr<ID2D1SolidColorBrush> pBlackBrush;
.cpp file
#include "pch.h"
#include "Game.h"
#include <fstream>
#include <process.h>
// Use some common namespaces to simplify the code
using namespace Windows::ApplicationModel;
using namespace Windows::ApplicationModel::Core;
using namespace Windows::ApplicationModel::Activation;
using namespace Windows::UI::Core;
using namespace Windows::UI::Popups;
using namespace Windows::System;
using namespace Windows::Foundation;
using namespace Windows::Graphics::Display;
using namespace Platform;
using namespace std;
// this function initializes and prepares Direct3D for use
void CGame::Initialize()
{
// Define temporary pointers to a device and a device context
ComPtr<ID3D11Device> dev11;
ComPtr<ID3D11DeviceContext> devcon11;
//Create Factory ID2D1Factory1
D2D1CreateFactory(
D2D1_FACTORY_TYPE_SINGLE_THREADED,
__uuidof(ID2D1Factory1),
0,
&d2dFactory
);
// Create 3D device and device context objects
D3D11CreateDevice(
nullptr,
D3D_DRIVER_TYPE_HARDWARE,
nullptr,
0,
nullptr,
0,
D3D11_SDK_VERSION,
&dev11,
nullptr,
&devcon11);
// Convert the pointers from the DirectX 11 versions to the DirectX 11.1 versions
dev11.As(&dev);
devcon11.As(&devcon);
// obtain the DXGI factory
ComPtr<IDXGIDevice1> dxgiDevice;
dev.As(&dxgiDevice);
ComPtr<IDXGIAdapter> dxgiAdapter;
dxgiDevice->GetAdapter(&dxgiAdapter);
ComPtr<IDXGIFactory2> dxgiFactory;
dxgiAdapter->GetParent(__uuidof(IDXGIFactory2), &dxgiFactory);
//Create an ID2D1Device and an ID2D1DeviceContex
d2dFactory->CreateDevice(dxgiDevice.Get(), &dev2d);
DX::ThrowIfFailed(
dev2d->CreateDeviceContext(
D2D1_DEVICE_CONTEXT_OPTIONS_NONE,
&devcon2d
)
);
Any help would be greatly appreciated, and just in case there is any reason to view the code that follows:
// set up the swap chain description
DXGI_SWAP_CHAIN_DESC1 scd = { 0 };
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; // how the swap chain should be used
scd.BufferCount = 2; // a front buffer and a back buffer
scd.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // the most common swap chain format
scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // the recommended flip mode
scd.SampleDesc.Count = 1; // disable anti-aliasing
CoreWindow^ Window = CoreWindow::GetForCurrentThread(); // get the window pointer
// create the swap chain
dxgiFactory->CreateSwapChainForCoreWindow(
dev.Get(), // address of the device
reinterpret_cast<IUnknown*>(Window), // address of the window
&scd, // address of the swap chain description
nullptr, // advanced
&swapchain); // address of the new swap chain pointer
// get a pointer directly to the back buffer
ComPtr<ID3D11Texture2D> backbuffer;
swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), &backbuffer);
// create a render target pointing to the back buffer
dev->CreateRenderTargetView(backbuffer.Get(), nullptr, &rendertarget);
//Set up Direct2D render target bitmap, linking it to the swapchain
D2D1_PIXEL_FORMAT pixelFormat = { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED };
D2D1_BITMAP_PROPERTIES1 bitmapProperties =
{ pixelFormat,
0,
0,
D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW,
0,
};
//Direct2D needs the dxgi version of the backbuffer surface pointer
swapchain->GetBuffer(0, IID_PPV_ARGS(&dxgiBackBuffer));
//Get a D2D surface from the DXGI back buffer to use as the D2D render target.
devcon2d->CreateBitmapFromDxgiSurface(
dxgiBackBuffer.Get(),
&bitmapProperties,
&targetBitmap
);
//Now we can set the Direct2D render target
devcon2d->SetTarget(targetBitmap.Get());
//Create a brush for 2D
devcon2d->CreateSolidColorBrush(
D2D1::ColorF(D2D1::ColorF::Black),
&pBlackBrush);
// set the viewport
D3D11_VIEWPORT viewport = { 0 };
viewport.TopLeftX = 0;
viewport.TopLeftY = 0;
viewport.Width = Window->Bounds.Width;
viewport.Height = Window->Bounds.Height;
devcon->RSSetViewports(1, &viewport);
Update:
Output following error is: (There is a similar error output to this lurking around on stackoverflow, though it seems very much unresolved.
'First.exe' (Win32): Loaded 'C:\Users\Alec\Documents\Visual Studio 2013\Projects\First\Debug\First\AppX\First.exe'. Symbols loaded.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\d2d1.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\d3d11.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dxgi.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\DWrite.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\Microsoft.VCLibs.120.00.Debug_12.0.21005.1_x86__8wekyb3d8bbwe\vccorlib120d_app.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\Microsoft.VCLibs.120.00.Debug_12.0.21005.1_x86__8wekyb3d8bbwe\msvcp120d_app.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\Microsoft.VCLibs.120.00.Debug_12.0.21005.1_x86__8wekyb3d8bbwe\msvcr120d_app.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Cannot find or open the PDB file.
The thread 0x22c0 has exited with code 0 (0x0).
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\twinapi.appcore.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WinTypes.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptsp.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rsaenh.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcrypt.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\actxprxy.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\MrmCoreR.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\BCP47Langs.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\Windows.UI.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ninput.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\igd10umd32.dll'. Cannot find or open the PDB file.
'First.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
Turns out I hadn't created my D3D11 Device to be compatible with Direct2D. The code below fixed it. Thanks to Trillian for the debugging aid, was incredibly helpful.
// This flag adds support for surfaces with a different color channel ordering than the API default.
// You need it for compatibility with Direct2D.
UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
// This array defines the set of DirectX hardware feature levels this app supports.
// The ordering is important and you should preserve it.
// Don't forget to declare your app's minimum required feature level in its
// description. All apps are assumed to support 9.1 unless otherwise stated.
D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1
};
D3D_FEATURE_LEVEL m_featureLevel;
// Create 3D device and device context objects
D3D11CreateDevice(
nullptr,
D3D_DRIVER_TYPE_HARDWARE,
nullptr,
creationFlags,
featureLevels,
ARRAYSIZE(featureLevels),
D3D11_SDK_VERSION,
&dev11,
&m_featureLevel,
&devcon11);