Skip to content

[Bug]: Cannot build the project because of namespace that doesn't exits - TUnit.Mocks.Generated #5281

@beauchama

Description

@beauchama

Description

TUnit.Mocks will auto-generate the global using file but the namespace TUnit.Mocks.Generated will appear in this file and doesn't exist because there is no generated mock.

Image

Expected Behavior

No error and can build the project even there is no generated mock.

Actual Behavior

I can't build the project because there is a namespace that doesn't exist yet unless I use a Mock.

Steps to Reproduce

  • Create a solution
  • Install TUnit.Mocks
  • Build the project
  • The project will fail with the error

TUnit Version

1.22.3-beta

.NET Version

.NET 10.0

Operating System

Windows

IDE / Test Runner

Visual Studio

Error Output / Stack Trace

The type or namespace name 'Generated' does not exist in the namespace 'TUnit.Mocks' (are you missing an assembly reference?)

Additional Context

No response

IDE-Specific Issue?

  • I've confirmed this issue occurs when running via dotnet test or dotnet run, not just in my IDE

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions