How can I speed up Visual Studio 2010 text editor render speed? - wpf

Visual Studio 2010 moved to using WPF for rendering the editor. This is leading to slowdowns while I am editing code, especially if I'm running something else that uses other video capabilities.
How can I speed this up? A new video card? New drivers? Settings?
What technologies does WPF use to render and what video card would complement it?

WPF uses DirectX for rendering, so a new top of the line video card would certainly help you out here. Any solid ATI or Nvidia card nowadays supports the latest and greatest DirectX.

The answer from #Charlie is absolutely spot on; and I thought about saying this on a comment but then figured I should put it as an answer.
Under certain circumstances (certainly on my desktop at work, which uses a workstation NVidia card), which are listed in the installation issues (connected with Hyper-V in particular), VS2010 fails to enable video acceleration even if it is available.
Open up Tools->Options, and on the very first options panel you'll see a group in the middle 'Visual Experience'. Just make sure that everything is checked in there and that it says 'Visual Studio is currently using hardware-accelerated rendering...'.
I don't think the hardware requirements for VS2010 are particularly heavy - but your card certainly must be DX capable.

Related

Adobe flex or WPF to write a visually rich desktop application

I'm interested in making a desktop application which I would want to use as a Desktop Manager. This kind-of goes to Desktop Enhancement Category. My requirements are:
Application has to be visually rich, with panels sliding,fading,wiping,rotating and etc.
It should also support flash playback. (swf, flv)
Animations/Transitions should run smoothly.
Lower CPU Usage.
My question is which is a better option to build this application. Microsoft's "WPF" or Adobe Flex(running in Adobe Air to run on desktop). And also respond as why it is better.
Be suspicious of anyone who will give you an answer like "Definately use xyz" to this question. There are pros and cons to both sides.
First, I think you might be confusing what WPF and Air are... WPF is a presentation layer on top of the .Net framework, where Air is a framework by itself. Apples and Oranges. If you want an analog to what Air is for the .Net stack, you probably want to look at Silverlight Out-Of-Browser, which is a much closer comparison to Air.
What is the difference, then, between WPF and Sliverlight OOB? Again, WPF sits on top of a very large .Net framework where Sliverlight OOB is a very light framework (in comparison) like air. It is the difference between a 200 MB download/install and a 12 MB download/install.
So, that being said, I think you should also ask what platforms this needs to run on. Silverlight OOB runs on Mac and Windows where WPF only runs on Windows. Air runs on Mac, Windows and Linux.
The next thing that I see is that you need to do SWF and FLV playback. This will be easier to achieve with Air, since it is native. You CAN do this with Silverlight OOB but you will find yourself rigging something up where you host an HTML control and run the flash movie inside the HTML control. It is a bit more clunky, but it will work.
Other than that, Air and SLOOB are very similar in features. It then comes down to your team and the expertise, IMO. If they are already familiar with the WPF/Silverlight, then a SLOOB app is well suited with minimal ramp-up. If your designers are more familiar with the Adobe suite of tools, then it might be easier to build a shiny app using Air.
In all, the decision between Air and Silverlight/WPF really comes down to preference. That is, once you get past any particular techincal limitations like the flash playback or OS support.
Hope this helps,
Brian

Visual Artifacts in Visual Studio 2010

I'm using VS 2010 on Windows Server 2003, running on a Dell Inspiron 9400 laptop. VS 2010 runs fine, except for persistent and random screen re-drawing issues. Samples of these are here.
These artifacts occur as the mouse moves over items that highlight on a mouse-over event, while scrolling, and when switching tabs. VS 2008 has non of these issues, so I assume that it is related to VS 2010's use of WPF. Could it be that my video card or driver is not up to the task of rendering WPF? Some other WPF applications (not Silverlight) also have some of these screen repainting problems.
I have tried a variety of settings in System Properties-->Advanced-->Performance Options-->Visual Effects, and in the related "Advanced" tab, Processor Scheduling is adjusted for best performance of programs.
Many thanks for any suggestions!
This has been answered for a while but I just fixed a similar issue with screen artifacting I was receiving in editor views of a MVC3 application. I'm running on a Core i7 3960X 6 core processor, the graphics card is a Radeon HD 6950 2GB. Needless to say, I shouldn't be getting these issues. It looked to be something related to my graphics card because going to Tools > Options and then unselecting "Use hardware graphics acceleration if available" caused the issue to stop occurring -
Visual Studio uses WPF which used the video card alot more than traditional GDI applications, I'd check your card drivers and make sure they're up to date.

Is WPF a safe choice for my application?

