Integration with Visual Studio Enterprise Code Coverage does not work if the project refers Microsoft.NET.Test.Sdk package version 16.3 (and above). The test run fails with exception:
Telerik.JustMock.Core.ElevatedMockingException : Cannot mock '<type to mock goes here>'. The profiler must be enabled to mock, arrange or execute the specified target.
Detected active third-party profilers:
* C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Team Tools\Dynamic Code Coverage Tools\amd64\covrun64.dll (from process environment)
Disable the profilers or link them from the JustMock configuration utility. Restart the test runner and, if necessary, Visual Studio after linking.
Visual Studio debugger arrowhead pointer is messed when profiler is enabled with .Net Core 2.1, in VS2107/2019
Mock.SetupStatic(typeof(ElasticOperationsHelper), Behavior.Strict, StaticConstructor.Mocked);
Mock.Arrange(() => elasticRepository.IndexDocumentInElastic<IndexDocText>(Arg.IsAny<IndexDocText>(), Arg.IsAny<string>(), null)).Returns(response);
While debugging it's found the arrowhead pointer of VS debugger is messed up and pointing to wrong line numbers. It's quite difficult to develop unit tests at this situation. Is there any resolution of this problem.
I found an article in the support page has been declined due to same problem. Is this totally dependent on "CLR" fix and .Net profiler. If so could you please provide me the Bug details of Microsoft for the same?
I would also like to know why it's necessary to have profiler enabled for scenarios like "Static Mocking", "Non virtual method mocking", "Private Mocking" etc.
Is this only happening for .Net core?
Hyland Software is evaluating this product as their Mocking framework for unit testing of all .net core projects.
If there is no solution, how can any prospective customer consider this as a good fit for their usage? If there is any workaround possible at this moment?
When using Mock.CreateLike<> we've found that trying to directly mock anything lower than two layers down on a concrete class (e.g. x => x.Layer1.Layer2.Property == "test") throws a NullReferenceException unless the profiler is enabled. It wasn't clear in the exception or the documentation relating to this method that the real issue was the profiler being disabled, and only by trial and error did we find the solution.
this nuts, forcing me to answer a dialog for JustMock and JustTrace to turn off sending usage to Telerik. Very poor UX. Stop doing this.
Tests fail when run with vstest.console.exe but pass when run from VS2015. Findings: The problematic scenario includes reference to Microsoft.WindowsAzure.ServiceRuntime.dll and usage of the RoleEnvironment class. When the RoleEnvironment class is used in a test project without JustMock and runned from vstest.console the exception will be thrown as well. Here is the exact exception: System.TypeInitializationException: The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception. ---> System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> <CrtImplementationDetails>.ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain. ---> System.Runtime.InteropServices.COMException: Invalid operation. (Exception from HRESULT: 0x80131022) Stack Trace: at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at <CrtImplementationDetails>.GetDefaultDomain() at <CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr function, Void* cookie) at <CrtImplementationDetails>.LanguageSupport.InitializeDefaultAppDomain(LanguageSupport* ) at <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* ) at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) --- End of inner exception stack trace --- at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) at .cctor() --- End of inner exception stack trace --- at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment() at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor() --- End of inner exception stack trace --- at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.get_IsAvailable() Workaround: the vstest.console.exe could be started with parameter /InIsolation, which runs the tests in an isolated process. Here is the link to the command line options: https://msdn.microsoft.com/en-us/library/jj155796.aspx