Archive for the ‘Tech’ Category

EF + NPGSQL: “Only PrimitiveTypes can be used without qualification.”

01:46 PM

Are you trying to create a SSDL/EDM file for Entity Framework and Npgsql ? Are you getting the following error?

error 0040: The Type … is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.

This is caused by Npgsql mapping a very sparse selection of type-names to the underlying Entity Framework type structures.

As of 2.0.9, the following type names are recognized:

  • bool
  • int2
  • int4
  • float4
  • float8
  • uuid
  • numeric
  • bpchar
  • varchar
  • text
  • xml
  • timestamp
  • date
  • bytea

Porting Puppet to Windows

01:50 PM

In the course of the PuppetCamp Europe, I met with many people I only knew from IRC and email and it was a great time with interesting and inspiring discussions.

Today I want to write about the work I’m currently commisioned for by puppetlabs, porting puppet to Microsoft Windows.

Current Status

After disabling some minor pieces (color, conf file watching) and fixing a few bugs (see the tree on github) and a little bit hacking various parts to pass through paths with a drive letter, I was able to create the first file on windows with puppet. On the downside a few technical problems with the code surfaced, the most daunting were approximately 600 spec failures (out of 8.500 examples).

(more…)

Using gendarme with Code Contracts from .NET 4.0

04:30 PM

When using gendarme on post-processed assemblies with code contracts and /throwonfailure set, a few things have to be ignored. Put the following lines into your ignore file (for example gendarmeignore.txt) and use it with --ignore on the command line.


R: Gendarme.Rules.Exceptions.ExceptionShouldBeVisibleRule
T: System.Diagnostics.Contracts.__ContractsRuntime/ContractException

R: Gendarme.Rules.Exceptions.MissingExceptionConstructorsRule
T: System.Diagnostics.Contracts.__ContractsRuntime/ContractException

R: Gendarme.Rules.Serialization.MissingSerializableAttributeOnISerializableTypeRule
T: System.Diagnostics.Contracts.__ContractsRuntime/ContractException

R: Gendarme.Rules.Serialization.MissingSerializationConstructorRule
T: System.Diagnostics.Contracts.__ContractsRuntime/ContractException

Since this is a tool-generated class we cannot do anything about it anyways and should not access or need the missing features.

Microsoft cannot decode Base64: News at 11!

05:28 PM

Arthur has found a really nasty bug in Microsoft’s streaming Base64 decoder as used in the WCF: Connect Bug#541494

In short: If WCF receives a message whose length is not 16+n*3 bytes (int n>=0) AND the receiver tries to read the last byte with Stream.ReadByte or Stream.ReadBoolean, a System.IO.EndOfStreamException “Unable to read beyond the end of the stream.” is thrown from the bowels of WCF. Looking at the source, Reflector’s output, and the strange length restriction, we presume that the Base64 decode tries to read beyond the underlying stream when the last byte is requested.

As an easy workaround we now pad the end of the stream with a few additional bytes which we never read. This way we do not trigger this bug.

Since MS Connect doesn’t allow downloading the Demo Project, here is a local copy.

Kolab Connector binaries uploaded

05:57 PM

Arthur moved on with programming and testing. Now we uploaded the first packages, which now contain the basic calendar and contacts synchronisation. The plugins already are able to synchronize our personal data.

You can find the packages on the download pages of the Kolab Sync for Outlook und Kolab Sync for Android projects.

Please use the issue trackers there for feedback.

Kolab Sync for Android and Outlook: Developer Preview

05:18 PM

We are proud to announce the first developer preview for Kolab sync clients for both Android and Outlook. Both are licensed under the GPLv3.

Using this software you will be able synchronize your contacts and calendar to any IMAP folder. Every item is saved in a separate Email using the Kolab Storage Format. This allows for interoperability with other Kolab Clients.

Please join us on the Google code projects for the Android and the Outlook connectors.

Since there are still quite a few rough edges, this is only a developer preview to publish the already done work. Read on for a more detailed status of the development so far.

(more…)

Visual Studio 2008 Debugger

11:51 AM

I didn’t know that: the VS2008 debugger has many bugs. Specifically, if you have a solution with multiple websites, debugging doesn’t work!

Symptom: Upon reaching a breakpoint, StepOver/Into do not work, but resume execution. This makes the debugger pretty pointless.

There is an update for this available since february the fourth, 2009(!). I’m wondering why this was not distributed via Windows Update. Anyways, here’re the links:

Building a simple MSBuild Task

12:19 AM

On the “Using Studio’s “Custom Tool” in MSBuild” question, I was prompted to share the code. Here is a stripped down skeleton where I removed the actual calls to the custom tool. Since it is open source I didn’t really need to access the Visual Studio’s registry keys.
(more…)

Gendarme Integration for VS2008

09:33 PM

Ever since setting up our CruiseControl.NET server for our internal projects, I wanted to integrate a Gendarme run to catch all those nasty little things that slip through, like not checking arguments for null.

Now that I finally found some tuits to do it, the next problem became obvious: doing a quick commit often lead to a quick build fail. Gendarme would have no use if it didn’t find anything, no? So the missing piece was integration into Visual Studio. Arthur hacked together a little XSLT+PowerShell and voila, Gendarme now runs on every build right from the studio and populates the “Error List” window with properly linked entries. Yay!

Read on for the details of the implementation. The complete source is downloadable at the end of the article.

(more…)

AppDomainUnloadedException with NUnit, a ServiceHost and several other technologies

05:03 PM

All tests ok, but still a NUnit failure?

Seeing unexplicable “System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.” errors?

You might be a victim of nunit’s bug #423611.

See also here, here and here.

A typical error message looks like this:

Unhandled exceptions:
1) : System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.

I’ve uploaded a minimal solution exhibiting the problem to the bugreport and I hope that’ll help clearing the issue up.