Skip to content

System.ArgumentException : Duplicate type name within an assembly #1247

Answered by rileyharris7
rileyharris7 asked this question in Q&A
Discussion options

You must be logged in to vote

@egil and @linkdotnet
The Telerik team figured out what was going on, I'll repeat what I received from them:

"JustMock uses Castle Core to create proxies and the issue is caused by the attempt to emit the types at runtime with the same name. It seems to be specific to Bunit-style unit tests using razor files, and related to the types and namespaces mapping of the code blocks. Anyway, there is a relatively easy solution to the problem, you need just to modify the extension class as follows:"

namespace DuplicateTypeNameRepro.Test.MockServices
{
    public static class MockServices
    {
        static IWindowFactory windowFactory = Mock.Create<IWindowFactory>();
        static IBrowserService 

Replies: 2 comments 12 replies

Comment options

linkdotnet
Oct 27, 2023
Maintainer Sponsor

You must be logged in to vote
11 replies
@rileyharris7
Comment options

@linkdotnet
Comment options

linkdotnet Nov 1, 2023
Maintainer Sponsor

@egil
Comment options

@rileyharris7
Comment options

@EdCharbeneau
Comment options

Comment options

You must be logged in to vote
1 reply
@egil
Comment options

Answer selected by egil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants