October 2011 Entries
Motivation During programming suddenly this error (“Failure has occurred while loading a type”) was thrown by accessing a artifact of a referenced library. In such cases I take the assembly fusion logger fuslogvw to search for problems of loading assemblies. Sometimes an old version from a not expected folder is binded. But all bindings were correct. Problem After several hour I got the right hint. Because the assembly is a COM+ one, there are some registration things in die background – and I don’t ......
Intro If you want to test the internals of a productive assembly you must mark the assembly with the InternalsVisibleTo-attribute. This attribute has only one constructor which needs the name of the testing assembly. http://msdn.microsoft.com/e... So this looks like: [assembly: InternalsVisibleTo("Unlinke... Visual Studio and 3rd party plugins uses the string to mark referencing ......
Motivation Often you want to have the possibility to call a special abstract or virtual Initialize-method in a constructor of a base class to set individual initializing things in an override of this Initialize-method in a derived class. This is similar to the GOF-Pattern “Template Method”. But with C# this ends up with a warning “Virtual member call in constructor”. Why we get this warning? To show the effect of this approach, lets have a look at the source and the calling graph during runtime: ......