Tag Archives: visualstudio

FormatException in WPF DataBinding

While working on some F#/C# WPF code the other day, I kept hitting a fatal FormatException when running under the debugger. Annoyingly, the app would quit with:

An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
Additional information: Input string was not in a correct format.

But it worked fine when started from Expression Blend, or when run using Start Without Debugging in Visual Studio. Let’s take a closer look…
Continue reading FormatException in WPF DataBinding

F# CTP and Visual Studio integration

Just a quick note on an inconsistency in the F# 1.9.6.2 (CTP) release and it’s integration into Visual Studio: be aware that the standard VS environment variable $(TargetPath) is not getting set to what you’d expect. Rather than containing the full path to the output file it references the intermediate file typically in \obj\bin.

This can be a problem if you’ve got any tools set-up that try and do something with the built binary. Normally you can assume that referenced assemblies will also be in that directory, so you’d be able to load and execute your built file. If you’re pointing to a copy in the intermediate directory, that’s not the case.

It looks like it’s just an artifact of the way they’ve integrated the F# compiler (fsc.exe) with msbuild. The F# team are aware of this bug, so hopefully it’ll be fixed in the next drop.