Archive for October, 2012

An invalid VARIANT was detected during a conversion from an unmanaged VARIANT to a managed object – C#

I have got this exception after I fixed this error, please check this post and read the following…!

Error Message:

“An invalid VARIANT was detected during a conversion from an unmanaged VARIANT to a managed object. Passing invalid VARIANTs to the CLR can cause unexpected exceptions, corruption or data loss.”

Fix:
Just go to the Debug menu in Visual studio and select Exceptions

Click and expand the Manage Debugging Assistants

Find the Invalid Variant node and uncheck the Thrown check box.

Click Ok and run the application, That’s all! Happy Programming..! If you want to read more about this issue, just read this post! 🙂

References:

http://www.dotnetspider.com/forum/299944-System.outofmemoryexception.aspx

http://blogs.msdn.com/b/yangxind/archive/2006/03/21/556837.aspx

Advertisement

, , , , , , , , , ,

2 Comments

The CLR has been unable to transition from COM context 0xXXXXXXX to COM context 0xYYYYYYY for 60 seconds – C#

Few months ago, I was developing a small windows application which gathers data from Active Directory(AD) and dumping into a SQL database table. There were around 18 to 20,000 records involved in the process. After developing and testing components with few data, everything was okay but when I run the application I got following error message:

“The CLR has been unable to transition from COM context 0x2297ce0 to COM context 0x2297f30 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.”

I didn’t want to spend too much time with this error and I have found the quick fix from this site, if you want to know more about this please read there. 😉

Here are the steps to fix this error;

Step 1: Go to Debug –> Exceptions  in Visual Studio 2010 (I was using 2010)

Step 2: Click on  Managed Debug Assistants

Step 3:  Un-check the ContextSwitchDeadlock and click OK

That’s all,  the problem was fixed but I have got an other error, please see the same kind of solution here.

References:

http://dotnetdud.blogspot.ca/2009/01/clr-has-been-unable-to-transition-from.html

, , , , , , ,

2 Comments

Installing Visual Studio 2012 RC on Windows 8 Step By Step

I want to create a Metro style application using C# on Windows 8, I have already  installed Windows 8 release preview on my laptop. You can see some screen shots here. Now I need to install the Visual Studio 2012 and I tried to install the express version and I have got this error (version conflict)! The reason is, the latest Visual Studio RTM versions won’t install on Windows 8 Release Preview. So we need to choose the correct version of Visual Studio 2012, So I have chosen the Visual Studio 2012 RC to install on my Windows 8. Okay here are the steps:

Step 1: Download the Visual studio 2012 RC and double click on setup.exe. I have selected Ultimate version.

Step 2: Installation started

Step 3: Setup requires 8.95 GB minimum, click agree and Next

Step 4:  It will ask for optional features to install, I have selected all

Step 5: After clicking Install then a window will be opened. That will show the acquiring and applying process..!

Step 6: Wait for few minutes to complete these processes

Step 7: Yes, setup completed successfully and click the LAUNCH button

Step 8: After few minutes below window will ask you to choose the default environment setting and I have chosen  the general development setting. Click Start Visual Studio button.

Step 9: Visual studio is loading user settings

Step 10:  Yes..Visual Studio is ready to rockz..! Just click the new project and select the language, I have selected C#

Step 11: Choose the Metro Style application and continue your coding..! Okay I will try to post my first Metro Style Application next! 🙂

 

That’s all guys! Happy programming n metro styling..!

References:

http://www.microsoft.com/visualstudio/eng/downloads#vs

http://www.microsoft.com/en-us/download/details.aspx?id=29917

, , , , , , , , ,

3 Comments

“The type or namespace name ‘Workflow’ does not exist in the namespace ‘Microsoft.TeamFoundation.Build’ (are you missing an assembly reference?)” -TFS 2010

When I try to Deserialize Process Parameters to extract the BuildSettings, I have got the following error message:

“The type or namespace name ‘Workflow’ does not exist in the namespace ‘Microsoft.TeamFoundation.Build’ (are you missing an assembly reference?)”

But I have already added the dll to the project! (You can see the Dlls located at “C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies”)

After spending few minutes on the web I have found the solution from this post! The problem of this error is that, Visual Studio 2010 sets the .NET Framework Version to “.NET Framework 4 Client Profile” in default.

So the solution is to change the Target framework to .NET Framework 4

When you change the target framework, it will ask for the confirmation, just click Yes to continue..!

That’s all, we are done with this error!

Happy TFS programming..! Thanks R./

Refrences:

1. http://blogs.msdn.com/b/dustin_andrews/archive/2010/08/27/error-could-not-find-type-microsoft-teamfoundation-build-workflow-activities-in-assembly-microsoft-teamfoundation-build-workflow.aspx

2.http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/b42b69a9-b4be-46e5-a064-dbe97c9a0ad9

, , , , , , , ,

4 Comments