Tuesday, June 12

InternalsVisibleToAttribute, Unit Testing and Strong Names

I previously posted about using the InternalsVisibleTo attibute for testing with NUnit.

I've had some problems building this with a stronly named assembly. I found the following post on Kent Boogaart's blog that describes how you should change the code in your assemblyinfo.cs file as follows:

[assembly: InternalsVisibleTo("Company")]

to

[assembly: InternalsVisibleTo("Company, PublicKey=xxxxxxxxxxxxxxxx")]

Adding a strong name to a third party dll

I've been trying to build an assembly with a strong name and had some problems as it referenced a 3rd party assembly which had been built without a strong name.

To add a strong name I disassembled and reassembled the 3rd party assmbly as follows:

ildasm /out:thirdparty.dll.il thirdparty.dll

ilasm /dll /resource=thirdparty.dll.res thirdparty.dll.il /out=thirdparty.dll /key=mykey.snk

Tuesday, June 5

World Environment Day

To celebrate World Environment Day, we have all been given a flowerpot, some peat and some forget-me-not seeds. You can follow whether the seeds grow into a beautiful plant or not here.

Refreshing Progress Bars

I've been having some problems getting a progress bar to refresh, trying various calls to Refresh() and Invalidate() without much success. The solution to this is to create the dialog containing the progress bar in another thread, as described here.

Although the dialog is modeless, it should be displayed using ShowDialog(), not Show().