Saturday, April 17, 2010

.Net 4.0, VS 2010, F#2 etc -- quick reactions

It's a pain that we don't yet have a F# for .net 4 compiler except in non-Express versions of VS2010; the transition from 1.9.9.9 to 2.0.0.0 for .net 3.5sp1 was completely painless for my infrastructure project, but the migration to building under .net 4 will be delayed.

As for my usual toolchain, nUnit 2.5.4.10098 works following the recipe here for tweaking app.config

<configuration>
    <startup>
        <requiredRuntime version="v4.0.30319" />
    </startup>
...
 <runtime>
      <loadFromRemoteSources enabled="true" />
...

with command line flag /framework=net-4.0.30319; FxCop 1.36 with just the requiredRuntime clause added to the app.config.

If you don't set these when trying to analyze .net4 code, you get some pretty obvious runtime version mismatch diagnostics that tell you not to do that again.

And as expected, NCover 1.5.8 (free) loses the plot completely -- it can't connect to the changed profiling API.

I am currently investigating an alternative, which so far hasn't ruled itself out completely when running under .net 4 : it hasn't worked as-is, but I suspect that may be more due to F# than .net 4 (Unhandled Exception: System.ArgumentException: An item with the same key has already been added. in Coverage.Common.PdbReader.GetSegmentsByMethod) -- so I shall have to fork that and bugfix.

Later: This turns out to be in a method that sets up a dictionary of offset to code block (from line,column to to line,column), and is almost certainly a manifestation of the phantom code blocks I've seen before in F# -- which would mean simply having to identify and drop any blocks which are just NOPs.

No comments :