Archive for the ‘Microsoft’ 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

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…)

MSSQL doesn’t (completely) support IEEE754 floating points

12:00 PM

After looking for quite a while (it is unbelievable, no?) I have to accept that Microsoft’s SQL Server 2000, 2005 and 2008 do not fully support IEEE-754 floating point numbers. Specifically NaN (Not-a-Number) and +/- Infinity are not allowed. While the 2000 Server seemingly allows such values to be inserted, but breaks badly afterwards, the newer versions disallow inserting such values. Here is the MS Connect article requesting the feature. There is also the documentation about float data and a read-between-the-lines hint in the documentation for XPath numbers. The article describing floats is very circumspect about this:

The behavior of float and real follows the IEEE 754 specification on approximate numeric data types.

[emphasis mine]

The XPath article states it clearly:

However, float(53) is not exactly IEEE 754. For example, neither NaN (Not-a-Number) nor infinity is used.

.

For completeness, here’s a little review about other DMBS’ support for NaNs and Infinity:

Windows 7 x64 32 Bit ODBC

05:44 PM

[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application

If you need to create a ODBC Datasource for 32 Bit Applications under Windows 7 x64 you have to use C:\Windows\SysWOW64\odbcad32.exe. More info can be found in this tutorial.