I'm maintaing a Windows Forms application which draws map data with overlays. I've been considering a move to WPF for the drawing layer, to take advantage of the graphics card rendering. In the last couple of weeks, however, I've started to have some doubts:
The new release of Evernote uses WPF, and doesn't run on Nvidia Quadro cards.
A WPF transitions demo from WindowsClient.net stopped rendering part-way through the animations on one of our test portables with Intel graphics (and yes, we had the latest Intel drivers).
Stack Overflow questions like this.
With the current Windows Forms codebase I can expect the application to run identically at every installation. WPF is much more dependent on the quality of the graphics card drivers, and I don't have the testing resources for comprehensive coverage.
I'm particularly interested to hear from people who've delivered a WPF application outside their own company or to a mixed population of machines - did hardware and driver specific bugs cause you a significant support burden?
We are facing some issues with the drivers of a specific graphic card vendor. Blue screens, a diagonal pixel displacement and application crashes have been observed. It is possible, however, to turn off the Hardware Acceleration on a per-application basis. Sad but true, this is the current workaround.
As already stated, I hope that the VS2010 release will help to improve the stability. Perhaps one day we'll see lists of WPF related fixes in the release notes of graphic card drivers. Along with the latest fixes for the game engine XYZ.
Our WPF application is running on Windows XP SP2 (minimum) and is ok apart from on some machines, if the application is running and the PC goes into screensave mode it blue screens and crashes the machine. This seems to be graphics card driver version related - some of our users run dual monitors.
We haven't cracked this issue yet.
WPF uses Direct3D for its rendering, falling over to software if necessary. My best guess is that some drivers say that they support something in hardware but really don't handle it properly, and that is when we see these incompatibility issues.
The answer to your question depends on how willing you are to have less compatibility with machines than your current codebase has. If you've ever visited support forums for PC games you see all sorts of threads about graphics problems. As most PC's are going to be more and more compatible with Vista/Win7 and therefore support D3D9/10, the issues should lessen. The real question is if the tradeoff for you is worth it.
My own experience deploying a WPF app, I had issues with the mediaelement not working the same on two very similar PC's. But the video subsystem is a different can of worms anyway. Otherwise it was fine but I wasn't doing anything special graphically, just standard xaml.

Switching to WPF. Is it time?

I'm considering switching from MFC to WPF.
My first concern is that there are too many users who don't have .NET with WPF installed yet. Can anybody point to a source containing the WPF penetration numbers?
My second concern is speed.
Any other considerations?
I've been banging away at WPF for a while now. It is brilliant, but it still has (occasional) holes you've to plug yourself. However all indications are .NET 4.0 will be a significant step forward.
I would say start now. The WPF learning curve is REALLY steep, and it'll be a while before you'll be releasing software to users, believe me. Also do yourself a favour and get the WPF Unleashed book. It's superior.
Speed isn't a consideration. The power WPF gives is well worth any drawbacks with speed, which - coming from Windows Forms - I haven't noticed to be honest.
What kind of application are you developing? If it's a wide-distribution desktop app that you want your grandmother to install, your concern about .NET 3.0/3.5 adoption is valid. So far from what I've seen, performance is less of a concern.
WPF penetration
First of all, Windows Vista and Windows 7 both have WPF preinstalled, which accounts for 35% of the market automatically. Windows XP has had it as it had .NET Framework 3.0 as an option in Windows Update for over three years, and many applications ship with it, so it is likely to also be installed on a high percentage of Windows XP machines. StatOwl indicates that about 80% of NET Framework installations are version 3 or above.
If you're shipping on CD it is no big deal to include the latest .NET Framework on the CD and have it install automatically. If users are downloading your application, it can contact Microsoft's web server to download and install the latest .NET Framework. Online ClickOnce deployment also has this capability if you want people to be able to start their application directly from the web browser without installing it.
So the bottom line is, you probably don't need to worry about whether people will have WPF installed on their machines or not unless your target market consists primarily of dial up customers on Windows XP who don't run much third-party software (i.e., they just run Windows and your application).
Speed
Not an issue. I have a 200 MHz Pentium Pro with 384 MB RAM from 1998 that I test my software on, and my WPF applications have comparable performance with equivalent MFC applications. If your WPF application uses lots of fancy graphics and animation it will run slowly on ancient CPUs and graphics cards, but so would an ordinary MFC application with the same features.
Don't even bother trying to use WPF if you are sticking with Visual Studio 2008 for the next year or two. The experience will be way too painful. I'm talking about "my IDE crashed again" type of pain.
If you are going to use VS 2010 in the near future, then WPF is a blast. Download the beta, a couple of themes off CodePlex, are start playing. Once you get past the (freaking huge) learning curve I think you will find it to be quite enjoyable.
IMHO, you should wait for Visual Studio 2010 and WPF 4.0 to make the actual migration. They will close some very annoying gaps in the product.
Meanwhile, you can try it out. In terms of coding/readability -- it's going to be WAAAY better than with MFC =)
As for the performance and platform -- it shouldn't be a problem unless you have any very special circumstances (like if you can't require users to install .NET).
Also see this related question on switching to WPF from Windows Forms.
If you are thinking about a larger, modular, appliation I recommend checking out Prism. It's a bit of a beast itself, but you should be able to tackle it after coming to grips with C#, Dependency Properties and XAML. Plus, learning Prism gave me a much better understanding of WPF/Silverlight, at least from the development/binding side.
Mike Taulty posted an excellent 10 part video series on Prism. It's a great way to get your head around the platform.
I'd also recommend the pages linked to from the Getting Started page on codeplex. After all that, you're probably ready to tackle the Reference Implementation which comes with the download.
A previous answer of mine might also help clear up any remaining confusion around Controllers/Presenters in the framework that you might have (I did).

