Value was either too large or too small for a UInt32. TFS Error

I got this error in Visual Studio 2015 checking in to TFS.
“Value was either too large or too small for a UInt32.”

WTF? Turns out it is because I had an open sql query file that wasn’t saved and it get angry.

Really stupid error that should read :” You have an saved file, please save all files before checking in”

Wow. That would have taken the developer a small minute. Oh yeah, this is probably an unhandled exception, caught higher up and presented to us as an amazing insight into what was wrong.

Anyway, Save All before checking in and you will be fine.

Happy Coding!

The type initializer for +’System.Windows.PresentationSource’ threw an exception.

I had an issue with a 3rd party control. I couldn’t blame them too much since the issue only happened in the WPF control hosted in a MFC C++ application. brutal for sure.

Why host WPF in C++? That is a question for another time, but let’s just say its an app written in the early 90’s and still has been rewritten, just bolted on and refactored.

Well, I created the test application and it worked great on my machine at home. I loaded it into my work computer and blammo, it threw up on the get handle call. WTF?

If you step into the .NET source(slow but very helpful), you get this.

System.Runtime.Versioning.BinaryCompatibility.ParseTargetFrameworkMonikerIn/toEnum in the call stack. and  NULL parameter exception.

Turns out through some goofiness in VC++, it will insert a null value in a manifest.

The fix is really easy. Delete all the files in your AppData\Local\Temp folder under your profile.

Here is a link to a guy who wrote about it in much more detail, but man that was non-intuitive fix. It worked though, so I am happy!

Thanks Microsoft for stealing another hour of my life. Thanks Telerik for being there to steal a week trying to reproduce bugs in your silly slow controls.

Happy coding!

 

How to reclassify your project into a WPF project in Visual Studio

How to change project type to wpf class library in Visual Studio 2012.

Are you looking to change your project from a normal C# class library to a Window Presentation Framework project?

Well, it is not that hard once you learn the trick. It took me a little while to dig up the info, so hopefully this saves you some time.

Open your csproj file in notepad. Look for the ProjectTypeGuids key. If not found, add it.

Here is what it should look like when your done.

