Today while running unit tests using NUnit and NMock2 framework, I stumbled upon following error.
System.TypeLoadException : Could not load type 'MultiInterface1' from assembly 'Mocks, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because it attempts to implement a class as an interface.
This error message is very specific but probably isn't very obvious. The only time you will get this error is when you try to mock a concrete class object rather than an interface using NMock2 framework. I overlooked the fact that I was mocking a concrete class. I decided to post this because I didn't see much of help pages on this topic after googling it.
6df673ad-47bd-4892-95df-6884ac5e766a|0|.0
Sometimes on hosting WCF service on IIS7.0 you might receive the following error
HTTP Error 404.3 – Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map. Detailed Error InformationModule StaticFileModule.
This happens when IIS7.0 doesn't know how to handle the .svc files. To fix this we need to register WCF with IIS7.0, following are the steps:
- Run Visual Studio 2008 Command Prompt as “Administrator”.
- Navigate to C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation.
- Run this command servicemodelreg –i.
The servicemodelreg is a command line tool which provides the ability to manage the registration on ServiceModel on a machine. There is more info on this commans on MSDN here.
d71660ed-3395-4dbb-a485-f9827e53cb17|0|.0
Couple of days ago while importing data from an Excel file to a SQL Server table using SSIS I ran into an interesting issue. I found out that some of the data in the Excel file were inserted as NULL in the SQL Server table. It was a bit confusing to start with, I thought I was doing something wrong but after a few checks I was convinced there is something behind the scenes which was causing this problem and there indeed was.
Issue:
SSIS inserts NULL value into a table even when there is good data in the corresponding cells in the excel source.
Reason:
SSIS uses the Jet driver under the hood to read data from an Excel file. During the import process the JET driver looks into the first 8 rows on each column to decide the corresponding data type. In my scenario the column was actually of type double; however, the first eight row was empty, so the JET driver treated that column as String data type or varchar.
So, during the import process when the driver encountered a double data type, it decided that its a wrong type and it just silently ignored it and stored a NULL value in the table. If the column which you are inserting into does not allow nulls then the transformation will fail.
Fix:
There is a fix for this. The JET driver connection string has configuration named "Extended Property", this configuration has a flag name IMEX, if we set this to 1 then it instructs the driver to always read "intermixed" data as text. Intermixed mean columns that may contain numbers, strings etc data types. The connectionstrings.com website has the details on the different settings.
In SSIS you can access the ConnectionString property by clicking the Excel Connection Manager and then look for ConnectionString in the Properties window as shown in the image below

Set your connection string property similart to below:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\SomeExcelFile.xls;Extended Properties="EXCEL 8.0;HDR=YES;IMEX=1";
40e74225-f098-4890-bedb-bbc642fbb189|1|5.0
I installed the syntax highlighter extension in my blog which uses BlogEngine.Net. I stumbled upon a problem, the problem was that the highlighter wasn't rendering the C# code properly, it was adding a new line after every C# keyword. The image below shows the problem

After pulling my hair for good couple of hours, I accidently fixed the problem. I changed the theme from Indigo to some other theme and voila!!! the problem was gone. I am just guessing that it was due to some CSS setting in the Indigo theme which was causing this side effect????
SyntaxHighlighter is a great extension, you can get it from here
e0d615ba-2022-43f7-81dc-3e5d1f4b66bf|0|.0