Invalid FORMATETC structure

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

Comments

# re: Invalid FORMATETC structure
Gravatar 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!
Left by Steve on 3/9/2008 10:09 AM
# re: Invalid FORMATETC structure
Gravatar It's really obvious to reload projects when you encounter FORMATETC error. :D
Great! Thanks.
Left by Jakub on 4/11/2008 7:36 PM
# re: Invalid FORMATETC structure
Gravatar Thanks for this!
Left by Phil Shisbey on 5/23/2008 7:25 AM
# re: Invalid FORMATETC structure
Gravatar 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.
Left by Dave Durose on 8/29/2008 6:45 AM
# re: Invalid FORMATETC structure
Gravatar 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.

Left by Vincent DSouza on 9/11/2008 7:07 AM
# Installare Vs2008 mantenendo Vs2005
Gravatar
Left by Il Blog di Flavio on 10/27/2008 10:44 AM
# re: Invalid FORMATETC structure
Gravatar 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
Left by Johua on 11/18/2008 1:07 PM
# re: Invalid FORMATETC structure
Gravatar 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 .....:)
Left by Akhilesh Sharma on 12/24/2008 12:43 PM
# re: Invalid FORMATETC structure
Gravatar Yup, it worked for me too. Thanks a mil!
Left by Clarence on 1/21/2009 2:09 PM
# re: Invalid FORMATETC structure
Gravatar Unloaded Projects was my problem. Thanks!
Left by Eztorh on 3/3/2009 3:58 AM
# re: Invalid FORMATETC structure
Gravatar Unloaded project. I nearly went through the hassel of uninstalling/reinstalling telerik because of this. Thanks.
Left by carl on 5/1/2009 2:16 PM
# re: Invalid FORMATETC structure
Gravatar lost the whole afternoon yesterday, trying to figure out what is going on. thanks!
Left by razr1983 on 6/2/2009 10:57 AM
# re: Invalid FORMATETC structure
Gravatar 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.
Left by Lakario on 6/18/2009 12:56 PM
# re: Invalid FORMATETC structure
Gravatar Unloaded projects in the solution were causing the problem...I deleted them and it worked fine.
Left by nk on 8/25/2009 1:46 PM
# re: Invalid FORMATETC structure
Gravatar This saved me as well, had unloaded project, thanks so much!
Left by Will on 9/23/2009 2:41 AM
# re: Invalid FORMATETC structure
Gravatar 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.
Left by nandish on 9/23/2009 1:30 PM
# re: Invalid FORMATETC structure
Gravatar 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
Left by John on 9/28/2009 5:34 AM
# re: Invalid FORMATETC structure
Gravatar 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"
Left by Mohammed on 9/29/2009 3:21 PM
# re: Invalid FORMATETC structure
Gravatar i was about to pull my hairs out until I bumped into this..many thanks!!
Left by theresa on 10/5/2009 9:20 PM
# re: Invalid FORMATETC structure
Gravatar It worked when I added a web.config file in my project, then I could drag and drop the component into the web page.
Left by Franz on 10/19/2009 2:15 PM
# re: Invalid FORMATETC structure
Gravatar I removed the directory by mistake which was containing the referenced dll (AjaxToolKit.dll in my case)
I added tools again and it worked!
Left by sanjeev on 11/5/2009 2:07 AM
# re: Invalid FORMATETC structure
Gravatar Creatiing a new web.config worked for me thank you.
Left by Lanzo on 11/16/2009 11:16 AM
# re: Invalid FORMATETC structure
Gravatar 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
Left by Lionel on 2/12/2010 7:26 AM
# re: Invalid FORMATETC structure
Gravatar 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!
Left by andiwivs on 3/9/2010 6:33 AM
# re: Invalid FORMATETC structure
Gravatar hey thanks it works after reseting toolbar...............
Left by RANU on 5/2/2010 12:25 PM
# re: Invalid FORMATETC structure
Gravatar Thank you so much for this invaluable information.
I have been struggling with this problem for the last few weeks now............
Left by Rajneesh Sharma on 5/13/2010 3:30 AM
# re: Invalid FORMATETC structure
Gravatar Million thanks for you post, you save me. keep the good work
Left by elmaulo on 1/20/2013 7:09 PM
# re: Invalid FORMATETC structure
Gravatar Kudos - this was a real timesaver. In my case the problem was related to an unloaded (and unrelated) project in the solution. Cheers.
Left by Chris on 2/21/2013 11:52 AM

Leave Your Comment

Title*
Name*
Email (never displayed)
 (will show your gravatar)
Url
Comment*

Please add 5 and 7 and type the answer here:

Preview Your Comment.