D3DImage loses device on WPF application - c#

I am developing a WPF application that displays a directX scene.
The code that generates the directX scene is not mine and I have no access to it. (Its not a public code I can references you guys to)
Everything was working fine until I had to format my PC and installed Windows 10. (Before that I had Windows 7)
Now I can't see the DirectX scene and the RenderCapability.Tier on WPF returns 0.
The code works on other computers (Windows 7 and Windows 10) so I'm guessing its something to do with my computer but nothing changed hardware-wise..
I tried reinstalling DirectX and I tried reinstalling the display driver (tried several different drivers) but nothing works I still get RenderCapability.Tier = 0.
The code that displays the DirectX scene is mostly taken from this link:
https://www.codeproject.com/Articles/28526/Introduction-to-D3DImage
I couldn't find any help around the internet that actually solved my problem.
Any help would be appreciated.
Thanks!

Run dxdiag.exe, Display tab, ensure it prints "D3D acceleration: enabled" and "No problems found".
Also the linked sample has a bug, on some systems you must use a query to wait for completion of rendering before passing the texture to WPF. Otherwise WPF may show incomplete renderings, or none at all. If you render with DX9, see this, you need D3DQUERYTYPE_EVENT query, issue D3DISSUE_END after you've done rendering, then sleep until GetData returns S_OK.

Related

Windows 7 Calculator breaks WPF Multi-touch?

I'm having a rather odd problem with a C# and WPF HMI I am working on currently. The HMI is a fairly complex program which allows the use to add and remove modules from a work area, dragging and resizing them to make the page they work on customizable. It works well, and after optimizations actually runs smoothly and works wonderfully with touch and animations. One gesture in particular is rather helpful, as you can (using multi-touch) place two fingers down on the screen and swipe left or right to change pages.
However, I have lately been getting complaints from our apps department that the touch will randomly stop working for any sort of complex movement, read as any sort of multi-touch. I spent a few hours tracking down what the problem was and it turned out, oddly enough to be linked to windows Calculator. Whenever calculator is opened, and subsequently closed, multi-touch ceases to function, and any breakpoints placed in the code show only a single touch being used. I took to the internet, and found a few articles corroborating the issue, but nothing even hinting at a fix other than don't allow calculator to work, which is sadly not an option as this HMI is meant for engineers who are manufacturing precision parts and they are a bit attached to calculator.
I stripped the problem down to its basics in which I made a simple c# and WPF touch app which kept track of how many touches it got, just to make sure its not just shoddy programming in the HMI. After getting the same results, no matter what I tried, I came here hoping someone else has run into and perhaps fixed this issue.
Here are some specs:
This HMI runs on Windows 7 and it is fully updated.
It is a C# program using Unity containers, Prism, and WPF
The touch is being handled through simple OnPreviewTouchDown and
TouchDown events
It doesn't matter if I run calculator through a Process in C# or if we run it from the actual OS, nor how we close the program, all permutations result in the same effect on every machine in the building with a touch screen.
It is an ELO touch screen with the newest drivers, though I have also tried it with a Vista Multitouch simulator and get the same results
Any sort of assistance or direction would be much appreciated. Thanks!
You are right. Microsoft released a fix recently for this issue for Windows 8 and other OS's, perhaps it applies to Windows 7 too.
Multi-touch gesture does not work after you exit the Calculator in Windows
Symptoms
This issue occurs in applications that are started before you
close the Windows Calculator (calc.exe) in Windows 8.1, Windows RT
8.1, or Windows Server 2012 R2.
Cause
This issue occurs because the Calculator exits and changes a
property. This causes the affected applications to stop responding to
multi-touch.
Resolution
We have released an update to resolve this issue.
See https://support.microsoft.com/en-us/kb/3024755
Workaround
To work around this issue, close and reopen the affected applications after the Calculator exits.

Windows 8 app blue screen after loading UI

While running performance tests my application suddenly started giving blue screen shortly after the UI was loaded.
In the code im receiving the following error:
{"Error HRESULT E_FAIL has been returned from a call to a COM component."}
"The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action.\r\n"
After looking around on google i wasn't able to find anything usefull. The main answers given didn't work such as installing driver updates or reinstalling the application. Keep in mind this is an app in development and it was working fine earlier this day. Between two test launches this happened.
EDIT
After testing the application on a tablet it turns out the development pc is the only machine with the UI loading bug. Going to look into it some more and ill let you guys know if i find a solution.
Edit 2
So after testing the app on the tablet and finding that it works fine there we decided to test the app on a 2nd development pc. Needless to say the same thing happened... in other words its a rendering issue that happens on windows 8.1 PC's but not on a tablet.
Facts as of now:
- Code worked yesterday, no longer works now
- Works on tablet but not on PC
- Nothing changed in the code since it worked
- Seems to happen in the rendering stages
- Bug happens when loading more than 23 items in a listview, app restores itself then
- Any more than 23 items and it stays bugged (dark blue screen but still responds to clicks)

Windows Phone 8 app randomly crashes with error code -2147220717 (0x80040313)

I am currently developing a stopwatch and timer app in C#/XAML for Windows Phone 8. While using my app on my phone, I found that it randomly closed out/crashed and that too at different points of use (i.e. I wasn't doing the same thing each time it closed out). While debugging, I found that my app closed out with the following error code in my output window:
"The program '[1100] TaskHost.exe' has exited with code -2147220717 (0x80040313)."
I am very confused as to why this is happening. I tried creating an entirely new solution and moving my code over and I've still been getting the same issue. I have tried using the app on multiple different devices, and the same thing happens (even in the Emulator). Sometimes the app crashes after 5 minutes of use, sometimes it crashes after 30 minutes of use, it's very unpredictable which makes it very hard to find the root of the problem. My app uses the XNA Framework to play an audio sound and the Coding4Fun Toolkit for a TimeSpanPicker control, and besides that there isn't much else that's particularly notable about my app. I have tried removing the playing of the audio file and removing references to the XNA Framework, and the problem persists.
Any ideas on what the problem could be?
Thanks in advance!
That what David said +
are you sure that the phone is not running out of memory?
Edit try a windows phone analysis(Alt +F1 | Debug->Start windows phone application analysis)
If you're using XNA framework in WP project you can get a crash when updating the UI thread.
You might need to run it through a Dispatcher?
Dispatcher.BeginInvoke(() => {
// Call your update UI methods here..
});
You might also find this post helpful:
http://social.msdn.microsoft.com/Forums/wpapps/en-US/c2751845-cb70-4301-aa1a-796fa1bb8e8c/the-program-241435222-taskhostexe-managed-has-exited-with-code-0-0x0

Display Driver Crashes On Second Run Of App

Basically, I have a super simple metro app I'm working on at the moment. All it does at the moment is display a webcam video stream. All the relevant current code is below (capture is a CaptureElement defined in XAML, and mediaCapture is of type MediaCapture). The code works perfectly the first time I run the program in debug local system mode from VS 2012. I then close the app by dragging it from the top. However, the next time I go to run the program, my display driver crashes - from the Windows Event Viewer: "Display driver igfx stopped responding and has successfully recovered.". I'm new to doing any development in C#, so I'm not really sure where to begin looking for what's causing this. Any help would be appreciated, thanks.
private async void init()
{
mediaCapture = new MediaCapture();
MediaCaptureInitializationSettings mc = new MediaCaptureInitializationSettings();
mc.StreamingCaptureMode = StreamingCaptureMode.Video;
await mediaCapture.InitializeAsync(mc);
capture.Source = mediaCapture;
await mediaCapture.StartPreviewAsync();
}
Note: init() is called from the constructor of MainPage, the only page currently.
Note 2: Here's an error that pops up when I run it in the simulator (this error is from my regular desktop environment though (sorry for the poor quality). I'm using a Windows 7 machine I recently upgraded to Windows 8 RTM:
Note 3: The Windows built in Camera app works fine.
By the message i guess, the problem is in your graphic card drivers, if you're using the default/included ones, try using some more specific (like the ones you can get at Nvidia or ATI websites) if you're using the drivers provided by the manufacturer of your card, then try the default/generic ones. A good option could be debbuging your application inside the Simulator instead of the real machine or (if you can) use a virtual machine.
So, it turns out it was a silly mistake by myself. Hopefully if anyone else is doing the same thing though they can find this. What happened apparently is that when I closed the app, VS 2012 continued debugging. When I reopened the app (from the start menu) VS was still debugging the last run. This somehow led to the display driver crashing. If anyone wants to explain in more depth why this would happen, I'd be glad. I'll mark this as the correct answer after I'm certain that this was causing all the display driver crashes.

videoinput with C#

I have a video capture (usb-webcam) application that currently uses very old VFW with p-Invoke hookup to C#. I'm trying to replace it and I stumbled on the VideoInput library, and later found VideoInputSharp. I managed to get VideoInputSharp into my application and it gives me the frame rate and camera control I need. The problem is that on some PCs the call to VideoInput.IsFrameNew() never returns true even though the device is set up (VideoInput.IsDeviceSetup() does return true).
I've successfully run this on a W7x64 system and a XPx32 system, but does not work on W7x32. Any thoughts on why this is happening?
UPDATE1:
Since originally posting this question, I've found that on the systems that don't work, I am still able to call VI.ShowSettingsWindow() to generate a dialog box; however, it is a different dialog box than I see on the systems that work (even though it is the same camera/driver). Is this a clue? Also note that I'm running the same version of DirectX on the machine it works with and the machine it doesn't work with.
UPDATE2:
The systems that this is failing on are W7x32 and W7x64 both using a Microsoft LifeCam. I found yesterday that if I remove the Microsoft LifeCam software from the machine it then works! I sure could use an explanation for that.

Categories

Resources