DirectX programming on Windows, what is the preferred way?

I need to develop a part of a business application in a flashy eye candy way. Therefore wanted to see if I can use DirectX. Here's what I got.
First I read how using C/C++ is like shooting yourself on the foot and I should use DirectX.NET instead. I couldn't disagree. It's the 21st century.
Downloaded DirectX SDK but couldn't find the .NET assemblies in there. Searching the net now revealed that DirectX .NET (called MDX) is now obsolete (released in 2006). And that I should use XNA instead which was mainly developed for XBOX.
Downloaded XNA. But it won’t install because I don't have C#.NET Express 2005 SP1. Installed SP1 on my VS Pro 2005. But it won’t install still. It needs Express 2005 and exactly that single one version, not Pro, clearly not 2008.
Frustrated tried to download C#.NET Express which is free. But the link from MS which says C#.2005 actually downloads C#.2008, because C#.2005 is now obsolete.
And now I read that MS is now putting it's force behind WPF/silverlight. And XNA doesn't support DX10 and Vista doesn't come with DX9.
Now I have two choices:
Go 15 years back and code in plain old C/C++. At least C has proven itself to be timeless.
Try silverlight.
What would be your advice? Or am I missing something?
Udpate: Would like to add that DX10 is not backward compatible with any other DX version. SlimeDX looks really promissing. But as a very new package, I am not sure how much helpful the documentation and tutorials will be.
Udpate 2: It seems that the first download link that google brings up when searching for XNA download, which I used, is not the latest one. Thanks DouglasH for providing the link to v.3. Downloaing it. Probably it will work.
But then agian. Should I switch to WPF/Silverlight? Or go with XNA? Which one is better documented and future-profe?
More update: Vista realy doesn't come with DirectX 9 preinstalled [check by googling]. At least it didn't on my machine bnough last year. Googling for it revealed that I have to manually install DirectX 9 on Vista after downloading it from MS. But my attemet failed beucase hardware drivers for DX9/vista were missing or didn't work. I got the idea that it's not supported that well.
MS has stopped supporting the .net DirectX libraries. There is an open source alternative called SlimDX, and it works well. The documentation leaves some to be desired, but it can be puzzled together by using the DirectX C++ documentation and some common sense.
WPF does pretty good 3D stuff, and there are lot of fish eye panels and source code available for WPF, yes since MS has gone ways from their technology, in today's terms, we can not focus on only one technology by MS to make entire one business application.
Sure we are also tired of using multiple different versions of technologies even to do smallest parts, but I believe they are doing great job by serving billion machines, it sure isnt easy but WPF and .NET seem to be most stable technologies by microsoft and also they are spending good money on making completely managed operating system as well.
If you ever go back to C or C++, you might want to check out Simple DirectMedia Layer (SDL).
IMHO, it is much easier than DirectX.
URL: http://www.libsdl.org/
DirectX is fully backwards-compatible. Any DX9 application will run on Vista and DX10. As for XNA and VS2005 - that's a bit weird. That would make XNA effectively useless. Check if you haven't missed something.
couple of points, which version of XNA did you download. Here is the link for XNA Studio 3.0 which will run on Visual Studio 2008. http://www.microsoft.com/downloads/details.aspx?FamilyId=7D70D6ED-1EDD-4852-9883-9A33C0AD8FEE&displaylang=en
2nd, I sure hope that Vista has Direct X 9, since that is the version of direct X that the DWM runs on in Vista. I think you will find the DLLs for Direct X 9 and before and the DLL,s for DirectX 10 loaded in Vista. Or for that Matter Windows 7 which will also have directX 11 (edit 2 note that the DWM is built on DirectX10, with a software emulator for systems that don't have 3d video hardware, a dx10ondx9 drivers for those with directx 9 cards and of course full support for directx 10 cards).
edit,
Additionally if you downloaded the March directx sdk, you download, directx 9.0c, directx 10, 10.1 and the beta of directX 11. and I would have to check if DirectX 8.x is still included or not although DirectX 9 is backwards compatible with most of that platform.
Though I never worked directly with DirectX (little bit with OpenGL) - I would take WPF. The least-painful to implement (transparency, gradients, brushes, animations, etc.) and it provides solid-performance from what I have seen and experienced myself.
But yes, it's not platform-independent.

Resources