Invalid FORMATETC structure

1 minute read,

I recently ran into this problem with Visual Studio while trying to drag & drop a component onto a web page.

image

---------------------------  
Microsoft Visual Studio  
---------------------------
  
The operation could not be completed. Invalid FORMATETC
structure

image

---------------------------  
Microsoft Visual Studio  
---------------------------  
Attempted to read or write protected memory. This is often an indication
that other memory is corrupt.

 

I posted about the same exact problem previously.  Unfortunately, the solution to the problem that I posted a while ago involved reloading the project references.

But this time, for me, the project has grown to over 19 sub projects, and I wasn’t going to spend the next hour trying to reload all the project dependencies.  So, I attempted to find what was the root cause of the problem.

Aarthi at MSFT, said the underlying bottom line was a reference problem, but, again, nothing new.  So after playing with Visual Studio, I found how to re-produce the problem (at least for my case).  There are several situations when this error occurs:

1) Unloaded projects cause Invalid FORMATETC

I had recently unloaded a project that used Script#:

image

This was causing Visual Studio Toolbar to choke on the FORMATETC error.

2) Old System.Web.Extensions and ASP.NET 3.5

I’ve also found that if you’ve recently upgraded a web project that previously used the “downloaded” AJAX Extensions for ASP.NET 2.0 in VS2005.  If you still have the the “downloaded” System.Web.Extensions.dll lingering around in WebApp\Bin folder, the GAC, or referenced in your VS Toolbox then you’ll come across this error.  To resolve the issue, make sure you remove all references to the “downloaded” System.Web.Extensions.dll for ASP.NET 2.0 when using Visual Studio 2008.  ASP.NET 3.5 comes with System.Web.Extensions included which is why this error occurs in Visual Studio due to the two conflicting versions of System.Web.Extensions.

Hope that helps!
Brian

Updated:

Comments

Steve

I had the same problem, and your suggestion fixed it. I had a web deployment project which I had “unloaded” (as opposed to “remove”). Once I re-loaded the project, the problem immediately disappeared (did not have to restart VS). Thanks for posting this solution!

Dave Durose

Thank you, thank you! You just saved me. I was pulling out my hair over that error and had no idea what was going on. I removed an unloaded project from my solution and presto, I was able to drag out the ReportViewer control.

Vincent DSouza

The easiest way to solve this problem is rename your web.config file and add a brand new one and then copy any things you added to the original web.config to the new one. For example any appsettings or connection string etc.

You do not have to mess with anything else. Atlest I just did this when none of other solutions did not work.

Johua

I create a custom control and when I try to drag and drop that control from the toolbar I got the error. In the control I have a reference to System.Web.Extensions.dll but this is need, so the question is, what to do.
The error hapens in VS2008 and VS2005

Akhilesh Sharma

Thanks brother i am just learning and looking how Ajax tools worked but i was so much tired with this error but your suggestion is good i uninstall VS2008 and again install then the error is removed thanks …..:)

carl

Unloaded project. I nearly went through the hassel of uninstalling/reinstalling telerik because of this. Thanks.

Lakario

You can also try cleaning your solution (Build > Clean Solution). This is what finally fixed it for me after trying everything else in this list aside from creating a new project.

nandish

I tried loading and unloading project, tried to restart the computer. But the problem still exsts. I can’t uninstaill VS2008 as this is my office computer.
Please help me with this. Thanks in advance.

John

Hi,

i have download

I am unable to load ajax toolkit control
on my page i have done all step such as
loading,unloading,cleaning but problem still exixts.

any one can help me out

Mohammed

Reloading/unloading projects didnt work for me.

But surprisingly what worked for me was resetting the toolbox. Just right click anywhere on the toolbox and select “Reset toolbox”

Franz

It worked when I added a web.config file in my project, then I could drag and drop the component into the web page.

sanjeev

I removed the directory by mistake which was containing the referenced dll (AjaxToolKit.dll in my case)
I added tools again and it worked!

Lionel

Hi,
i had the problem with loading AjaxToolkit. I tried cleaning the solution, reboot and so on. At last, i cleaned my toolbox (reinit) and then reference the toolkit again in the toolbox. The source of the problem was that i moved the originaly referenced dll to another folder.
Regards

andiwivs

thanks sanjeev / Lionel, since starting the project I’d tidied up my desktop without thinking of the toolbox reference. Your comments pointed me in the right direction!

Rajneesh Sharma

Thank you so much for this invaluable information.
I have been struggling with this problem for the last few weeks now…………

Chris

Kudos - this was a real timesaver. In my case the problem was related to an unloaded (and unrelated) project in the solution. Cheers.

Leave a comment

Your email address will not be published. Required fields are marked *

Loading...