Hang when a screen is connected/disconnected
See original GitHub issueWhen using SharpDX WPF without SwapChainRendering the GUI will hang at surfaceD3D?.InvalidateD3DImage() in DX11ImageSourceRenderHost PostRender() method. This can be tested with the SimpleDemo Example for WPF, just unplug a screen and it will hang. We have tested it on 3 different machines with different hardware, all running Windows 10, and it happens on all of them.
if I change the SurfaceD3D_IsFrontBufferAvailableChanged method to the following it seems to work,
` private void SurfaceD3D_IsFrontBufferAvailableChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e) { if (EffectsManager == null) { return; }
Logger.Log(HelixToolkit.Logger.LogLevel.Warning, $"SurfaceD3D front buffer changed. Value = {(bool)e.NewValue}");
if ((bool)e.NewValue)
{
frontBufferChange = false;
try
{
EndD3D();
if (surfaceD3D != null)
{
hasBackBuffer = false;
surfaceD3D.SetRenderTargetDX11(null);
// surfaceD3D.IsFrontBufferAvailableChanged -= SurfaceD3D_IsFrontBufferAvailableChanged;
RemoveAndDispose(ref surfaceD3D);
}
EffectsManager.DisposeAllResources();
EffectsManager.Reinitialize();
}
catch (Exception ex)
{
Logger.Log(HelixToolkit.Logger.LogLevel.Error, ex.Message);
}
}
}
`
But I guess someone with actual knowledge of what the code I have removed does might see why this is a bad idea.
Issue Analytics
- State:
- Created 3 years ago
- Comments:40 (33 by maintainers)
Top Results From Across the Web
Display set to disconnected and computer freezes when ...
When attempting to extend or duplicate the monitor in question, my computer freezes for 15-30 seconds and fails to connect.
Read more >How to fix your DisplayLink product from repeatedly ...
Firstly check that the video cable is fully plugged into the dock and the monitor. If it is loose, the monitor will be...
Read more >External Monitors repeatedly disconnecting, reconnecitng ...
Upon plugging in the dock immeidately hear repeating disconnect/reconnect chimes. Monitors flash on and off. Display locks up and freezes.
Read more >Moving a window from a disconnected monitor to ...
Go to screen resolution and where it says "change the appearance of your displays ", grab your secondary monitor and move it on...
Read more >Question - Second Monitor Keeps Disconnecting
Unplug HDMI cable and replugging · Switch sides of cable · Use different HDMI cable · Unplug monitor power and replugging · Restart...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kthyholdt @gregorsGit @eriove @oyvindse Hi all, I was finally able to reproduce some of the cases on monitor switch. I updated the PR to improve the recovery. Please try again.
I tested this PR now. Can´t get a black-screen or a crash, when switching resolutions or connecting an external pisplay. This is great for me. I´m happy.
Thanks.