Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Build error in VS2010 with Async CTP
davegb3
#1 Posted : Saturday, November 24, 2012 1:49:18 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/24/2012(UTC)
Posts: 2
Location: Germany

In a project with the Async CTP for VS2010 - http://www.microsoft.com...ad/details.aspx?id=9983 - the NCrunch build fails as follows:

CSC (0)#0: Predefined type 'System.Runtime.CompilerServices.IAsyncStateMachine' is not defined or imported
Workers\DecryptionDecompressionQueueWorker.cs (46)#1: Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?
Workers\DecryptionDecompressionQueueWorker.cs (49)#2: Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?
Workers\DecryptionDecompressionQueueWorker.cs (28)#3: Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?
CSC (0)#4: Predefined type 'System.Runtime.CompilerServices.IAsyncStateMachine' is not defined or imported
Workers\DecryptionDecompressionQueueWorker.cs (74)#5: Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?
Workers\DecryptionDecompressionQueueWorker.cs (72)#6: Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?
CSC (0)#7: Predefined type 'System.Runtime.CompilerServices.IAsyncStateMachine' is not defined or imported
Workers\CompressionEncryptionQueueWorker.cs (48)#8: Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?
Workers\CompressionEncryptionQueueWorker.cs (51)#9: Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?
:Workers\CompressionEncryptionQueueWorker.cs (28)#10 Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?
:CSC (0)#11 Predefined type 'System.Runtime.CompilerServices.IAsyncStateMachine' is not defined or imported
:Workers\CompressionEncryptionQueueWorker.cs (81)#12 Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?
:Workers\CompressionEncryptionQueueWorker.cs (79)#13 Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?


The required library for the CTP (AsyncCtpLibrary) is copied to a relative "lib" path and referenced from there. I've tried adding the AsyncCtpLibrary.dll to the NCrunch "additional files to include", but it made no difference.

Any ideas?

Thanks,
Dave.
Remco
#2 Posted : Saturday, November 24, 2012 10:43:56 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Dave,

Thanks for posting!

Does NCrunch work with this project if you set it up to run in compatibility mode? I suspect there may be something unique about this framework that NCrunch's behaviour is disrupting.


Cheers,

Remco
davegb3
#3 Posted : Sunday, November 25, 2012 12:41:11 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/24/2012(UTC)
Posts: 2
Location: Germany

No, compatibility mode makes no difference. I've set all the options on all projects as described, and still get the same error.

If there are any logs I can produce, or anything else that could help just let me know. As the code (will be) open source, I'm happy to provide a link to it, if a sample project would help?

Thanks again for any further hints.

Dave.
Remco
#4 Posted : Sunday, November 25, 2012 9:56:26 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Dave -

If you can provide the source, that would be fantastic - I should be able to reproduce this issue much faster with it!


Cheers,

Remco
daflame
#5 Posted : Friday, May 16, 2014 11:10:20 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/16/2014(UTC)
Posts: 5
Location: Canada

I am also experiencing the same issues as Dave. I noticed he hasn't replied.
All you need to do to reproduce the problem is to install the Async CTP version 3 and include AsyncCtpLibrary.dll into your project.
http://www.microsoft.com...ad/details.aspx?id=9983

A simple test case:

using Nunit.Framework;
using System.Threading.Tasks;

[TestFixture]
public class MyFixture
{
[Test]
public async void MyTest()
{
await TaskEx.Run(DoNothing)
}

private void DoNothing()
{
}
}

This will not build in nCrunch, but it builds fine in Visual Studio 2010.
Remco
#6 Posted : Saturday, May 17, 2014 3:34:47 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for sharing the steps to reproduce.

To try and get this issue to show, I've set up a VM with VS2010 SP1 installed, then installed Async CTP Version 3.

I then created a class library project with a reference to NUnit and the AsyncCtpLibrary, using the code you've provided above.

Unfortunately the project built correctly under NCrunch and the test ran without problems.

Can you share some more information about your environment? Are there other toolsets involved in your situation? Which version of NCrunch are you running?
daflame
#7 Posted : Saturday, May 17, 2014 4:06:06 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/16/2014(UTC)
Posts: 5
Location: Canada

I am running win7 64bit and after installing the async CTP. I also installed. NET 4.5 (other programs I have rewire it).
I didn't check whether it was the installation of. NET 4.5 that caused this, but it could be. Still,, this configuration should work. I can compile the code manually and run the tests with NUnit.

Remco;5893 wrote:
Hi, thanks for sharing the steps to reproduce.

To try and get this issue to show, I've set up a VM with VS2010 SP1 installed, then installed Async CTP Version 3.

I then created a class library project with a reference to NUnit and the AsyncCtpLibrary, using the code you've provided above.

Unfortunately the project built correctly under NCrunch and the test ran without problems.

Can you share some more information about your environment? Are there other toolsets involved in your situation? Which version of NCrunch are you running?

Remco
#8 Posted : Saturday, May 17, 2014 9:17:28 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
I think something that would be useful here in figuring this out is to try building the project NCrunch has created inside its workspace.

After NCrunch fails to build your project, right click on the failed project in the Tests Window, then choose Advanced->Browse to workspace.

This will open up an explorer window into the workspace NCrunch has constructed for your project. Find the .csproj file, then try running msbuild.exe against this file. Does the file build for you? If not, you could try comparing it against the normal project file to deductively figure out which change has caused it to start failing.
daflame
#9 Posted : Sunday, May 18, 2014 1:54:27 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/16/2014(UTC)
Posts: 5
Location: Canada

I'll look into it on Tuesday when May long weekend is over.

Thank you for your patience and quick replies!
daflame
#10 Posted : Tuesday, May 20, 2014 4:26:47 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/16/2014(UTC)
Posts: 5
Location: Canada

After much work looking over the files in the nCrunch build folder, it seems that when you run msbuild at the command prompt it fails with the same error, but when you load up the same project file into Visual Studio and compile it, it builds successfully.
This is not isolated to nCrunch it seems. It appears to be an msbuild issue, since it also behaves exactly the same way in the project folder at the command prompt.
I can only guess that there is a serious conflict between .NET 4.5 and the async CTP.

The problem seems to be outlined here:
http://blogs.msdn.com/b/...n-problems-and-vs11.aspx
daflame
#11 Posted : Tuesday, May 20, 2014 6:09:04 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/16/2014(UTC)
Posts: 5
Location: Canada

On a final note. I did get the library to work with .NET 4.5 installed.
Using this library instead of the AsyncCtpLibrary.dll:
https://www.nuget.org/pa...ges/Microsoft.Bcl.Async

Although it says it does not support Visual Studio 2010, it builds just fine as long as you have the async CTP installed in Visual Studio.

There is also another library that works (albeit not as perfectly), and it does not have the Microsoft license restrictions:
https://www.nuget.org/packages/AsyncBridge
Remco
#12 Posted : Tuesday, May 20, 2014 9:34:01 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Thanks for sharing your experiences here - I'm certain that other people will also find them useful. This isn't the first time I've seen an MS library that will build using VS but not using the command line - I hope this isn't demonstrating a hole in MS testing.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.086 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download