Archive for the ‘Code and Development’ Category

Dpack is going open source

September 5th, 2011

I just found out that Dpack, possibly the most important gratis tool for Visual studio there is going open source.  Now I wish for time to make this super product even better!

Reply from IIS7: http error 500.21 internal server error handler pagehandlerfactory-integrated has a bad module ManagedPipelineHandler

September 2nd, 2011

I recently installed a Win7 win VS2010 and IIS7.  Unfortunately I installed VS2010 before IIS.

After some other bugs I got something in the line of

http error 500.21 internal server error handler pagehandlerfactory-integrated 
has a bad module ManagedPipelineHandler

The solution was to reinstalls Dotnet4 with IIS and that is done through aspnet_regiis.exe

%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

or the version you use.

Here is the caveat: you have to run it from a prompt with raised privileges.  The output doesn’t give you any clue about this but just outputs its help instead.  Typically shift-right-click and start the command prompt as administrator.

Exception: Dapper throws Value cannot be null. Parameter name: con

July 18th, 2011

If you are using Dapper and try to select data into an object and don’t have a default constructor the exception

Value cannot be null.
Parameter name: con

might be thrown.

The stack is:

[ArgumentNullException: Value cannot be null.
Parameter name: con]
   System.Reflection.Emit.DynamicILGenerator.Emit(OpCode opcode, ConstructorInfo con) +9566558
   Dapper.SqlMapper.GetClassDeserializer(IDataReader reader, Int32 startBound, Int32 length, Boolean returnNullIfFirstMissing) in C:\pathtomyproject\SqlMapper.cs:1177
   Dapper.SqlMapper.GetDeserializer(IDataReader reader, Int32 startBound, Int32 length, Boolean returnNullIfFirstMissing) in C:\pathtomyproject\SqlMapper.cs:674
   Dapper.<QueryInternal>d__4`1.MoveNext() in C:\pathtomyproject\SqlMapper.cs:397
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +327
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
   Dapper.SqlMapper.Query(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in C:\pathtomyproject\SqlMapper.cs:348

 

IIS 7 IISAppPool lightly explained

July 18th, 2011

If you wonder about what IISAppPool is, please follow this link: http://learn.iis.net/page.aspx/624/application-pool-identities/ or this same one with an easier to read URL.

It is an almost-user that IIS uses for running each web in its own space.  One can do the same with ordinary users but it seems to be to much of a hassle for us regular developers.

The article doesn’t explain everything; but exactly what I needed.  Then together with http://stackoverflow.com/questions/4877741/access-to-the-path-is-denied and especially the comment by Hans Passant it made me solve an access problem.

Choose Sql or NoSql

July 12th, 2011

Even though I am not looking into changing any solution away from a relational database I found the article linked below interesting.  You see – it lists some questions/requirements/decisions and then how different database solutions fit.

– http://highscalability.com/blog/2011/6/20/35-use-cases-for-choosing-your-next-nosql-database.html

Microsoft File Transfer Manager problem in Windows 7 x64

July 5th, 2011

When running 64 bit Windows 7 and trying to download from MSDN you might get… nothing.

The problem is that the File transfer manager is 32 bit and your IE is 64.  Solution is to start IE in 32 bit.

Either find it in the start menu.  Or look in C:\Program Files (x86)\Internet Explorer.

—-

To make this article searchable I reprint a dialogue:

—————————
VBScript: Microsoft File Transfer Manager
—————————
There was an error launching File Transfer Manager.

If you are running Windows XP with Service Pack 2 or Windows Server 2003 with Service Pack 1,
this installation may have been blocked.  If the gold IE Information Bar is present above, please
click the bar and select the option to ‘Install ActiveX’.

For additional assistance, please visit the web site http://transfers.ds.microsoft.com,
or contact your help provider.

—————————
OK
—————————
Dump of an error message from Microsoft File Transfer Manager

Microsoft File Transfer Manager

 

Note: I got the text out of the dialogue through ctrl-c.

Microsoft Clickonce: where does my application end up?

June 29th, 2011

Short answer:

Not here:
C:\Users\THEUSER\AppData\Local\Apps\2.0\JM0GBCYM.MJT\6WDVATRE.THK\simp..tion_163ce7792035a125_0001.0000_0b7df1ad2fe4ca04\

Because that is where my latest deploy ended up and as you can see – there is one User and 3 semi randomised folders.

Long answer:

Do like this.

Deploy-install your application.

Fire up Process Explorer and look for your application.  Get properties.  Select Image.

Sysinternals' Process explorer properties image

Properties of your (mine) application

 

The highlighted textbox is where your application ends up.  It is a new location for every install so don’t bother to memorise it.

Also note the version: 1.0.0.0  Where does it come from?  The application is version 1.0.x.y and the install is version 1.0.0.9 and none of them 1.0.0.0.  Anyone knows?

Visual studio test project fails compiling due to clashing test name

June 25th, 2011

In Visual studio 2010 I have a solution with some projects and a unit test project.  Besides the usual configurations Debug and Release I also have Debug_Test.  One sunny day when compiling the project …

… I  got a dialogue with

Duplicate Detected Loading Add from test.dll

In attempting to load Add form test\bin\debug\test.dll, it was determined that a test with the same id name Add in test\bin\debug_test\test.dll already exists in the catalog.

If you retry, Add from test\bin\debug\test.dll will have its id replaced with a new one.

when I tried to compile my solution with Debug_Test active. (or if it was the other way around)

When I pressed Retry I got

Error loading C:\Test\bin\Debug\Test.dll: The test ‘Add’ from ‘c:\test\bin\debug\test.dll’ that is loading has the same TestId {2704e894-0db5-60e4-53Ed-61c7e6951c9f} as the test ‘Add’ already loaded from ‘c:\test\bin\debug_test\test.dll’.

in the output console.

What was happening?
Check out the emphasis (I created). There are two compile configurations that clash.

I want Debug to compile the whole solution with the debug flag set (to know that everything compiles as it should).  Then I have a Debug_Test configuration that only compiles the parts of the solution that are needed for my automatic tests.  In the inner machinery of Visual studio 2010 there is something that tracks test methods and it looks like it regards Add from Debug configuration and Add from Debug_Test configuration as two different tests, albeit with the same name.
In reality they are the same unit test method code.

The whys and the hows are beyond my scope but I found a work around.
Go to the other configuration (i.e. Debug) and clean the output. Then go back to the one you want to work with (i.e. Debug_Test) and continue as usual.

One could possibly have created Debug_Test without checking Create new project configurations to avoid this too.  If anyone knows, please comment.

Nettiers and tables that refuse to generate an entity

June 22nd, 2011

If you use Codesmith/Nettiers (recommended) you might have stumbled upon:

You set up the Nettiers project in Codesmith and mark all tables.

When you generate the code one or more entities are missing.  There is no error message.

Besides the entity/entities not showing up you see it in the SourceTables property of nettiers.  When you started the template all were marked.  When the template was finished one/more table/s were not marked any more.

Reason: the tables are missing a primary key.

I have spent hours on this before.  I did it again.  Hopefully this post will make me, and others, spend less time on this issue.

Gratis sql client tools to put on server

May 18th, 2011

( There are probably many but I haven’t bothered to do a deep search since I normally have Sqlserver and its tools on my machines. )

I avoid installing query tools on the servers to keep them as clean as possible but sometimes I need to and then there are two that spring to mind.

Microsoft Sql server 2008 management studio express which requires an install.

JAlbaharis  Query express which comes as a folder.  No installation and no risk of contaminating the server.  As is mentioned on the page there is a F/OSS version with more functionality here.  The latters seems to in active development at writing time.

Even though I wouldn’t say Management studio has a well thought through user interface it is better than Query express.  On the other hand – the source code of the latter is free (someone has already branched it but I haven’t tried the fork yet, written in C#, visual studio and seems to be active)

First time I tried Query express I threw it away since there is a bug that kicks in if you make the new document in the MDI window maximized and then run the query; the splitter between query and result is set to the bottom om the document and it looks like there is no result.  Workararound: either run the query first with non-maximized document or simply drag the splitter upwards.

Are there more gratis tools anyone would recommend?