Completed
Last Updated: 05 May 2023 06:59 by ADMIN
The issue has been detected for the first time in an attempt for integration between dotTrace 2022.3.2 and JustMock 2023.R1, but it also applies to dotCover and all subsequent versions after 2022.3 of both products.
Completed
Last Updated: 06 Nov 2013 10:30 by Ovidiu
Hi,


Since I upgraded my JustMock I was unable to debug ASP.NET projects. I accidentally found a resolution to the problem here:

http://stackoverflow.com/questions/19415275/asp-net-mvc4-code-not-running

"If you are using Telerik JustMock as a mocking framework and have recently updated it to the 2013 Q3 version, it causes this exact problem. I was able to resolve this issue by uninstalling the mocking framework and installing the 2013 Q2 version."

So I uninstalled JustMock and everything came to normal.


Regards,
Ovidiu
Completed
Last Updated: 16 Jan 2019 08:51 by ADMIN
Created by: Michael
Comments: 4
Type: Bug Report
7
Creating a share link with Visual Studio Live Share does not work if you have the JustMock profiler enabled. We specifically have to disable the JustMock profiler in order for VS Live Share to create sharing links. This has been reproduced by several different members of our team.

Could this please be looked into? Thanks!
Completed
Last Updated: 12 May 2022 07:51 by ADMIN
A System.InvalidProgramException is thrown when async unit tests are executed inside Visual Studio with code coverage. The unit tests are testing an implementation of Microsoft.Extensions.Caching.Distributed.IDistributedCache.
Completed
Last Updated: 21 Oct 2020 09:33 by ADMIN
Created by: Ivo
Comments: 1
Type: Bug Report
4

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;
    }

    [TestClass()]
    public class EventTests
    {
        [TestMethod]
        public void ClassWithEvents_InternalEventTest()
        {
            //Arrange
            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
            Assert.IsTrue(eventRaised);
        }
    }
}

Completed
Last Updated: 22 Jun 2022 13:47 by ADMIN
Created by: Mihail
Comments: 4
Type: Bug Report
4

When a breakpoint is added inside an async test that uses JustMock the debugger is failing to hit it. 

To reproduce the issue follow the next steps:

1. Open the attached project

2. Create a breakpoint at the first arrangement in the async test method.

3. Start debugging the async test

Result: the breakpoint is not hit.

The issue is observed for both .NET Core and .NET Framework.

Completed
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.
Completed
Last Updated: 18 Jun 2019 08:43 by ADMIN
There is a different behaviour when mocking the same method using the following two Arrange overrides:

public static FuncExpectation<TResult> Arrange<TResult>(Expression<Func<TResult>> expression);
public static FuncExpectation<TResult> Arrange<T, TResult>(T obj, Func<T, TResult> func);

Repro project attached. Steps to reproduce:
1. Open attached solution
2. In Tests.cs, run JustMockArrangeQueryableTest - it passes
3. Run JustMockArrangeQueryableTest2 - it fails with a invalid cast exception on the Residents collection.
Completed
Last Updated: 22 Jun 2022 13:44 by ADMIN
Currently, JustMock extension always uses the profiler deployed by the installation, which may be different from the one deployed by the JustMock.Commercial package. This could lead to unexpected failures in the rest run and different results inside and outside Visual Studio.
Completed
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. 
Completed
Last Updated: 17 Oct 2023 12:32 by ADMIN
Created by: Ivo
Comments: 1
Type: Bug Report
1

A unit test run against a simple class using EntityFramework never completes, here's the code:

public class DbContext1 : DbContext
{
    public DbContext1(string connectionString)
    {
    }
}

public class Program
{
    private static readonly SemaphoreSlim _lock = new SemaphoreSlim(1, 1);

    public async Task Run()
    {
        await _lock.WaitAsync();
        try
        {
            await InsertDbRow();
        }
        finally
        {
            _lock.Release();
        }
    }

    private static async Task InsertDbRow()
    {
        await RetryWrapperAsync(async () =>
        {
            using DbContext1 dbContext = new DbContext1("con str");
            await dbContext.SaveChangesAsync();
        });
    }

    public static async Task RetryWrapperAsync(Func<Task> operation)
    {
        for (int i = 0; i < 3; i++)
        {
            try
            {
                await operation();
                break;
            }
            catch (Exception)
            {
                await Task.Delay(100);
            }
        };
    }
}

[TestClass]
public class ProgramTest
{
    private readonly DbContext1 mockContext1 = Mock.Create<DbContext1>();

    [TestInitialize]
    public void SetUp()
    {
        Mock.Arrange(() => new DbContext1("con str")).Returns(mockContext1);
    }

    [TestMethod]
    public async Task TestMethod()
    {
        // Arrange
        Program program = new Program();

        // Act
        await program.Run(); // <-- at this point the test hangs
    }
}

Adding do-nothing arrangement on mockContext.SaveChanges fixes the hang, but the expectation is that mock will handle this case by default and there is no need to be explicitly arranged.

Completed
Last Updated: 07 Dec 2022 11:53 by ADMIN

Referencing the nuget Microsoft.ApplicationInsights.AspNetCore V2.20.0 in the project that is tested leads to the VS 2019 code coverage failing to produce the report. Here are the steps to reproduce:

1. Create a project from the template ASP.NET Core Web API targeting .NET 5

2. Add a reference to the nuget package Microsoft.ApplicationInsights.AspNetCore V2.20.0

3. Create a unit test project from the C# JustMock Test Project (.NET Core) template.

4. Run the VS code coverage.

Expected result: the code coverage report is produced.

Actual result: there is no code coverage report

Completed
Last Updated: 04 Nov 2013 16:02 by ADMIN
using NUnit.Framework;
using Telerik.JustMock;

namespace Example
{
    public class MyClass
    {
        public MyClass(int a = 5) { }
    }

    [TestFixture]
    public class TestMyClass
    {
        [Test]
        public void test_MyClass()
        {
            Mock.Create<MyClass>(Behavior.CallOriginal);
        }
    }
}

Telerik.JustMock.MockException : Can not instantiate proxy of class: Example.MyClass.
Could not find a parameterless constructor.
   at Telerik.JustMock.Core.MocksRepository.Create(Type type, MockCreationSettings settings)
   at Telerik.JustMock.MockBuilder.Create(MocksRepository repository, Type type, Object[] constructorArgs, Nullable`1 behavior, Type[] additionalMockedInterfaces, Nullable`1 mockConstructorCall, IEnumerable`1 additionalProxyTypeAttributes, List`1 supplementaryBehaviors, List`1 fallbackBehaviors, List`1 mixins)
   at Telerik.JustMock.Mock.<>c__DisplayClass5b`1.<Create>b__5a()
   at Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal[T](Func`1 guardedAction)
   at Telerik.JustMock.Mock.Create[T](Behavior behavior, Object[] args)
   at Example.TestMyClass.test_MyClass() in c:\users\micah\Documents\Source\Test\Test\Class1.cs:line 17#0

This appears to be related to the recent fix for "Improve exception message for Mock.Create".  Without Behavior.CallOriginal it works.  Supplying a parameter also works.
Completed
Last Updated: 22 Jun 2022 13:45 by ADMIN

The case is reproducible (but might not be limited to) in a dedicated environment including Windows 10, JustMock R3.2021, Visual Studio 2019 and .NET 5. When the profiler is enabled the Visual Studio has problems with the test discovery and reports "Stack overflow" exception. The same applies to building solutions with Azure Function project.

CLR Stack from memory dump captured upon test execution:

000000CD7CE038D0 00007ffafb22d3b6 [GCFrame: 000000cd7ce038d0]
000000CD7CE03A40 00007ffafb22d3b6 [GCFrame: 000000cd7ce03a40]
000000CD7CE0A530 00007ffafb22d3b6 [PrestubMethodFrame: 000000cd7ce0a530] System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(System.Reflection.RuntimeAssembly, System.String)
000000CD7CE0A988 00007ffafb22d3b6 [GCFrame: 000000cd7ce0a988]
000000CD7CE0E3C0 00007ffafb22d3b6 [PrestubMethodFrame: 000000cd7ce0e3c0]  System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(System.Reflection.RuntimeAssembly, System.String)

... (omitted for brevity)

000000CD7CF72548 00007ffafb22d3b6 [GCFrame: 000000cd7cf72548]
000000CD7CF75F80 00007ffafb22d3b6 [PrestubMethodFrame: 000000cd7cf75f80] System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(System.Reflection.RuntimeAssembly, System.String)
000000CD7CF763D8 00007ffafb22d3b6 [GCFrame: 000000cd7cf763d8]
000000CD7CF79E10 00007ffafb22d3b6 [PrestubMethodFrame: 000000cd7cf79e10] System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(System.Reflection.RuntimeAssembly, System.String)
000000CD7CF7A268 00007ffafb22d3b6 [GCFrame: 000000cd7cf7a268]
000000CD7CF7DCA0 00007ffafb22d3b6 [PrestubMethodFrame: 000000cd7cf7dca0] System.Collections.Generic.Dictionary`2[[System.__Canon, System.Private.CoreLib],[System.__Canon, System.Private.CoreLib]]..ctor()
000000CD7CF7DF10 00007FFA9B787B2A System.AppContext..cctor() [/_/src/System.Private.CoreLib/shared/System/AppContext.cs @ 16]
000000CD7CF7E340 00007ffafb2b6c93 [GCFrame: 000000cd7cf7e340]
000000CD7CF7ED18 00007ffafb2b6c93 [HelperMethodFrame: 000000cd7cf7ed18]
000000CD7CF7EE20 00007FFA9B7876B9 System.AppContext.Setup(Char**, Char**, Int32)

 

Completed
Last Updated: 12 May 2023 09:34 by ADMIN

Mock.Create<IPool>() fails with 

Telerik.JustMock.Core.MockException : Abstract type 'IPool' is not accessible for inheritance.
   In Telerik.JustMock.Core.MocksRepository.Create(Type type, MockCreationSettings settings)
   In Telerik.JustMock.Mock.<>c__39`1.<Create>b__39_0()
   In Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal[T](Func`1 guardedAction) 

when trying to create a mock object from

public interface IPool
{
    object GetItem(in Struct a, out Class b);
}

 

Completed
Last Updated: 20 May 2019 09:32 by ADMIN
Mocking an async calls alse triggers hidden mocking of the return type. Depending of the type it might cause unexpected behavior or exception.
Completed
Last Updated: 20 May 2019 09:26 by ADMIN
A class property get wrongly mocked when used as parameter for arranging other class methods. The following sample demonstrates the scenario:

class Foo
{
	public string Prop{ get; set; }

	public void Bar(string val)
	{
	}
}

[TestMethod]
public void Sample()
{
	var sut = Mock.Create<Foo>(Behavior.CallOriginal);

	Mock.Arrange(() => sut.Bar(sut.Prop)).DoNothing();
}
Completed
Last Updated: 10 Mar 2022 09:28 by ADMIN
An attempt to use Debug Window while debugging test code results in FileNotFoundException:

Exception thrown calling IDebugWindowPlugin plugin: System.IO.FileNotFoundException: Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
File name: 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Completed
Last Updated: 15 Jan 2020 09:58 by ADMIN
The JustMock tests are failing when the "Test platform version" option in the JustMock VSTest v.2 task is set to value "Installed by Tools Installer".
1 2 3 4