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: 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: 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!
Declined
Last Updated: 05 Dec 2019 15:24 by ADMIN
The debugger arrowhead pointer is not positioned to the correct execution line when debugging .Net Core. Stepping the code line by line advances the yellow arrowhead pointer based on the initial offset/messed position. When the arrowhead leaves the method the remaining lines are executed at once.
Declined
Last Updated: 10 Feb 2021 11:10 by ADMIN

Having the following COM interop class

[ClassInterface(ClassInterfaceType.None)]
[Guid("86332C4E-0BDE-46EC-94C5-0A946C33C682")]
[TypeLibType(TypeLibTypeFlags.FCanCreate)]
public class MyComObjectClass : IMyComObject, MyComObject
{
    public MyComObjectClass();

    [DispId(1)]
    public virtual string Echo(string message);
}

and the sample class that uses it:

public class MyComObjectClassProxy
{
    public string Echo(string message)
    {
        IMyComObject itf = null;
        try
        {
            itf = new MyComObjectClass();
            return itf.Echo(message);
        }
        finally
        {
            if (itf != null)
            {
                Marshal.ReleaseComObject(itf);
            }
        }
    }
}

When I try to call the arranged constructor I am getting an error "Cannot create instances of type requiring managed activation", the unit test code:

[TestMethod]
public void TestMethod1()
{
    var mock = Mock.Create<MyComObjectClass>();
    Mock.Arrange(() => new MyComObjectClass()).Returns(mock);

    var sut = new MyComObjectClassProxy();
    var actual = sut.Echo("Message");

    Assert.AreEqual(string.Empty, actual);
}
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: 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);
        }
    }
}

Declined
Last Updated: 02 Feb 2021 09:25 by ADMIN
The issue is reproducible inside Visual Studio 2017, the same tests are running normaly outside the IDE or using 2019.
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 Aug 2024 14:04 by ADMIN

if you use the C# using declaration and have JustMock advanced (elevated) mode enabled, the runtime will throw an InvalidProgramException.

Find below the sample code that demonstrates the issue:

public class TestClass : IDisposable
{
    public void Dispose()
    {
    }
}

[TestClass]
public class Fixture
{
    public interface ITest { }

    [TestMethod]
    public async Task Test()
    {
        ITest mock = Mock.Create<ITest>();
        using TestClass test = new();
    }
}

Unplanned
Last Updated: 23 Jul 2018 12:48 by Stefan
My team and I have spotted some odd behaviour with the latest version of JustMock (2015.3.929.5) when targeting a Windows Store app.

If we create a mock for an object in a helper method, the mock fails when making assertions for calls to the mock.

The following code illustrates the issue:

        [TestMethod]
        public void ThisWillFail()
        {
            var subject = CreateSubject();

            subject.DoSomething();

            subject.Assert(s => s.DoSomething(), Occurs.Once());
        }

        [TestMethod]
        public void ThisWillPass()
        {
            var subject = Mock.Create<ISubject>();

            subject.DoSomething();

            subject.Assert(s => s.DoSomething(), Occurs.Once());
        }

        public interface ISubject
        {
            void DoSomething();
        }

        private static ISubject CreateSubject()
        {
            return Mock.Create<ISubject>();
        }

In this code, the first test will fail but the second test will pass. The only difference is that, in the first test, we're setting up the mock in a helper method.

We have a "Unit Test Library (.NET for Windows Store apps)" referencing the Telerik.JustMock assembly. I have attached a simple project containing this implementation.

It's worth noting that the same code passes in a regular .NET class library; it only fails in a "Unit Test Library (.NET for Windows Store apps)". It's also worth noting that this worked under an older version of the assembly (2014.3.1021.2).

Any help would be appreciated, as we currently have around 3,000 tests and a good proportion of them set up their mocks using a helper method in this way.

Regards
William Cowell
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.
Declined
Last Updated: 26 Oct 2020 15:25 by ADMIN

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.

 

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: 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: 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: 15 Nov 2024 09:35 by ADMIN
Created by: Ivo
Comments: 1
Type: Bug Report
2

With R3 2023 (2023.3.1011.155) JustMock introduces a new functionality that might lead to a huge performance drop and event to unexpected failures. Currently, the issue could be suppressed by setting up an environment variable JUSTMOCK_NEWOBJ_INTERCEPTION_ON_OVERWRITE_ENABLED to 0 (the default value is 1), but a more reliable and independent solution should be found.

Declined
Last Updated: 17 May 2013 12:29 by Mohd
ADMIN
Created by: Mihail
Comments: 1
Type: Bug Report
1
Since JustMock Q1 2013 Mock.DoNotUseProfiler() is marked as an obsolete method and I cannot compile my test project. Revert it back.
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.
Declined
Last Updated: 29 Nov 2017 12:53 by ADMIN
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
1 2 3 4 5 6