LeenyS

I am creating a Web site project using VS 2008 - Beta. I have added a class userAccess.cs to the project. However, when I right click a method of the class and select create unit tests, it runs for a while and then generates the following error in the output window

While trying to generate your tests, the following errors occurred:

Object reference not set to an instance of an object.

A test project is created but when I try to build this I get the following error

mscorlib.accessor: The reference to 'mscorlib.dll' was not found in the list of this projects references.

If I do the above steps in VS 2005 - it works fine.

I would appreciate your help, I have been struggling for a while now.



Re: Visual Studio Team System - Testing Unit Testing VS 2008

LeenyS

An update..

I added another method to the class

public void myMethod2()

{

}

The unit test was successfully generated.

However, the first method

public int myMethod1(string a, string b)

still fails.





Re: Visual Studio Team System - Testing Unit Testing VS 2008

David Gorena Elizondo - MSFT

Hello,

Can you reproduce this behavior with a newly created class library What language are you using It would be very helpful if you could copy/paste your code here, but if you don't want to do this, it would be very helpful to try to reproduce the problem in a newly create project.

Thanks,

David Gorena Elizondo

[MSFT] VSTT





Re: Visual Studio Team System - Testing Unit Testing VS 2008

LeenyS

Thanks for the reply.

I can only reproduce this error for a newly created website project. Other project types (Windows, Web App) are fine.

I am using C#.

Actually, I am trying to work with a newly created project, so there is no code that can be pasted. I am able to replicate this error even for a simple method that just returns 1.

Hope you can help.





Re: Visual Studio Team System - Testing Unit Testing VS 2008

David Gorena Elizondo - MSFT

So, please correct me if I'm wrong with the steps you're following:

1. Create new web site (File System Web Site, C#)

2. Create an App_Code folder to the solution

3. Add a class to the App_Code folder

4. Generate tests against the class

5. Build

6. Error

Is this true Where did you install VS 2008 from

Thanks,

David Gorena Elizondo

[MSFT] VSTT





Re: Visual Studio Team System - Testing Unit Testing VS 2008

LeenyS

Yes David, you are absolutely correct.

We downloaded the beta 2 version of Visual Studio 2008 from the Microsoft website.

Also, in VS 2008, a TestReferences folder is created under the Test project with [MyWebSiteName].accessor and mscorlib.accessor.

In VS 2005, a class VSCodeGenAccessors.cs is generated. I am assuming the implementation has changed in VS 2008.

I really appreciate your help in this regard.





Re: Visual Studio Team System - Testing Unit Testing VS 2008

Coding77

I'm experiencing the same problem. I start of with a brand new clean web site. Add a simple C# class. Add testing to it using the testing wizard. Attempt to compile and get a missing mscorelib error during the compile.

Also using VS2008 beta 2.




Re: Visual Studio Team System - Testing Unit Testing VS 2008

David Gorena Elizondo - MSFT

Hi folks,

I investigated, and it turns to be a known issue. Unfortunately, we were not able to add the fix in Beta 2, and there is no known workaround. We have fixed the bug for our RTM version.

Sorry for the inconvenience.

David Gorena Elizondo

[MSFT] VSTT





Re: Visual Studio Team System - Testing Unit Testing VS 2008

Sterlyng

Delete the mscorlib.accessor file under the Test Reference folder.