Select to view content in your preferred language

Every Core project/sample fails on initial load with unknown error

1973
7
Jump to solution
05-03-2021 12:03 PM
MikeBrownNCDOT
Emerging Contributor

Doesn't matter if it is Core 3.1 or 5. I always get the same ArcGISRuntimeException "Unknown error: DirectX failure CreateTexture code = 0x80070057" as soon as it loads the view. I've tried the documentation tutorial for a WPF app, and 2 of the ESRI github dotnet sample apps with the same result. .NET Fx versions work fine. I'm running VS 2019 16.9.4 and even installed the latest .NET 5 sdk just in case. I'm on Windows 10 Ent 64-bit 1909/18363.1500. I am accessing my PC remotely through Citrix Workspace so not sure  if that could be some kind of issue. Here is the generated error:

MapsApp Error: 0 : Pulse Failed
Is Remote Desktop: False
Rendering Mode: Hardware
Surface Size: 2558,949
DPI: 144
Esri.ArcGISRuntime.ArcGISRuntimeException: Unknown error: DirectX failure CreateTexture code = 0x80070057
at Esri.ArcGISRuntime.ArcGISException.HandleCoreError(CoreError error, Boolean throwException)
at RuntimeCoreNet.GeneratedWrappers.Interop.CheckError(IntPtr errorHandle, Boolean throwOnFailure, GCHandle wrapperHandle)
at RuntimeCoreNet.GeneratedWrappers.CoreGeoView.Pulse()
at Esri.ArcGISRuntime.UI.Controls.GeoView.Esri.ArcGISRuntime.Internal.IDxSurfaceSource.Pulse()
at Esri.ArcGISRuntime.Internal.HostedSurfaceElement.CompositionTarget_Rendering(Object sender, EventArgs e)
An unhandled exception of type 'Esri.ArcGISRuntime.ArcGISRuntimeException' occurred in System.Private.CoreLib.dll
Unknown error: DirectX failure CreateTexture code = 0x80070057

 

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

I'm wondering if there's an issue in .NET Core with correctly detecting software rendering mode.

Could you try add add the following line of code right when the application starts up (as in the App.xaml.cs constructor):

System.Windows.Media.RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;

That would help confirm is that's the issue we're dealing with, and we can do a few more things to check to understand where it goes wrong (and if it works it should at least give you a workaround for now)

View solution in original post

7 Replies
dotMorten_esri
Esri Notable Contributor

I'm wondering if there's an issue in .NET Core with correctly detecting software rendering mode.

Could you try add add the following line of code right when the application starts up (as in the App.xaml.cs constructor):

System.Windows.Media.RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;

That would help confirm is that's the issue we're dealing with, and we can do a few more things to check to understand where it goes wrong (and if it works it should at least give you a workaround for now)

MikeBrownNCDOT
Emerging Contributor

I couldn't put it in the App constructor ("IDE1007 The name System.Windows.Media.RenderOptions.ProcessRenderMode does not exist in the current context") but I made it the first line in the MainView ctor and app/mapview loaded correctly, no exception.

As for the debug messages, had the same results for NETFX, NET31, and NET5.

Registry DisableHWAcceleration = 0
ProcessRenderMode = Default
HWND Render Mode =
RenderCapability.Tier = 2

(hwndSource is null)

 

0 Kudos
dotMorten_esri
Esri Notable Contributor

Thank you that's helpful. This means we know we're likely dealing with an issue detecting that software rendering is required on Citrix Workspace.


I got a couple more things to try. Without the workaround above to force software rendering, when you load the mapview, in the output you should see a message a long the lines of


   "[AppName] Information: 0 : Software rendering forced by ..."

Do you see this in both the NETFX and NET3/5 cases? (you should definitely see it with the workaround to force software rendering). If so, what does the full message read?
I'd be curious if NETFX for some reason detects it, but .NET 3/5 fails to do so.

Second, I forgot to mention the above code for getting values should be run in the Window's Loaded event. If you do that, the HwndSource returned shouldn't be null. Would you mind reposting the values returned after the window has loaded?

0 Kudos
MikeBrownNCDOT
Emerging Contributor

Here is what I get...

Without forced SW rendering

Registry DisableHWAcceleration = 0
ProcessRenderMode = Default
HWND Render Mode = Default
RenderCapability.Tier = 2
*Exception*

NETFX

Registry DisableHWAcceleration = 0
ProcessRenderMode = SoftwareOnly
HWND Render Mode = Default
RenderCapability.Tier = 2
MapsApp.exe Information: 0 : Software rendering forced by process

NETCORE (both 3.1 and 5)

Registry DisableHWAcceleration = 0
ProcessRenderMode = SoftwareOnly
HWND Render Mode = Default
RenderCapability.Tier = 2
MapsApp Information: 0 : Software rendering forced by process

0 Kudos
MikeBrownNCDOT
Emerging Contributor

Is using software rendering only the long term solution or is this an issue that can be tracked?

0 Kudos
dotMorten_esri
Esri Notable Contributor

If would also be helpful if you can run this on the specific citrix instance in both NETFX and NET5 (put it in the main xaml page) and share the 4 debug messages it generates. I'd be curious if they are different.

 

var disable = Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Avalon.Graphics", "DisableHWAcceleration", 0);
System.Diagnostics.Debug.WriteLine("Registry DisableHWAcceleration = " + disable);
System.Diagnostics.Debug.WriteLine("ProcessRenderMode = " + System.Windows.Media.RenderOptions.ProcessRenderMode);
var hwndSource = PresentationSource.FromVisual(this) as System.Windows.Interop.HwndSource;
System.Diagnostics.Debug.WriteLine("HWND Render Mode = " + hwndSource?.CompositionTarget.RenderMode);
System.Diagnostics.Debug.WriteLine("RenderCapability.Tier = " + (System.Windows.Media.RenderCapability.Tier >> 16));

 

0 Kudos
MikeBrownNCDOT
Emerging Contributor

For anyone else that comes across this, it is a citrix  implementation issue with WPF/NETCORE. The forced software rendering is the solution until they resolve it on their end. 

0 Kudos