Closed ericlemes closed 5 years ago
Okay, there's a few issues about this, but I managed to capture creating a unit test in the FakeIt code base. It is very odd.
void production_takes_ownership_interface_with_more_methods() { Mock<SomeInterface2> m; Fake(Dtor(m)); std::unique_ptr<SomeInterface2> ptr = std::unique_ptr<SomeInterface2>(&m.get()); } class SomeInterface2 { public: virtual void DoSomething() = 0; virtual ~SomeInterface2() = default; };
I noticed that not having the DoSomething() method makes the test working. Also inverting the order of the destructor and DoSomething fixes the crash.
Interestingly seems to be an undefined behaviour because it just aborts the test not throwing an exception or any other behaviour.
I appreciate any help.
This crash is happening in VS2017, version 15.7.1.
Proposed fix: https://github.com/eranpeer/FakeIt/pull/144
Okay, there's a few issues about this, but I managed to capture creating a unit test in the FakeIt code base. It is very odd.
I noticed that not having the DoSomething() method makes the test working. Also inverting the order of the destructor and DoSomething fixes the crash.
Interestingly seems to be an undefined behaviour because it just aborts the test not throwing an exception or any other behaviour.
I appreciate any help.
This crash is happening in VS2017, version 15.7.1.