Last Updated: 04 Nov 2013 15:55 by ADMIN
Created by: Thomas
Comments: 3
Type: Bug Report
I need to be able to mock in Winrt. If that is already possible, then you need to spell out in example form how that is done.
Last Updated: 27 Aug 2013 06:39 by Omer
Created by: Omer
Comments: 0
Type: Bug Report
Hi there, I'm a developer on OzCode, a Visual Studio extension ( ).

We've received some complaints from customers that OzCode is incompatible with JustCode. I installed JustMock, and saw that when Visual Studio starts up, JustMock it seems to be causing a crash in a child process that OzCode spawns off of devenv.exe, which is called 'BugAidMetadataLoader.exe':

The exception in this process is:

Additional information: Could not load type 'Telerik.JustMock.Profiler' from assembly 'mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

I would guess that JustMock is unintentionally causing the process to be loaded with a CLR Profiler attached and injecting code into it, and the injected code causes the crash.

Could you please provide some advice on how to avoid this, or possibly provide a fix?

Thank you very much,
 - Omer Raviv, OzCode
Last Updated: 17 May 2013 12:44 by Jakub
When I try to invoke method from intercepted class in multi-thread test sometimes I get following exception:
Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
   at System.Collections.Generic.List`1.CopyTo(T[] array, Int32 arrayIndex)
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList(IEnumerable`1 source)
   at Telerik.JustMock.Weaver.ContainerContext.InstanceIdentifier.GetUniqueId(Object target)
   at Telerik.JustMock.Weaver.ContainerContext.Get(Type targetType, MethodBase methodInfo, Object target)
   at Telerik.JustMock.Weaver.ContainerContext.Get(MethodBase methodBase, Object target)
   at Telerik.JustMock.Weaver.Interceptors.WeaverInterceptor.OnInvocation(IInvocation invocation)
   at Telerik.JustMock.Weaver.Interceptors.WeaverInterceptor.Telerik.JustMock.Weaver.Interceptors.Abstraction.IWeaverInterceptor.Intercept(IInvocation invocation)
   at TestClass_Interceptor_620e5e80fe0c4d738f7ef291ea50ea2a.Intercept(TestClass, ref Boolean)
   at ExceptionExample.TestClass.ExecuteSomething() in Test.cs: line 174
   at ExceptionExample.RunMethod() in Test.cs: line 199
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Sample class that generates exception:

public class ExceptionExample
	static ExceptionExample()

	public class TestClass
		public void ExecuteSomething()
			int y = 0;
			for (int i = 0; i < 100; i++)
				y += i;

	public void MethodName()
		List<Thread> l = new List<Thread>();

		for (int i = 0; i < 6; i++)
			Thread t = new Thread(RunMethod);

		l.ForEach(th => th.Join());

	private void RunMethod()
		for (int i = 0; i < 10000; i++)
			TestClass tc1 = new TestClass();
Last Updated: 18 Jun 2019 14:21 by ADMIN
The scenario includes two async tests executed synchronously. The first test doesn't have an await task call and in some random runs fails to call Mock.Reset. This messes the mocked objects of the second async test.
Last Updated: 18 Jun 2019 10:06 by ADMIN

Values from already mocked methods are not taken into account when initializing a static constructor from the Telerik.JustMock.PrivateAccessor class.

Here is an example: PrivateAccessor.ForType(typeof(Foo)).SetField("someStringField", "stringvalue");

A workaround is to call the: Mock.Intercept(typeof(Foo)); before calling the PrivateAccessor.

Last Updated: 02 Dec 2019 10:39 by ADMIN
Mocking a method that is not used in the test execution logic could lead to unwanted recursive mocking behavior for the rest of the methods in the class. 
The unwanted behavior could later result in an exception if the affected methods are called during the arrangement of another method.
Last Updated: 02 Dec 2019 10:38 by ADMIN

After upgrading to .NET Core 3.0 an exception is thrown for some of the JustMock methods like DoNothing() and Throw(). In the case for DoNothing() the exception is thrown only for methods that are returning value.

Here is the full exception:
System.InvalidCastException : Unable to cast object of type 'System.AppDomainSetup' to type 'YourType' 

Last Updated: 24 Sep 2019 10:12 by ADMIN
Created by: Scott
Comments: 2
Type: Bug Report

I just installed it onto desktop, loaded Visual Studio 2019 (Ent) and i see no visual reference or otherwise to JustMock.

Honestly If i had have spent the $$ by now i'd have uninstalled and given up.

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.
Last Updated: 21 Feb 2020 11:53 by ADMIN
Created by: Toshio
Comments: 0
Type: Bug Report
An attempt to use future mocking fails. The attached sample demonstrates the issue.
Last Updated: 20 Feb 2020 07:05 by ADMIN


According to the JustMock documentation, to validate a method on the mock was called it should be done like so:

public void ShouldThrowExceptionWhenMustBeCalledSetupIsNeverInvoked() 
    // Arrange 
    var foo = new Foo(); 

    Mock.Arrange(() => foo.Execute()).MustBeCalled(); 

    // Assert 
    Assert.Throws<AssertFailedException>(() => Mock.Assert(foo)); 

When I do that, the application fails to compile saying the type AssertFailedException does not exist, even though I have the using statement for the Telerik.JustMock assembly at the top of my file. If I try to fully qualify it like so:


I get the same message for the "Xunit" namespace.

I know that the type should exist since when I run the test asserting a different type of Exception, the test fails saying it expects an exception of type Telerik.JustMock.Xunit.AssertFailedException.

I am attaching a couple of images that illustrate the problem.

Thank you.


Last Updated: 20 Feb 2020 07:04 by ADMIN
When I try to create a new JustMock test project for .NET Framework the version of .NET Framework that I select is not respected. The result is that the used version of .NET Framework is always 4.5.2
Last Updated: 20 Feb 2020 06:53 by ADMIN

The integration does not work as expected when the tests are run on the command line outside Visual Studio via dotnet test command. The coverage is used as Microsoft.CodeCoverage NuGet package.


In Development
Last Updated: 19 Feb 2020 08:24 by ADMIN
Last Updated: 05 Feb 2020 10:56 by ADMIN
Asynchronous test execution might be run in a separate thread (it depends of the environment and it is completely transparent) which causes arrangements to lose their context. That is why the expected mocked return value for DateTime.UtcNow calls the original code and finally the test fails.
Last Updated: 12 Sep 2018 14:04 by ADMIN
MbUnitContextResolver gets wrongly initialized because of the weak check based on Gallio.Framework.Assertions.AssertionException type presence in the current app domain. Needs to be improved with some additional type check from mbunit assembly, MbUnit.Framework.TestFixtureAttribute for example.
Last Updated: 22 Jun 2018 07:48 by Jeremy
Created by: Michele
Comments: 3
Type: Bug Report
In Visual Studio 2015 Pro justmock generates this error error MSB6006: "vbc.exe" To function properly you need to uninstall VS2015 justmock.

Last Updated: 12 Oct 2018 10:29 by ADMIN
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.
Last Updated: 12 Oct 2018 08:45 by ADMIN
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.