Hi
The snipped below is from a testplan xml that has property Number declared as int? (note Nullable type ‘?’) and Value declared as double? (note Nullable type’?'). Opentap gives the following error:
XML Line 18: Unable to create instance of System.Nullable`1[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].
The latest opentap also gives an error:
XML Line 18: Unable to read Nullable`1. Value cannot be null.
How can I get opentap to load this correctly?
I already tried adding xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” but no luck. This is on C# of course.
I have added the following code to tap.Engine
Object serializer.cs and now it is able to deserialized Nullable of known std types. It seems to work fine.
Please let me know if this code can be checked in or there is another way to accomplish this.
Hi @jval1984,
Thanks for raising the issue.
I think you are right in your analysis and probably also the solution.
Since I have already seen your implementation, it would be best if you can open an issue and PR on GitHub - opentap/opentap: This is the code for the base OpenTAP package. See https://opentap.io. This includes the OpenTap.dll (base classes and sequencer), OpenTap.Package.dll (package manager), tap.exe (CLI) and OpenTap.Plugins.BasicSteps.dll (some basic TestSteps).
Unfortunately, there is a bit more work for you since you will have to sign a CLA for us to be able to merge the changes. You can read more here: opentap/CONTRIBUTING.md at main · opentap/opentap · GitHub
Additionally, there needs to be some unit-test for serialization/ deserialization, if you could add a test case to SerializerTests.cs, that verifies that this works it’d be perfect.
I added the code and unit test to the bug also sent the CLA stuff if you want to use the code.
I found a work around as note in the bug, however, it does require knowledge that non-programmer testers would not know. My patch makes type recognition automatic.
Thanks
1 Like