C# 角色中的TypeLoadException

C# 角色中的TypeLoadException,c#,asp.net-mvc,testing,C#,Asp.net Mvc,Testing,当我创建一个用户并给他们一个角色时,我正在编写一个测试,然后检查以确保正确地给了这个角色。我能够创建用户,分配角色,将用户加载到HttpContext.Current,并持久化用户。然而,当我检查角色是否被正确分配时,我得到以下错误 An exception of type 'System.TypeLoadException' occurred in System.Web.dll but was not handled in user code Additional information:

当我创建一个用户并给他们一个角色时,我正在编写一个测试,然后检查以确保正确地给了这个角色。我能够创建用户,分配角色,将用户加载到HttpContext.Current,并持久化用户。然而,当我检查角色是否被正确分配时,我得到以下错误

An exception of type 'System.TypeLoadException' occurred in System.Web.dll but was not handled in user code

Additional information: Could not load type 'MyProject.Repositories.RQRole' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
我搜索了所有地方,没有MyProject.exe,但有一个MyProject调试数据库。MyProject.dll就在那里,其他引用它的测试可以很好地完成它

这是抛出错误的行

Assert.IsTrue(System.Web.Security.Roles.IsUserInRole("user"));
我指定了dll的特定名称,它工作得很好