-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prig test run crashing (when a nested static, unstubbed method is called) #89
Comments
Thank you for the reporting! But it seems a difficult problem... Possibly, Prig was outputting some error log. By default, it is in the directory |
Here it is, but I suspect these are not the errors I was referring to: 2017/01/26 10:39:12.283066,ERROR,0x00002648,11,0x00002ef8," Weaver.cpp(175): Throw in function long __stdcall CWeaverDetail::CWeaverImpl::InitializeCore(struct IUnknown *) ","C:\Users\urasa\Prig\Swathe\Urasandesu.Swathe\Urasandesu/Swathe/Profiling/ICorProfilerCallbackImpl.h",262,"long __stdcall CWeaverDetail::CWeaverImpl::InitializeCore(struct IUnknown *)=>Weaver.cpp,115","if (regex_search(procPath, wregex(targetProcName)))=>Weaver.cpp,139" ","C:\Users\urasa\Prig\Swathe\Urasandesu.Swathe\Urasandesu/Swathe/Profiling/ICorProfilerCallbackImpl.h",262,"long __stdcall CWeaverDetail::CWeaverImpl::InitializeCore(struct IUnknown *)=>Weaver.cpp,115","if (regex_search(procPath, wregex(targetProcName)))=>Weaver.cpp,139" ","C:\Users\urasa\Prig\Swathe\Urasandesu.Swathe\Urasandesu/Swathe/Profiling/ICorProfilerCallbackImpl.h",262,"long __stdcall CWeaverDetail::CWeaverImpl::InitializeCore(struct IUnknown *)=>Weaver.cpp,115","if (regex_search(procPath, wregex(targetProcName)))=>Weaver.cpp,139" |
I also managed to get a brief error message in visual studio when the test process crashes: it says that the heap is damaged. |
I have made some further investigation and the error is not caused by optional arguments. My code is set up as follows:
The test calls Might there be some problem with how the classes/methods are named, or how many args they have or with naming of those args? I should also mention that |
The latest error log that is recorded at |
Thank you for your deep investigation! In the past, the complex issue around a parameter that is caused by the order of referenced assembly existed. You might be able to reproduce on a side project if you make it having plurality class libraries. |
There is one more thing I noticed: when I run the test from VS Test Explorer it works. When it is executed from ReSharper test runner, or from command line ("prig run ...") - then it crashes. |
I don't have ReSharper license, so I'm investigating command line side. However, Now, I have requested ReSharper Ultimate Free Open Source License to JetBrains to investigate this issue. I will contact you if there is progress. |
Thanks for your support. Today I did even more investigation and it seems that the cause of the error is even different than I thought. I even can't isolate the problematic line of code now. What I'm doing is commenting/changing code within the method that is being stubbed in the test, recompiling prig assemblies and re-runing the test. There is some randomness around it, and in the end it seems that the optional parameters have something to do with the issue - when removing/changing calls to such methods I am able to make the test run or make it fail, but it doesn't seem to be consistent (or I can't see the clue). I also tried on a side project as well, by copying quite a lot of code from my original project but without success. In the new project the test passes. |
I tried to run one of @andy250 's tests (we're co-workers) - and it also failed on my local PC. When analyzing the .dmp file in DebugDiag2 - it seems it is also related to Serialization in Boost. Exception Information
|
@ngjermundshaug, it is strange... In the stack trace, Are you wrapping |
Basically when running from within VS "prig run" is wrapped by either ReSharper test runner or VSTest runner (which we donb't have access to). When running from command line there is no additional wrapping. Today I can observe a bit different behavior (which is weird, to say the least):
|
OK, I have understood that there are no any wrapper scripts. Ummmmm... |
@ngjermundshaug, thank you for the retrying. |
MEMO
I guess that there is some environmental problem. Now, I have gotten ReSharper Ultimate Free Open Source License. After this, I'm going to change the investigation environment to it and continue. |
@urasandesu %ALLUSERSPROFILE%\chocolatey\lib\Prig\tools\log is empty on mu machine. |
@ngjermundshaug, thank you for the reply! I have installed ReSharper and started the investigation. I will contact you if there is progress. |
I am not running tests using Resharper, so I doubt that Resharper is causing this.. but then again you never know.. |
@ngjermundshaug, |
@andy250, I tried to execute Quick Tour with ReSharper test runner, but I couldn't do it(it wasn't stubbed anything): Probably, you have changed some options of ReSharper to be able to execute your test project. Would you give me those information? For example,
|
I really haven't changed anything to run from R#. Here are the information:
Be sure to enable Prig Adapter for TestProject - I failed to do so in the beginning (or I enabled the adapter for some other project accidentally) - in that case nothing was stubbed for me. Also as @ngjermundshaug mentioned this is not a R# specific issue. I am getting the same when executing |
@andy250, thank you for the information! Now I have investigated from these information, and I have found out that there are some issues when executing tests in MsTest. As far as I have grasped, #90 and #91 have been found. As you and @ngjermundshaug pointed out, this isn't R# specific issue. |
@urasandesu Do you think fixing #90 and #91 will fix the current problem too? |
@andy250, now I have created VSIX that contains the commit to fix #90 and #91. Would you try this?: Prig.zip |
@urasandesu thanks for the new package. I got 2 issues:
Initialization method PrigTests.SomeTest.Initialize threw exception. System.EntryPointNotFoundException: System.EntryPointNotFoundException: DLL 'Urasandesu.Prig.dll' cannot find entry point named 'InstanceGettersTryGet'.. It seems that this happens as soon as I call any |
@andy250, the exception is caused by the uninstallation failure against previous. Please check the following point:
|
@urasandesu I can confirm the new version fixed the crash. This is awesome! Thanks for your support. When can we expect new prig version in chocolatey gallery? |
@andy250, I'm glad 😌 Now I'm adding some tests for the extent of the impact. I'll finish new Prig version this month if there is no problem. Please wait for a little longer. |
Sure no problem. I actually have one more minor issue - when I run from the console (prig run -process "vstest.console.exe" "MyTests.dll") it seems that stubs are not used - original implementation gets called. When I run it from Visual Studio it is OK (TestExplorer + MSTest). Any ideas? I have prig.exe in C:\ProgramData\chocolatey\lib\Prig\tools. It looks like it has been updated today. |
Did you set environment variables? When Prig is executed from Visual Studio, some special environment variables are set automatically like the bellow:
Our Wiki also explains to collect coverage by |
Tried setting the variables (process name set to "vstest.console.exe") but with no effect. I remember it worked at the very beginning just after I installed 2.3.1 few weeks ago. I think it stopped working even before I installed your new vsix. What else could have been modified in my environment? EDIT: I am even more puzzled now --> upgraded prig on our TeamCity server to 2.3.2 but it crashes as it did before upgrading :( It crashes both inside VS and when executed from console. So that also means that on TeamCity server "pring run" attaches properly (and stubs the methods) without any environmental variables being set. On my local machine "pring run" does not attach. |
The configuration looks OK. It points to |
What is going on... 😵 Well, Prig has debug trace mode. We might be able to find the problem if enabling that. Set environment variable
After this, debug level log will be outputted to the directory Note the following and check the log:
|
Thx for the tips. You pointed me in the right direction with the EDIT I will check if Debug vs Release mode changes anything (I think previously it was Debug, now Im testing only Release, and also Release is used on TeamCity). |
Umm... I can't think of a solution right away. Sorry to cause you trouble. In addition, today it turned out that there are some problems if applying current correction way (FileLoadException: |
Sorry to say, but we have decided to revert back to fakes. Apart from couple of tests crashing we had trouble running tests stable under TeamCity (especially recently stubbing stopped working at all). If you can improve TeamCity support and fix the crashes we are more than happy to try it out again in near future. Thanks again for your efforts and great support. |
I'm the one who should apologize. Thanks to you, I was able to also find other new issues. I will continue to improve this framework. If there is an opportunity, please try Prig again. |
I have a problem with couple of my tests. I generally observed that prig has issues with static methods with optional arguments. Not always though - I tried to reproduce this on a side project but I could not. However in my tests (fairly large solution) there are a few which had optional arguments, and they crashed the whole test run. Refactoring to methods without optional arguments solved it... for some of the. There are few tests which crash even after optional args have been removed. When I am running the test in the console:
prig run -process "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow \vstest.console.exe" -arguments "PrigTests.dll"
the process crashes, I get popup "program stopped working" then I click the "debug" button and I can get this stack trace in VS:
https://www.screencast.com/t/jvesh3Yrx
This doesn't tell me much though. Anyone has a clue what might be wrong? I am willing to make further investigation and provide more details on this tomorrow.
The text was updated successfully, but these errors were encountered: