Choose life. Choose inheritance. Choose a job subclassing all the controls you ever built, and all the 3rd party ones you might ever use. Choose combinatorial explosion. Choose painfully recreating designers to work against the subclasses you just built. Choose aggregated proxy-by-reflection just to get the damned sealed classes working, and waking up in a cold sweat in the middle of the night panicking over the grotesqueness of it all. Choose backing yourself into a corner. Choose starting from scratch for the next version. Choose wishing you could call base.base.method() because your immediate subclass overrode the method to do something you didn't want. Choose your future. Choose inheritance.
(me getting wound up on aus-dotnet list again)
Wednesday, September 21, 2005
Tuesday, September 13, 2005
CruiseControl.NET RC1 Log-merging issues with nmock via nant
Summary: using a strict mock in a unit test run using nant's nunit2
task breaks RC1 CruiseControl's merging of the nant output [update: This is apparently fixed in later builds of nmock - see comments at end]
When we migrated to the latest version of CruiseControl.NET last week
(the RC1 release), one of our builds stopped merging the logs
properly (so we started getting the dreaded 'Log does not contain any
Xml output from NAnt' error).
This was due to cruisecontrol CDATA-wrapping the nant output in the
log, but at the time I didn't understand why it would do that, and
what had changed in RC1.
It turns out that nmock has a known issue (
http://jira.truemesh.com/secure/ViewIssue.jspa?key=NMO-43 ) where
strict mocks complain when the mocks are Finalise()'d. Since this
only occurs on a GC, this error is normally swallowed by the host
application closing down, but you can see this behaviour if you run a
test including a strict mock from nunit-console.
Normally nant's XmlLogger catches everything going to StdOut and
StdErr, and wraps them nicely in its xml output to catch this kind of
stuff. Unfortunately nant's nunit2 task runs inside nant, rather than
shelling out, so the GC that causes the nmock issue doesn't happen
until nant is closing down, by which time the XmlLogger has already
closed down.
As a result, nmock writes this kind of output directly to StdErr:
...the <>'s in which cause CruiseControl to wrap nant's output with
CDATA and hence hide it from the dashboard.
And what's changed in RC1? Well since this wasn't an issue before I
can only infer that RC1 now sucks in StdErr *as well as* StdOut from
nant.
So... Really what it boils down to is:
- CruseControl should probably CDATA the StdErr from nant (rather
than assuming its valid Xml!)
- nmock needs fixing (seems like they're too busy playing with a v2
generic version to look at existing issues)
- tricky to see how nant's XmlLogger could cope better
- should be a FAQ on 'Log does not contain any output from NAnt'
In the intermediary we've hacked our version of nmock as per the link
up above (somewhere) so as to not raise exceptions on Finalize()
Update: This is apparently fixed in later nmock releases, though we found they also broke something else we were doing (which was probably our fault), so for expediency we kept our hack. Later versions of CruiseControl.NET may also handle this more gracefully now too.
task breaks RC1 CruiseControl's merging of the nant output [update: This is apparently fixed in later builds of nmock - see comments at end]
When we migrated to the latest version of CruiseControl.NET last week
(the RC1 release), one of our builds stopped merging the logs
properly (so we started getting the dreaded 'Log does not contain any
Xml output from NAnt' error).
This was due to cruisecontrol CDATA-wrapping the nant output in the
log, but at the time I didn't understand why it would do that, and
what had changed in RC1.
It turns out that nmock has a known issue (
http://jira.truemesh.com/secure/ViewIssue.jspa?key=NMO-43 ) where
strict mocks complain when the mocks are Finalise()'d. Since this
only occurs on a GC, this error is normally swallowed by the host
application closing down, but you can see this behaviour if you run a
test including a strict mock from nunit-console.
Normally nant's XmlLogger catches everything going to StdOut and
StdErr, and wraps them nicely in its xml output to catch this kind of
stuff. Unfortunately nant's nunit2 task runs inside nant, rather than
shelling out, so the GC that causes the nmock issue doesn't happen
until nant is closing down, by which time the XmlLogger has already
closed down.
As a result, nmock writes this kind of output directly to StdErr:
Unhandled Exception: NMock.VerifyException: Finalize() called too
many times
expected:0
but was:<1>
at NMock.Mock.Invoke(String methodName, Object[] args)
at ProxyDataFormatter.Finalize()
...the <>'s in which cause CruiseControl to wrap nant's output with
CDATA and hence hide it from the dashboard.
And what's changed in RC1? Well since this wasn't an issue before I
can only infer that RC1 now sucks in StdErr *as well as* StdOut from
nant.
So... Really what it boils down to is:
- CruseControl should probably CDATA the StdErr from nant (rather
than assuming its valid Xml!)
- nmock needs fixing (seems like they're too busy playing with a v2
generic version to look at existing issues)
- tricky to see how nant's XmlLogger could cope better
- should be a FAQ on 'Log does not contain any output from NAnt'
In the intermediary we've hacked our version of nmock as per the link
up above (somewhere) so as to not raise exceptions on Finalize()
Update: This is apparently fixed in later nmock releases, though we found they also broke something else we were doing (which was probably our fault), so for expediency we kept our hack. Later versions of CruiseControl.NET may also handle this more gracefully now too.
Sunday, May 01, 2005
Someone broke my VS.IDE !
Have absolutely no idea how I managed it, but all of a sudden Visual Studio 2003 thought all my projects were Windows Applications. The .csproj files were still fine. When the solution loaded a shed load of errors like
"Load of property 'AllowUnsafeBlocks' failed."
"Load of property 'ApplicationIcon' failed."
"Load of property 'AssemblyKeyContainerName' failed."
and so on appear in the Task List.
I eventually found a solution on a SAP forum (I have never had SAP installed on this, or any other, PC) - re-register the C# project DLL
regsvr32 "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\vcpackages\csproj.dll"
regasm "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\PublicAssemblies\VSLangProj.dll"
devenv /resetskippkgs
(from https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https%3A//forums.sdn.sap.com/thread.jspa%3FthreadID%3D12483%26tstart%3D0
)
Thanks SAP. Hope this guy worked it out too...
"Load of property 'AllowUnsafeBlocks' failed."
"Load of property 'ApplicationIcon' failed."
"Load of property 'AssemblyKeyContainerName' failed."
and so on appear in the Task List.
I eventually found a solution on a SAP forum (I have never had SAP installed on this, or any other, PC) - re-register the C# project DLL
regsvr32 "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\vcpackages\csproj.dll"
regasm "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\PublicAssemblies\VSLangProj.dll"
devenv /resetskippkgs
(from https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https%3A//forums.sdn.sap.com/thread.jspa%3FthreadID%3D12483%26tstart%3D0
)
Thanks SAP. Hope this guy worked it out too...
Wednesday, February 23, 2005
Doh! Different versions of System.Web.dll marked with same version number!
So a unit test broke inexplicably when I put it up to the CruiseControl server, and it didn't work on a collegue's machine either. It boiled down to the fact that a System.Web.UI.WebControls.Image with no AlternateText doesn't render an ALT attribute AT ALL on my collegue's machine, whereas on mine I get an empty ALT attribute.
ie
<img src="" id="myList" alt="" border="0" />
vs
<img src="" id="myList" border="0" />
Fair enough you might say, but we've both got the same version of System.Web.dll: 1.0.5000.0 from .Net v1.1.4322
Or have we?
Well obviously not, or we wouldn't be getting different Render() output. A quick squiz with Reflector indicates my assembly has internal version number f6153c24-4a3b-4f01-85cf-33d0fb852aea and size 1257472 bytes, and my collegue has e0b58e50-995f-4d8b-9d21-af7678f61626 with size 1245184 bytes. Drilling in a little futher with the disassembler finds the culprit: an extra condition in the latter that only writes the ALT tag out if AlternateText.Length > 0.
What's the moral? I don't know, but if you can't trust people to increment their version numbers when they release new versions then god help us all.
(As an aside, because assemblies in the GAC are tracked on a version number + public key basis, these two DIFFERENT assemblies are considered identical. This is presumably why MS chose not to increment the version number: because it was such a tiny weeny change. Enough of a change, however, to be noticable, and to break my (deliberately brittle) code. Bastards. Increment the version and use an Publisher Policy like you're meant to...)
ie
<img src="" id="myList" alt="" border="0" />
vs
<img src="" id="myList" border="0" />
Fair enough you might say, but we've both got the same version of System.Web.dll: 1.0.5000.0 from .Net v1.1.4322
Or have we?
Well obviously not, or we wouldn't be getting different Render() output. A quick squiz with Reflector indicates my assembly has internal version number f6153c24-4a3b-4f01-85cf-33d0fb852aea and size 1257472 bytes, and my collegue has e0b58e50-995f-4d8b-9d21-af7678f61626 with size 1245184 bytes. Drilling in a little futher with the disassembler finds the culprit: an extra condition in the latter that only writes the ALT tag out if AlternateText.Length > 0.
What's the moral? I don't know, but if you can't trust people to increment their version numbers when they release new versions then god help us all.
(As an aside, because assemblies in the GAC are tracked on a version number + public key basis, these two DIFFERENT assemblies are considered identical. This is presumably why MS chose not to increment the version number: because it was such a tiny weeny change. Enough of a change, however, to be noticable, and to break my (deliberately brittle) code. Bastards. Increment the version and use an Publisher Policy like you're meant to...)
Wednesday, February 16, 2005
Doh! style.top in a scrolling dhtml container element
In IE6 (and probably others), elements nested within a scrolling container (one with overflowY=auto) act as if they're in an absolutely positioned element - ie you need to account for the container when you're setting element.style.top (so you can't - say - just sum all the offsetY's from there to the document root and add/subtract some delta value for a relative-absolute position).
(Every time I (or someone I've worked with) has tried to do something clever in DHTML it's turned round and bit them on the arse. Clearly with the demise of NS4.x things are looking up, but oh-so-slowly. And I'm a DHTML advocate)
(Every time I (or someone I've worked with) has tried to do something clever in DHTML it's turned round and bit them on the arse. Clearly with the demise of NS4.x things are looking up, but oh-so-slowly. And I'm a DHTML advocate)
Doh! ASPNET_SETREG access rights under IIS6
When setting registry access rights for your encrypted connection strings (you know, the ones you created with ASPNET_SETREG) don't forget to add the new IIS_WPG group if you're deploying to IIS6, since your app's probably not running as ASPNET user any more...
Doh! CruiseControl.NET with Visual SourceSafe (VSS)
Turns out that VSS 6 (even 6d) has a subtle bug in it's command-line syntax (ss.exe), such that it ignores the AM/PM indicator on the 'from' part of a date range. This plays silly buggers with CruiseControl.NET, unless you set the 24Hr clock format on whatever profile user CruiseControl.NET runs as.
Subscribe to:
Posts (Atom)
Popular Posts
-
Summary: Even if you think you know what you're doing, it is not safe to store anything in a ThreadStatic member, CallContext or Thread...
-
I love PowerShell, and use it for pretty much everything that I’m not forced to compile. As a result I’ve got fairly competent, and people h...
-
Look, it’s really not that hard. Programs are still in the same place, in %ProgramFiles%, unless you need the 32 bit version, which is in...
