Home » .Net Framework

troubleshooting a .NET/WPF 4.0 application requiring 3.5 SP1 to run

I am very confused what is going on with my application.

I have a complex C++/CLI and WPF application that I've migrated to .NET 4 to take advantage of the WPF goodies. I'm having problems though with the deployment and running of our app on fresh XP installs.

Right now the installer will install the Visual C++ 2010 redist and .Net 4 client profile, then our application. On XP this doesn't seem to be enough. In it's current state it will crash upon running the .exe. By chance I guessed perhaps our CLI based .dll has some dependencies on some old libs, so I also installed the Visual C++ 2008 redist. Now when I run I see the splash screen for our application, but I get an error dialog that says:

"To run this application, you first must install one of the following versions of the .NET Framework: 2.0.50727"

If I click the yes button it redirects me to install .Net 4 again. For kicks I tried installing the .NET 3.5 SP1 framework and my application runs.

How can I troubleshoot what is going on?


4 Answers Found


Answer 1

If I run  the application  on my Win7 developer machine (with all .NETs installed) I can one reference to a .NET 2.0 lib. 


'Kudu.exe': Loaded 'C:\Windows\SysWOW64\WindowsCodecs.dll', Exports loaded.

'Kudu.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll', Exports loaded.

'Kudu.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4927_none_d08a205e442db5b5\msvcr80.dll', Exports loaded.

Any reason why this is pointing to the old lib?


Answer 2

Check your references (either in vs.net or use reflector on your binaries) and perhaps your config file to see if they reference they 2.x framework.


Answer 3

The only assemblies not for runtime v.40.30319 are the Microsoft Office interop tools included with VS2010. Both these say they use runtime version 1.1. In addition i'm using Microsoft.mshtml which uses 1.0. These have to be supported in .net 4 though, don't they?

Answer 4

Found it. I'm using StrongName.h to check the signing of my assemblies. Have to use ICLRStrongName now, which there's no documentation how to.... 


Hello everyone, on the project I'm on, we have opted for a plugin architecture where each WPF component is compiled as a library.  A taskbar-like UI also written in WPF serves as the main UI with buttons that will call each individual UI component when triggered.

The location of each library is defined in an XML file, which is then looped through our PluginManager.  We then call the Application.Run(), which is a Windows.Form function call.

When we found that our TextBoxes no longer accepts certain inputs (well noted for those who did interop between WinForms and WPF) we realized there must be another way to start the Application that doesn't require use of WinForm function call.  We tried calling the Application.Current.Run() (the WPF version), and though the taskbar shows up, it immediately crashed with a NullRef exception.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using OurCustom.Plugins;

namespace Test
 internalstaticclass Program
  privatestaticvoid Main()
   //Loads the plugins

   //Starts the message loop


So basically we changed the Application.Run() portion to Application.Current.Run(), removed the ref to WinForms and added PresentationFramework and WindowsBase.  Now we're getting NullRef Exception on that Application.Current.Run() even though the taskbar did show up.

Please let me know if more info is needed.  We currently have a workaround solution but it isn't pretty...it involves enabling KeyboardInterop in to the ElementHost in order for the TextBox to behave properly.  There must be a more straightforward solution to this issue.  Thanks in advance.


Cheers, DJWP



I am making an application that uses a database (currently, an access database).  If I run this application on my PC, everything goes well.  If I run it on a computer without office, it fails (because it needs OLEDB to be installed). 
Is there any way I can make a C# application in .NET that uses a database but doesn't need anything to be installed on the client's PC?


Thanks in advance,





I'm using the D3DImage in order to render video from DirectShow, through a VMR9 custom allocator into WPF.

The custom allocator is based on the example that is included in the Windows SDK and the MSDN article, "Walkthrough: Creating Direct3D9 Content for Hosting in WPF", found here, http://msdn.microsoft.com/en-us/library/cc656716.aspx

And the "Walkthrough: Hosting Direct3D9 Content in WPF" MSDN article, found here, http://msdn.microsoft.com/en-us/library/cc656785.aspx

This all worked fine with .NET 3.5 SP1, however it goes horribly wrong with .NET 4.

According to the WPF3D Team blog, there has been a number of bug fixes done on D3DImage for the .NET 4 release and I suspect that a number of other changes has  been done with how WPF uses DirectX in general as well and now something is a bit odd in WPF.


In my custom allocator at the InitializeDevice method, I create a render target that will be used by VMR9 to render the video frame into.

 hr = m_D3DDev->CreateRenderTarget(
  m_D3DDevEx ? FALSE : TRUE, // Lockable RT required for good XP perf

Then when a frame is ready for presentation, that render target surface is passed to the D3DImage instance, (IsFrontBufferAvailable/Lock/SetBackBuffer/AddDirtyRect/Unlock). This is all done in a similar way as two the walkthrough articles describes linked above.

With .NET 3.5 SP1 this worked without any problems, however the same code no longer works correctly with .NET 4. What happens is that after a short while, the WPF render thread hangs or dies and stops rendering, the WPF application is still running, intercepting click events etc, but no changes to the UI is rendered.

When this happens and I have the D3D debug runtime enabled, there is A LOT of these errors,

"Direct3D9: (ERROR) :Error trying to lock driver surface"

(Before with 3.5 SP1, these errors only showed on rare occasions.)

And just before WPF stops rendering, there is this error,

"Direct3D9: (ERROR) :UnlockRect failed; surface wasn't locked."

In some occasions I have also got error messages about BeginScene being called within a scene all ready, or if it was EndScene being called when not in a scene, something that WPF seems to be calling.

Changing the render target above to always be lockable, doesn't make any difference.

If I instead of using CreateRenderTarget use the VMR9 surface helper,

  lpAllocInfo->dwFlags |= VMR9AllocFlag_TextureSurface;
  hr = m_lpIVMRSurfAllocNotify->AllocateSurfaceHelper(lpAllocInfo, lpNumBuffers, & m_surfaces.at(0) );

Then everything is fine and works just as before. Interestingly though, if I comment out the dwFlags changes, so a TextureSurface is not requested, then I get the same problem as when using CreateRenderTarget to create the surface.

It seems that D3DImage no longer works correctly with all surface types and configurations that it used to do in .NET 3.5 SP1, perhaps something is broken in .NET 4?

My immediate problem though is that I need to be able to specify if the surface should be lockable or not. When using the AllocateSurfaceHelper the created surface is not lockable, which causes bad performance in XP.

How can I create my own lockable surface that works with D3DImage in .NET 4? I'm not really sure what effect the "VMR9AllocFlag_TextureSurface" flag has on the surface that is created and I have no idea how that surface is created by the helper.

Again, this works with .NET 3.5 SP1 and it follows pretty much the MSDN walkthroughs, it's in production today and runs without any problems on hundreds of different computers. So it's a bit odd that it no longer works with .NET 4.

Any ideas?

I am running on a Windows 7 computer with an NVIDIA GeForce 250 GTS graphics card.



I am trying to run a WPF application from a console application (e.g. a .bat file) but need to be able to receive console and error output from the WPF application.

I have console.writeline() and console.error.writeline commands in the WPF application but these are not received by the console application.

I would also like to receive a status value from the WPF on completion.

Is this possible?

If so could you give me a simple example using VB?


We have an ASP.NET web application that, among other things, allows users to upload photographs.

We are seeing failures like the following, fairly frequently:

System.OutOfMemoryException: Out of memory.

at System.Drawing.Graphics.CheckErrorStatus(Int32 status)

at System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y, Int32 width, Int32 height)

When we upload the same photograph manually, it uploads with no issues.

When this issue happened recently, I captured a crash dump and ran it through windbg and debugdiag.

debugdiag had this to say:

Virtual Memory Summary

Size of largest free VM block  48.13 MBytes
Free memory fragmentation  92.01%
Free Memory  602.60 MBytes   (29.42% of Total Memory)
Reserved Memory  668.64 MBytes   (32.65% of Total Memory)
Committed Memory  776.69 MBytes   (37.93% of Total Memory)
Total Memory  2.00 GBytes
Largest free block at  0x00000000`572e0000



According to windbg we have 148 pinned objects:

0:000> !gchandles

GC Handle Statistics:

Strong Handles: 965

Pinned Handles: 138

Async Pinned Handles: 10

Ref Count Handles: 3

Weak Long Handles: 770

Weak Short Handles: 122

Other Handles: 0

I realize that pinned objects tend to fragment the heap. But I am not sure that having 148 pinned objects is causing this problem, because after I "fixed" the problem by resetting the app pool, I took another crash dump, and found that there were 122 pinned objects in the heaps when we were not having this problem.

Finally, I ran PerfMon on the server, and graphed the large object heap size and the number of pinned objects. The large object heap size goes up and down a bit, but stays about the same. However, the number of pinned objects is spiking periodically. By spike I mean the value goes from about 8 to about 170, then back to about 8, over the span of 1 or 2 minutes.

Can you suggest some "next steps" for me to follow to determine exactly what is causing this heap fragmentation issue?

Eric Terrell


Smart Table ( smart technlogies)

I am trying to downloaded VS2008 SP1

I get a window Set-up has detected that my computer does not meet the requirements to install

this update.

A compatible version of Visual Studio 2008 (ENU) product family and is not compatible with any express editions

I have vista HP Pavillion HP windows vista 64 bit a lot or ram and memory..

I install 2010 uninstall it I probably uninstall the set up Can u help me ASAP

and with 2010 smart table would not run properly it needs that version


Hi all,

I apologise if this is a noob question.

I have a VC++ application that i compile with VS2008 SP1. It depends on the CRT libraries.

I would like to be able to send this to clients on a HDD so they can run straight from the HDD or just copy it to a folder on their machine.

I can make and installer that would install the merge modules but that might be a problem for some people.

Is it possible to do this? Can i copy the content of C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT in the bin folder of the application?

Is there any guide/document anyone can point me to?

What other things i would have to copy?

Looking at the manifest of my compiled exe i can see only the CRT specified.




I am having what seems like a common problem with a ComboBox.  I have read several posts and answers in this forum, but either the answers do not work for me (presumably similar symptons but different root cause) or they do not make sense, often not helped by the code being in C#.

On opening the form for the first time and clicking on the ComboBox down-arrow, the list of data items is shown correctly.  Clicking on one of these sets cbx1.SelectedIndex correctly, but cbx1.SelectedItem and the displayed value are both always set to "System.Data.DataRowView".  (The SelectionChanged event handler is making no changes to cbx1 at all, just reporting values.)  The ComboBox is working correctly for typed-in data, which can be saved successfully as a new value in the database.

I am using VS 2008 Pro SP1 Version 9.0.30729.1 on XP SP3.

My code is based on a WPF example downloaded from MSDN a while ago.

The database:

table Table1, with just one column Name1


<ComboBox Name="cbx1"
    ItemsSource="{Binding Path={}}"
                <Label Content="{Binding Path=Name1}"></Label>

The initialisation code:

Private taManager As New App1DataSetTableAdapters.TableAdapterManager
Private ta1 As New App1DataSetTableAdapters.Table1TableAdapter
Private App1Data As New App1DataSet
Public App1View As CollectionView
taManager.Table1TableAdapter = Me.ta1
cbx1.ItemsSource = Me.App1Data.Table1
Me.DataContext = Me.App1Data.Table1
Me.App1View = CollectionViewSource.GetDefaultView(Me.App1Data.Table1)

What am I doing wrong?


I have a huge text in a RichTextBox. There are few things in that text that I want to pick up and add in a ListView control in 2 columns. Each words I need from that text box are not identical but has got some identical keyword before and after them. Let me give you a sample...

"href ='displayCompany.php?name=BERGERPBL'  class='abhead' target='_top'>BERGERPBL&nbsp;958.00&nbsp;<img src='tkdown.gif' border='0'><br>-25.30&nbsp;&nbsp;&nbsp;&nbsp;-2.57%</font></span></a><br></td></tr></table></td><td valign='top' height='30'><table width="120" border="0" cellspacing="0" cellpadding="0"><tr><td height='30' width='100%'><a href ='displayCompany.php?name=BEXIMCO'  class='abhead' target='_top'>BEXIMCO&nbsp;308.00&nbsp;<img src='tkdown.gif' border='0'><br>-2.90&nbsp;&nbsp;&nbsp;&nbsp;-0.93%</font></span></a><br></td></tr></table></td><td valign='top' height='30'><table width="110" border="0" cellspacing="0" cellpadding="0"><tr><td height='30' width='100%'><a href ='displayCompany.php?name=BEXTEX'  class='abhead' target='_top'>BEXTEX&nbsp;71.60&nbsp;<img src='tkup.gif' border='0'><br>1.30&nbsp;&nbsp;&nbsp;&nbsp;1.85%</font></span></a><br></td></tr></table></td><td valign='top' height='30'><table width="105" border="0" cellspacing="0" cellpadding="0"><tr><td height='30' width='100%'><a href ='displayCompany.php?name=BGIC'  class='abhead'"

Here, I need to pick up the words, "BERGERPBL ", "BEXIMCO ", "BEXTEX " for the 1st column. They have got prefix "displayCompany.php?name=" and suffix "'  class=" after them.

And for the 2nd column I want the values having prefix [1st column value]&nbsp; and suffix &nbsp;

The listview would look like this:

Company             LTP

BERGERPBL            958.00

BEXIMCO                 308.00

BEXTEX                   71.60

BGIC                         [It is not in the source above since it is only a part of the main source]

So how would I do it. I need a code in WPF VB.NET. I use visual studio 2010. Remember, this is just a short sample. The real document is far larger.

P.S. Upper cases are not applicable. Because they may also be in lower cases.


Hello - we are installing a new 2008r2 Reporting Server.  When I start IE8 "as administrator" it runs fine.  If a colleague just starts IE8 and enters the URL he gets an rsAccessDenied.  I have searched and searched on this, but to no avail.

Help appreciated!


I have inherited a 1000-line stored procedure which produces XML by using FOR XML EXPLICIT. My problem is that it works most of the time. In some scenarios I get the error:

Parent tag ID 2 is not among the open tags. FOR XML EXPLICIT requires parent tags to be opened first. Check the ordering of the result set. Number:6833 Severity:16 State:1

I need ideas on how to troubleshoot this. I need to find out where the nesting is failing. It's probably a case of a parent row not being emitted but a child row is. Worse, the problem only happens on our test system, which is probably missing some of the Production data. The question is how to find this out of thousands of rows?

One wild idea that I'm sure doesn't exist: SQL Server has an algorithm it is using to determine whether the rows are in the correct order. It would be wonderful (if unlikely) if there were a tool that would look at my resultset (without the FOR XML EXPLICIT) and find out where the problem is, then tell me about it.

In the absence of such a tool, I welcome any suggestions on how to debug this. The XML (when it works) is four levels deep!





I am trying to figure out what are the basic assemblies required to run a basic ASP.NET 4.0 website. Say.. a website with just a label in it. I looked online and didn't find a list there. I know installing the framework 4.0 will give me all the dlls but I just need the basic ones that will make a basic site work on ASP.NET 4.0.





I am trying to figure out what are the basic assemblies required to run a basic ASP.NET 4.0 website. Say.. a website with just a label in it. I looked online and didn't find a list there. I know installing the framework 4.0 will give me all the dlls but I just need the basic ones that will make a basic site work on ASP.NET 4.0.





I am trying to figure out what are the basic assemblies required to run a basic ASP.NET 4.0 website. Say.. a website with just a label in it. I looked online and didn't find a list there. I know installing the framework 4.0 will give me all the dlls but I just need the basic ones that will make a basic site work on ASP.NET 4.0.



We have a solution that worked fine in .NET 2.0. Solution consists of around 20 projetcs and these projects depend on .NET FW assemblies as well as on other projects in the same solution. We migrated the solution to .NET 4.0 & VS 2010 successfully and now the application works fine on developer's machines without any exceptions when run as a normal application.

Our .NET 2.0 based app was deployed using ClickOnce and used to work fine on client machines. Migrating the deployment to .NET 4.0 ClickOnce was partially successful to the extent that the app downloads to the client machine successfully and starts up as well. During the startup (after passing the logon screen) we see the following exception raised.

InstantiatePlugin: Instantiate class Ifs.Fnd.Explorer.Extenders.ApplicationSearchManager.FndApplicationSearchManager from assembly Ifs.Fnd.Explorer.Extenders, Version=, Culture=neutral, PublicKeyToken=ff90f512e10aef0d.

Reason: Could not load file or assembly 'Ifs.Fnd.Explorer.Extenders.resources, Version=, Culture=en, PublicKeyToken=ff90f512e10aef0d' or one of its dependencies. The system cannot find the file specified.

Inner stack:   
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark)
at System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at Ifs.Fnd.ResourceManager.FndResourceManager.FndGetResourceSet(CultureInfo culture)
at Ifs.Fnd.ResourceManager.FndResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.GetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
at System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
at System.ComponentModel.ComponentResourceManager.ApplyResources(Object value, String objectName, CultureInfo culture)
at Ifs.Fnd.ResourceManager.FndResourceManager.ApplyResources(Object value, String objectName, CultureInfo culture)
at System.ComponentModel.ComponentResourceManager.ApplyResources(Object value, String objectName)
at Ifs.Fnd.Explorer.Extenders.ApplicationSearchManager.FndApplicationSearchManager.InitializeComponent()
at Ifs.Fnd.Explorer.Extenders.ApplicationSearchManager.FndApplicationSearchManager..ctor()"

Steps that I followed when converting the solution to .NET 4.0 (previously we worked with VS 2005, .NET 2.0)

1. Opened the solution in VS 2010 and converted all projects using the conversion wizard.
2. in each project set the target platform as .NET 4.0.
3. In the main project that produced the executable output, turned off manifest generation.
4. in app.exe.config file added support for .NET 4.0 runtime (<supportedRuntime version="v4.0.30319"/>)
5. in deployment manifest added <compatibleFrameworks> section.
6. signed both application, deployment manifests.

After these steps I would expect the app to work as a normal clickonce app. Anything that I  have missed?
Specifically, anything that i have missed that would affect resource generation?


I've just upgraded my application from .net 3.5 to 4.0.
Basically it displays maps by reading a custom file type and generating wpf visuals.
Using .net 3.5 it took about 5 seconds to open a file.
Now using .net 4 it takes about 40 seconds!
(I am running the release version)

Why is there such a big difference?


IDE: Hello everybody,, I am using an Visual studio 2010 ultimate edition. And here i have getting an error "unable to connect to the asp.net development server" while i try to run the Web Application by pressing F5 key from Web Application Project .. Can any tell me whats the problem and how can i resolve it.

plz soon ...


i just started learning windows presentation foundation because i read so much about it being a good means of creating rich UI. i also just realised that it does not run on firefox and GChrome. is this not a big limitation? is there a solution to this problem?


can i know what .net framework is required for my application that has been developed under Microsoft Visual Basic 2010 Express.


i only receive the message "microsoft chart controls for microsoft .net framework 3.5 does not apply or is blocked by another condition..."

Can anyone help me?

Thanks a lot



<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure