In a project with the Async CTP for VS2010 - http://www.microsoft.com/en-us/download/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 NCrunch Developer
#3280
24 Nov 2012 22:43 UTC
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
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
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.
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 NCrunch Developer
#3284
25 Nov 2012 21:56 UTC
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
If you can provide the source, that would be fantastic - I should be able to reproduce this issue much faster with it!
Cheers,
Remco
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/en-ca/download/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.
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/en-ca/download/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 NCrunch Developer
#5893
17 May 2014 03:34 UTC
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?
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?
Edited 17 May 2014 03:35 UTC
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.
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 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 NCrunch Developer
#5900
17 May 2014 21:17 UTC
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.
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.
I'll look into it on Tuesday when May long weekend is over.
Thank you for your patience and quick replies!
Thank you for your patience and quick replies!
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/lucian/archive/2012/03/25/asyncctp-installation-problems-and-vs11.aspx
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/lucian/archive/2012/03/25/asyncctp-installation-problems-and-vs11.aspx
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/packages/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
Using this library instead of the AsyncCtpLibrary.dll:
https://www.nuget.org/packages/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 NCrunch Developer
#5919
20 May 2014 21:34 UTC
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.
Post a reply
Log in to reply.