question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hang when a screen is connected/disconnected

See original GitHub issue

When 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:closed
  • Created 3 years ago
  • Comments:40 (33 by maintainers)

github_iconTop GitHub Comments

2reactions
holancecommented, Mar 18, 2021

@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.

1reaction
gregorsGitcommented, Mar 18, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found