[wix-devs] DUtilUnitTest problem

Ron Martin cpuwzd at comcast.net
Sun Mar 27 10:39:06 PDT 2022


Rob suggested that I send this information to wix-devs because someone 
else (perhaps Sean),might be better
able to address this issue.

I'm having trouble getting my pull request to fit within the official 
Wix4 build structure.

The scenario is as follows:

The test procedure, DUtilTraceErrorSourceFiltersOnTraceLevel() in 
DUtilUnitTest uses the following code:

    Action^ action = gcnew Action(this, &DUtil::CallDutilTraceErrorSource);
    Assert::Throws<Exception^>(action);

The Action is expected to throw a .net exception. Xunit exposes 
Assert::Throws<Exception^> for parameters of types with
type definitions unknown to xunit, substituting the same "unknown" type 
for all of them. In fact, this is the same type as Object.
The C++ compiler gets confused because it can't tell which overload to 
use, emits *no code at all* and *no error* for this construct.
The C# compiler ignores the confusing information completely and 
generates reasonable code for this idiom.

I believe that xunit could be modified to not expose such confusing 
information.

I raised this issue on August 13, 2021: 
https://github.com/xunit/xunit/issues/2364.

Meanwhile, back at the ranch, I created my own version of 
Assert::Throws<Exception^>() in a different namespace (not in xunit) in C#.
I changed the namespace in the original call and, after a lot of messing 
with the build structure, got it all to work. The hard parts involve
compiling DUtilUnitTest containing a #using to reference my surrogate 
code, getting my new code to build in the right sequence and
appropriately packaged.

I've published my code in its current incarnation on my github repo 
(cpuwzd) in my DUtilUnitTestBugFix branch.

As is, the code gets a build error due to the build order.

I think that this bug is worth fixing. Ultimately, it needs to be 
properly explained to the xunit people and the C++ people.

Please help.

Thanks.

Ron


More information about the wix-devs mailing list