My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 67: ExtractResourceAttribute fails with multiple attributes on a test
1 person starred this issue and may be notified of changes. Back to list
Status:  Accepted
Owner:  grahamrhay
Type-Defect
Priority-Medium
Milestone-2.4.2


Sign in to add a comment
 
Reported by smitcham, Sep 24, 2007
The following sample fails with a NullReferenceException.

        [Test]
        [ExtractResource("StandardMessages.xml", "StandardMessages.xml")]
        [ExtractResource("AdditionalMessages.xml", 
           "AdditionalMessages.xml")]
        public void MultipleMessageFilesCanBeLoaded()
        {
           ...
        }

The failure is due to the constructor of the ExtractResourceRunInvoker
expecting a MethodRunInvoker to get the declaring type information for the
attribute if the declaring type is null.

I checked the trunk and it appears to still be present although I
discovered the error off a version of the attribute that was not included
in the project.

I fixed the issue by adding a block that checks for an
ExtractResourceRunInvoker and gets the type of the attribute present there,
but this fix would not be guaranteed in the presence of other decorators.
Comment 1 by jeff.brown, Sep 24, 2007
(No comment was entered for this change.)
Labels: Milestone-2.4.2
Comment 2 by grahamrhay, Mar 06, 2008
Your fix works when supplying a destination for the extracted resource, however the
alternative option (using a stream) relies on a static member of the
ExtractResourceAttribute class. This means there can only be one resource open at a
time, with the current implementation.
Status: Accepted
Owner: grahamrhay
Comment 3 by smitcham, Mar 06, 2008
I realize that, You may want to document the limitation.  We haven't been using the 
stream alternative due to that limitation.
Comment 4 by jeff.brown, Mar 07, 2008
In any case, this feature will not be carried forward to MbUnit v3 as-is.

In v3, access to the contents of resources in place will be provided through
data-binding.  Then we can also have a decorator similar to the existing feature that
provides for extraction to disk.
Sign in to add a comment

Hosted by Google Code