IsInstanceOfType fails on COM-objects
See original GitHub issueI was using the Microsoft.VisualStudio.QualityTools.UnitTestFramework in Visual Studio 2015 so far.
Here is a TestMethod that worked until now:
<TestMethod> Public Sub GetStringParameterTest()
Dim rootParamSet As ParameterSet = XXXUtilities.GetOrCreateRootParameterSet(_workDocument, ROOT_PARAM_SET_NAME)
Dim paramSubSet As ParameterSet = XXXUtilities.GetOrCreateParameterSubSet(rootParamSet, PARAM_SUBSET_NAME, False)
Dim stringParameter As StrParam = XXXUtilities.GetOrCreateStringParameter(paramSubSet, "UNITTEST_STRING_PARAM", False)
Dim actual As StrParam = XXXUtilities.GetStringParameter(paramSubSet, "UNITTEST_STRING_PARAM")
Assert.IsNotNull(actual)
Assert.IsInstanceOfType(actual, GetType(StrParam))
Dim name As String = XXXUtilities.GetParameterShortName(actual.Name)
Assert.AreEqual("UNITTEST_STRING_PARAM", name)
End Sub
Expected behaviour: Assert.IsInstanceOfType(actual, GetType(StrParam)) returns true. StrParam is a Type defined in a COM-DLL.
Today, I tried to use the Microsoft.VisualStudio.TestPlatform.TestFramework instead, because I need to use data-driven TestMethods with DataRows.
Actual behavior: the same test now fails with this error:
Result Message: Assert.IsInstanceOfType failed. Expected type:<KnowledgewareTypeLib.StrParam>. Actual type:<System.__ComObject>.
Obviously, the type StrParam was lost in favor of the completely generic System.ComObject. This feels like a regression compared to the “old” behaviour.
What am I missing here?
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (9 by maintainers)
Top GitHub Comments
Unfortunately no, as the COM DLLs in question are intellectual property, but I will try to create a DLL that behaves alike which I can then share publicly. This might take a while, so please give me some time…
I am glad that you are unblocked, but it’s unfortunate that we were not able to resolve the issue for you. I am going ahead and closing this issue for now. Please share a project if you’d still like to pursue.