Last Updated: 01 Dec 2021 14:07 by ADMIN
Created by: Jason
Comments: 2
Type: Bug Report

I've already created an issue in the JustMock repo, you can find it here: Below is the text from that issue...

I'm currently working on a PR to add JustMock to the suite of performance tests that currently exist in that repository. The problem is that some of the tests (like OneParameter and Callback) take a long time to finish for JustMock. I'm not sure why, but it's making it such that JustMock can't be added to the test suite. More to the point, the PR can't be accepted as-is because it would take too long to finish.

One thing Steve (owner of the repo) and I talked about is if the invocationCount value passed to the SimpleJobAttribute (which exists on both the MockingBenchmark and MockingBenchmark<T> classes) is reduced from 100,000 to something like 1,000, the tests then finish, but that doesn't address the underlying issue why these tests for JustMock slow down over repeated called.

There may be something in the benchmark tests with the way I've set things up with JustMock that may be incorrect. I've never used JustMock until today :). If there's something that I'm doing right, please let me know.

Last Updated: 16 Sep 2021 08:40 by ADMIN
Created by: Calvin
Comments: 3
Type: Bug Report

I filed a prior ThreadLeak:

Thread leak in JustMock (


I think I've found another one: (VS version 16.10.31321.278)


Apparently, the MonitorTimer_Elapsed code is running on a threadpool thread and it takes longer than 1 sec (perhaps it's waiting on a lock?).

Another timer tick occurs and the method is called again. Eventually, the ThreadPool runs out of threads and grows by about 1 thread per second (1Mb /sec leak)

In one dump 2Gig was used (1962 threads on the same MonitorTimer_Elapsed stack frame)

In that same dump there were 52 stacks with this frame:


(this was the same item as my prior report).


Last Updated: 16 Sep 2021 08:38 by ADMIN

The following test fails:

public void TestCallOrderWithInOrder()
	// Arrange
	var mockClass1 = Mock.Create<Class1>();
	var mockClass2 = Mock.Create<Class2>();

	Mock.Arrange(() => mockClass1.Method1())
	Mock.Arrange(() => mockClass2.Method1())
	Mock.Arrange(() => mockClass1.Method2())

	// Act

	mockClass2.Method1(); // <--- this call is not allowed by
						  //      InOrder clause currently 
						  //      and throws AssertFailedException


	// Assert

Last Updated: 16 Sep 2021 08:37 by ADMIN

The following test is not working anymore since version JustMock_2021_2_615_4 but was working with JustMock_2021_1_326_1 and older versions:

public interface ITest
    void Test(string text);

public void MyTestMethod()
    var mock = Mock.Create<ITest>();
    Mock.Arrange(() => mock.Test("")).IgnoreArguments().OccursNever();
    Mock.Arrange(() => mock.Test(Arg.Matches<string>(a => a == "a"))).InOrder().OccursOnce();
    Mock.Arrange(() => mock.Test(Arg.Matches<string>(a => a == "b"))).InOrder().OccursOnce();



If I remove the OccorsNever line, its working.
If I remove the 2 InOrder, its working.

Seems that something change there:

Last Updated: 17 Aug 2021 07:19 by ADMIN

Using elevated mocking mode (profiler enabled) with long path names for the test containers (above 260 characters) causes the following command:

dotnet test

to fail with error:

Testhost process exited with error: Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Microsoft.VisualStudio.TestPlatform.TestHost.Program.Main(System.String[])
. Please check the diagnostic logs for more information.

Test Run Aborted.

Last Updated: 26 Apr 2021 09:48 by ADMIN

Attempt to use JustMock VSTest v.2 task to run the elevated mode tests with coverage when the "Test platform version" option is set to value "Installed by Tools Installer" fails with error:

Telerik.JustMock.Core.ElevatedMockingException: Cannot mock '<target type goes here>'. The profiler must be enabled to mock, arrange or execute the specified target.
Detected active third-party profilers:
* {9317ae81-bcd8-47b7-aaa1-a28062e41c71} (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.

Last Updated: 18 Mar 2021 13:28 by ADMIN
When the ports with which the DebugWindow should operate are changed in the DebugWindow host configuration the process is started with the default values instead of the new values.
Last Updated: 05 Mar 2021 14:19 by ADMIN
The exception description does not clearly state that there is an issue with the member which is a target of the mocking which could easily lead to confusion. Attached sample project reproducing the issue.
Last Updated: 02 Feb 2021 09:35 by ADMIN

I have a class, which has a private async method, which has a local function, like the following example


internal class TestClass



        private async Task<bool> TestPrivateMethod()
            var x = await TestLocalFunction();
            return x;

            async Task<bool> TestLocalFunction()
                await Task.Delay(5);
                return true;


When I try to mock the local function, thows an error "System.MissingMemberException : C# 7 local function 'TestLocalFunction' with the given signature was not found inside method 'TestPrivateMethod'"


var testClassInstance = Mock.Create<TestClass>(Behavior.CallOriginal);

Mock.Local.Function.Arrange<Task<bool>>(testClassInstance, "TestPrivateMethod", "TestLocalFunction").Returns(Task.FromResult(true));


Last Updated: 02 Feb 2021 09:32 by ADMIN
Created by: Calvin
Comments: 7
Type: Bug Report

Thread leak in JustMock

I am a member of the Visual Studio Perf Reliability team


Recently, I’ve found several customer dumps with huge # of threads.

In this dump:

Watson : Cab Search (





Progress® Telerik® JustMock Feedback Portal


There are 2084 threads using 2G mem, most with the stack below:

This is caused by threadpool starvation: the JustMock call ties up a thread for more than 1 second, then another request comes in.

The CLR will create an additional thread after 1 second to satisfy the request. This keeps happening and creates thousands of threads, each with size 1Meg.


00 ntdll!NtWaitForMultipleObjects
01 KERNELBASE!WaitForMultipleObjectsEx
02 clr!WaitForMultipleObjectsEx_SO_TOLERANT
03 clr!Thread::DoAppropriateAptStateWait
04 clr!Thread::DoAppropriateWaitWorker
05 clr!Thread::DoAppropriateWait
06 clr!SOIntolerantTransitionHandler::SetNoException
07 clr!CLREventBase::WaitEx
08 clr!CLREventBase::Wait
09 clr!AwareLock::EnterEpilogHelper
0a clr!ThreadDebugBlockingInfo::PopBlockingItem
0b clr!DebugBlockingItemHolder::{dtor}
0c clr!AwareLock::EnterEpilog
0d clr!AwareLock::Enter
0e clr!AwareLock::Contention
0f clr!JITutil_MonReliableContention
10 Telerik_JustMock_DebugWindow_Service_Client!Telerik.JustMock.DebugWindow.Service.Client.ConnectionSetupServiceClientBase<Telerik.JustMock.DebugWindow.Service.Proxy.TraceEventsSubscriptionServiceProxy>.get_ServiceAvailable
11 Telerik_JustMock_DebugWindow_Service_Client!Telerik.JustMock.DebugWindow.Service.Client.SessionServiceClientBase<Telerik.JustMock.DebugWindow.Service.Proxy.MockRepositorySubscriptionServiceProxy>.KeepAliveTimer_Elapsed
12 System_ni!System.Timers.Timer.MyTimerCallback
13 mscorlib_ni!System.Threading.TimerQueueTimer.CallCallbackInContext
14 mscorlib_ni!System.Threading.ExecutionContext.RunInternal
15 mscorlib_ni!System.Threading.ExecutionContext.Run
16 mscorlib_ni!System.Threading.TimerQueueTimer.CallCallback
17 mscorlib_ni!System.Threading.TimerQueueTimer.Fire
18 mscorlib_ni!System.Threading.TimerQueue.FireNextTimers
19 mscorlib_ni!System.Threading.TimerQueue.AppDomainTimerCallback
1a clr!CallDescrWorkerInternal
1b clr!CallDescrWorkerWithHandler
1c clr!MethodDescCallSite::CallTargetWorker
1d clr!MethodDescCallSite::Call
1e clr!AppDomainTimerCallback_Worker
1f clr!ManagedThreadBase_DispatchInner
20 clr!ManagedThreadBase_DispatchMiddle::__l16::Cleanup::{dtor}
21 clr!ManagedThreadBase_DispatchMiddle
22 clr!ManagedThreadBase_DispatchOuter
23 clr!ManagedThreadBase_FullTransitionWithAD
24 clr!ManagedThreadBase::ThreadPool
25 clr!AppDomainTimerCallback
26 clr!ThreadpoolMgr::AsyncTimerCallbackCompletion
27 clr!UnManagedPerAppDomainTPCount::DispatchWorkItem
28 clr!ThreadpoolMgr::ExecuteWorkRequest
29 clr!ThreadpoolMgr::WorkerThreadStart
2a clr!Thread::intermediateThreadProc
2b kernel32!BaseThreadInitThunk
2c ntdll!__RtlUserThreadStart
2d ntdll!_RtlUserThreadStart

Last Updated: 02 Feb 2021 09:30 by ADMIN
Created by: Eric
Comments: 7
Type: Bug Report

when using JustMock Free in a net 5.0 app.  I am getting an Ninject exception that IAssemblyNameRetriever could not be found.  Looking at the code on github,

the NETCORE compile constant removes the line

AddComponent<IAssemblyNameRetriever, AssemblyNameRetriever>();

from StandardKernel.cs

however, CompiledModuleLoaderPlugin uses IAssemblyNameRetriever in it's constructor and

AddComponent<IModuleLoaderPlugin, CompiledModuleLoaderPlugin>();

is still included in the NETCORE version.



Last Updated: 28 Jan 2021 15:47 by ADMIN

Hi Team,

The main site is blocked in Sweden. I spoke to my VPN provider and got the exit IP address (

They said that the IP address used to be listed as an Iran IP in older GEO IP databases, which would explain why is not working, even though it is from Stockholm

Can you please double check that your GEO IP database is not listing the Swedish IP address as being in Iran?

Thank you,


Last Updated: 21 Oct 2020 09:33 by ADMIN
Created by: Ivo
Comments: 1
Type: Bug Report

The internal (non-public) events are not handled properly by JustMock, there is no indication for error, Raise arrangement simply does not working as expected. The following sample reproduces the issue:

namespace TestExample
    public class ClassWithEvents
        internal event EventHandler<EventArgs> InternalEventToTest;

    public class EventTests
        public void ClassWithEvents_InternalEventTest()
            bool eventRaised = false;
            ClassWithEvents classWithEvents = Mock.Create<ClassWithEvents>();
            classWithEvents.InternalEventToTest += (object sender, EventArgs e) =>
                eventRaised = true;

            // Act
            Mock.Raise(() => classWithEvents.InternalEventToTest += null, new EventArgs());

            // Assert

Last Updated: 21 Oct 2020 09:33 by ADMIN
The required configuration for code coverage transparent integration has been changed since 2020.2 release and currently JustMock integration with dotCover is not working as expected. Manually applying the extra entries fixes the issue with execution, but there is no actual coverage collection. 
Last Updated: 21 Oct 2020 09:32 by ADMIN

I am unable to debug my unit test .NET project. I keep getting several of these errors, and it is super slow as code tries to execute every line. I have rebooted and restarted VS 2019 several times, reinstalled JustMock but the error won't go away.

Visual Studio Output windows shows following repeated errors:

Exception thrown calling IDebugWindowPlugin plugin: System.NullReferenceException: Object reference not set to an instance of an object.

   at Telerik.JustMock.Plugins.ObjectInfo.FromObject(Object value)
   at Telerik.JustMock.Core.MocksRepository.<>c.<DispatchInvocation>b__51_2(Object arg)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Telerik.JustMock.Core.MocksRepository.DispatchInvocation(Invocation invocation)
Last Updated: 17 Sep 2020 09:25 by ADMIN
Created by: Robert
Comments: 1
Type: Bug Report
The test execution of a test hangs forever. Please see the attached VS 2019 Solution that contains one TestMethod.

R2 2020 is unusable. I reverted back to R1 and there the tests succeed in less than a second.
Last Updated: 22 Jun 2020 11:12 by ADMIN
Debug Window affects performance in local test run when not debugging. The expected behavior is the Debug Window to not be loaded in this scenario.
Last Updated: 20 May 2020 10:55 by ADMIN
Last Updated: 24 Mar 2020 16:37 by ADMIN


When enabling JUSTMOCK Profiler it stops a MS rdlc report to render.

I have attached a simple sample demonstrating the error.

The error that the render gives back is the following.

The definition of this report is not valid or supported by this version of Reporting Services. The report definition may have been created with a later version of Reporting Services, or contain content that is not well-formed or not valid based on Reporting Services schemas. Details: Deserialization failed: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) Line 2, position 2.

I have tried to different target version of the .NET framework 4.5.2; 4.6.2, different platform targets "ANY,x86,x64", different VS IDE "2012, 2015", different Microsoft.ReportViewer.WinForm  ver. 11,12,14

Last Updated: 24 Mar 2020 16:25 by ADMIN
Having a sample configuration:
<DataCollector friendlyName="Code Coverage Wrapper">
    <SinkDataCollector friendlyName="Code Coverage" IsLinked="true" />
Currently, the attribute names are not consistent in the naming convention which might lead to errors.
1 2 3