# D2DGraphicsBacking error

I’ve deployed my XoJo 2017r1.2 application on a machine running Windows 7 Pro (version 6.1.7601 Service Pack 1 Build 7601), I’m getting this error once in a while if the machine stays on overnight:

Common\Win32\D2DGraphicsBacking.cpp: 354
Failure Condition: S_OK ==
D2D().D2DFactory()->CreateDCRenderTarget(&props,&mDCRenderTarget)

Is this a windows or XoJo 2017 error? I’ve not seen this with XoJo 2016 applications. The XoJo 2016 applications are running on a different machine, but still with a Windows 7 Pro OS.

We have just seen this error message on a customer’s machine today.
The reason has been that the machine has two Graphic Cards (usually some “Intel Integrated Graphics” and a “High Performance Card”, such as NVIDIA GeForce, AMD Radeon).
We has to use the NVIDIA/AMD configuration tool. It has a settings panel to configure which application is using which graphic card(s). Add the Xojo-built.exe to the list of Application that will run on “Integrated Gaphics” (not the “High performance” one). And the Xojo-built application could be launched again without issues.
This RuntimeError is likely related to <https://xojo.com/issue/54979>.

I’ve just had a report of this same issue from a user (though in his case at D2DGraphicsBacking.cpp: 124). I checked and he also has dual graphics cards - one built-in Intel and one high performance. Also added to (https://xojo.com/issue/54979)]Feedback Case #54979.

If you’re building the application with 2019r2 or newer (preferrably 2019r3.1), then you could try this:
In App.Open set the following environment variable: System.EnvironmentVariable("XOJO_D2D_SOFTWARE_RENDERING") = "True".
I’m curious to know if this helps for that system/environment… If so, please add that to the Feedback Case, too.

Hmm - if you don’t want to rebuild the application for this customer, you could ask the customer to set this environment variable in cmd.exe, then launch the app from there (so that in inherits the env-variable):

cd \\path\\to\\your\\appfolder set XOJO_D2D_SOFTWARE_RENDERING=True appname.exe

If that works… the customer could persist that environment variable (e.g. via setx, registry - and I think there’s a system-setting-gui as well) as a workaround…

[quote=494983:@Jürg Otter]set XOJO_D2D_SOFTWARE_RENDERING=True
appname.exe[/quote]

I would prefer a compiler setting at Windows build Settings : GPU Rendering on/off - Default on (as today, off is software)

[quote=494983:@Jürg Otter]If you’re building the application with 2019r2 or newer (preferrably 2019r3.1), then you could try this:
In App.Open set the following environment variable: System.EnvironmentVariable("XOJO_D2D_SOFTWARE_RENDERING") = "True".[/quote]
Many thanks Jürg, but this particular user is not comfortable with technology, so I had enough trouble getting him to change the NVidia settings to force the app onto internal graphics (which worked, by the way). I don’t think I’m going to attempt to get him into the world of command line and setting env variables.

Don’t we do that all…?
Meanwhile, we have to work with what’s available “now”.

You’re welcome. Still - if you have some other customer running into this, then please try…
it would be good to know if this actually works (since it is not officially documented yet)

[quote=495071:@Jürg Otter] @Rick Araujo I would prefer a compiler setting

Don’t we do that all…?
[/quote]

Probably not, as the solution was implemented differently of my desire (and seems yours), and if we don’t express our opinions, there are great chances of it to stay there half baked as is forever.

I made a formal request here: <https://xojo.com/issue/50808>