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)