<ProjectTypeGuids>{60DC8134-EBA5-43B8-BCC9-BB4BC16C2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Visual Studio 2012 and Visual Studio 2010 use these to identify the project type. The settings above make it a C# WPF app.

Example:

SNAGHTML77868191

 

Happy Coding!

How to ignore whitespace formatting in merge conflicts in TFS in Visual Studio 2010.

Hate when you see all Blue because someone reformatted the code?

Fix it.

In Visual Studio, select Tools / Options / Source Control / Visual Studio Team Foundation System and click the Configure User Tools button.

In the dialog, Add an item with the following settings.

  • Extension : .*
  • Operation : Compare
  • Command : C:Program FilesMicrosoft Visual Studio 10.0Common7IDEdiffmerge.exe
  • Arguments : %1 %2 %6 %7 %5 /ignorespace

If you are 64 bit,

C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDEdiffmerge.exe

image

 

image

Happy Coding!

Visual Studio 2010 – Intellisense nonsense

I started getting really annoyed with the Intellisense in VS 2010. It doesn’t automatically highlight the best match for what I am typing. It seems to loosely highlight it, but hitting enter or . doesn’t act upon it.

Well, I figured out how to make it work, but requires a small change in workflow. Hit TAB. Start typing, and when the box highlights AROUND, because it doesn’t seem to select it, hit the TAB key.

Easy solution to an annoying feature. I switch between 2008 and 2010 so much I can’t remember if 2010 has always been this way, or I pissed it off.

Annoying Intellisense irritating me

Happy Coding!

How to ignore the return code of a prebuild event tool in Visual Studio 2005/2008/2010…

I have seen a ton of crazy workarounds for handling this seemingly simple task. It turns out that most people change the project targets and other nitty gritty manual edit file changes. It turns out the way I am doing it is much easier.

Visual Studio gets really annoyed when a tool returns anything but zero,and it has good reason. The compiler directives tell it to do that in your project file. So, what the remedy, make every tool return zero…Impossible you say! Nope. Easy.

So, it’s so easy it will probably annoy you. Take your scripts and put all the calls into a batch file. Make the last line of the batch file EXIT 0

Yup Exit 0 <– thats a zero.

Here is the one I use to disable my service when I build, so I don’t get the annoying file in use error.

net stop "Your service name here"
EXIT 0

Happy coding!

TFS Corrupt Cache: Team Foundation Server just won’t let go of stale data

Does your Team Foundation Server work items get a little stale and not want to refresh? Your queries stop working right?

Your manager wondering why you aren’t taking on the new critical tasks assigned to you?

Well, you may be a victim of the TFS corrupt cache.

Simple fix:

Run the following after shutting down all Visual Studio instances.

del /S /F %userprofile%local settingsapplication datamicrosoftTeam Foundation*.*

Hopefully this gets you out of seeing the same old thing over and over.

Happy Coding!

Visual Studio 2008 Designer crashes when editing WPF xaml…

I have been banging my head on the wall about my Visual Studio just disappearing from view whenever I open one of my WPF forms. As you can imagine, this puts a pretty big cramp in development efforts when you can never use the designer.

I looked in my event viewer and found this error hanging out.

Event Type:	Error
Event Source:	.NET Runtime
Event Category:	None
Event ID:	1023
Date:		3/10/2010
Time:		11:03:02 AM
User:		N/A
Computer:	BSEEKFORD00111
Description:
.NET Runtime version 2.0.50727.3603 - Fatal Execution Engine Error (7A2E10D2) (0)

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

The resolution is that it turns out your probably installed Power Commands for Visual Studio 2008. You can uninstall them, which sucks. Or you can apply a really easy patch.

Go to your devenv.exe.config file sitting in your Program FilesMicrosoft Visual Studio 9Common7IDE

Add this to the bottom of the dependent assemblies section:

<dependentAssembly>

<assemblyIdentity name="Microsoft.PowerCommands" publicKeyToken="null" culture="neutral"/>

<codeBase version="1.1.0.0" href="C:Program FilesPowerCommandsMicrosoft.PowerCommands.dll"/>

</dependentAssembly>

Start Visual Studio back up and rock on.

Note: Make sure the path you enter matches where everything is installed. DUH!

Credits to these guys for all their help.

Happy Coding!

ATLRX.H missing, oh where have you gone? At least in Visual Studio 2008

I pulled out some old code to work on a legacy project of mine and lo and behold I get “Error 29 fatal error C1083: Cannot open include file: ‘atlrx.h’: No such file or directory”. Not exactly a pretty error and worse, this file was part of the standard ATL includes.

So what the heck happened to my good ole’ friend? Well, the geniuses at Microsoft decided it would be better to sit on CodePlex. So, you can download it from here.

The library is called the ATL Server Library. Just download it, and set your include path in Visual Studio to point to it. Or get creative and copy the files into an existing include path in the program files folder(under the visual studio folder of course.

Happy Coding!

Visual C++, Precompiled Headers and Windows 7

I upgraded to Windows 7 and I really am enjoying the new interface….but….. I went to compile my ActiveX toolset projects that are all written in C++ and I started getting  precompiled header errors.

So I rebuilt and rebuilt and still got the error:

Error    1    fatal error C1859: ‘.Release/HTTP Wizard.pch’ unexpected precompiled header error, simply rerunning the compiler might fix this problem    d:SSIC++v3HTTP Wizard v3HTTPAccess.cpp    5    HTTP Wizard

So I rebuilt and rebuilt. No avail. I turned off Precompiled headers and then everything worked fine. What a pain.

It turned out the reason is due to the virtual tables being rebased by Windows 7 for security which totally screws up the precompiled header logic, which requires the headers to be in the same memory locations.

Apparently the development team at Microsoft knows about the issue and will eventually fix it. So, lets hope that service pack comes out soon.

I guess I am lucky my build machine is really beefy, but for active development having the precompiled header is nice.

So, go have a Margarita and the  compiler errors won’t bother you as much…..