January 14, 2010 .NET No comments
January 14, 2010 .NET No comments
There could be a lot of stupid troubles with references once you work with set of solutions which of them contains lot of projects.
Here is one of them.
I worked with one simple testing tool (TT) which lives in solutionT.
Testing Tool uses projects B and C in the solution1, i.e. has references to B and C.
(Please note that we are using references by assemblies locations.)
Project B also has reference to some commont project named A.
We moved our common projects both with project A to some other solution2.
Of course we changed references of projects B.
Very nice.
I did a bit of change to the A and wrote test for the B.Tests project and it works well in solution1.
But when I started my TT I got exception I fixed back again. I was thinking how could it be…
I rebuilt all solutions carefully but the same occurred.
Do you know what the problem is?
The problem is that the latest project in the graph i.e. my Testing Tool of course has a reference to a project A and that reference is obsolete, since it has old location…
Bottom line:
When you have troubles with references ensure that latest assembly in your references graph (executable one) has all references which are up-to-date and they are rebuilt. (file timestamp should be enough).
December 22, 2009 .NET, Regex No comments
This is just another quick example of Regex pattern.
Next pattern matches “at least one symbol which is letter or digit at the begging and then exactly one delimiter ‘|’ and then at least one symbol which is letter or digit in the end“:
Valid is:
Not valid are:
and so on…
Links I’ve used:
Verify your Regex:
http://www.pagecolumn.com/tool/regtest.htm
Cheat Sheet:
http://www.addedbytes.com/download/regular-expressions-cheat-sheet-v2/pdf/
November 16, 2009 .NET No comments
Running FxCop on some old stuff code gives me next error: “Implement IDisposable Correctly”.
And provided me with link to MSDN: http://msdn2.microsoft.com/ms244737(VS.90).aspx
I took look at existing code and it looked like:
And here are lot of incorrect implementation of the IDisposable.
At first I added GC.SuppressFinalize(this); like here:
Of course it was not enough – it is needed to call Dispose(true) because my class is not sealed.
You also need to have re-overridden Finalize.
So code which passed FxCop verification looks like:
Please go to MSDN page and read it, since to know how to implement IDisposable correctly is important thing.
October 21, 2009 .NET No comments