Home Dashboard Directory Help

C1001 - Compiler crash on C++/CLI project in VS2010 when target framework is 3.5 by BricknerB


 as Won't Fix Help for as Won't Fix

Sign in
to vote
Type: Bug
ID: 560606
Opened: 5/21/2010 12:51:47 AM
Access Restriction: Public
User(s) can reproduce this bug


I'm trying to compile my C++/CLI project in Visual Studio 2010. It works fine when the target framework is 4.0. When I try to target the framework to 3.5, I get a C1001 compiler error.

I've managed to reproduce the issue in a tiny project and I'll attach it so you can reproduce it with ease.

This is the code that crashes (on the gcnew line):

String^ Class1::Bar::get()
    std::string a;
    return gcnew String(a.c_str());
Sign in to post a comment.
Posted by Neil.W on 4/7/2012 at 8:59 AM
Is there a hotfix for Visual Studio 2010 for this crash? The referenced hotfix is for Visual Studio 2008. Thanks.
Posted by Brad.Cunningham on 12/30/2010 at 11:51 AM
The workaround listed here actually seems to cause other issues with loading DLL's not sure exactly what was going on but I was getting a lot of unable to find assembly errors when using this work around.

The correct way to fix this issues appears to be three steps.

1. Make sure the Platform Toolset is set to v90 (Project Properties | Confg Props | General)

2. Make sure TargetFrameworkVersion is set to v3.5 in the project file (Right Click on project | Unload project | Edit)
Under property Group Globals add     <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

2. Apply this hotfix to get rid of the crash http://code.msdn.microsoft.com/KB976656
Posted by Microsoft on 6/8/2010 at 10:59 AM
Hi Brickner,

While we certainly should not be crashing, targeting the 3.5 framework with the Visual C++ 2010 compiler is not supported. The Visual C++ 2010 compiler only supports targeting the 4.0 framework.

Posted by Microsoft on 5/21/2010 at 4:02 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Eric Nicholson on 9/22/2010 at 8:43 AM
There's a good discussion of the issue at StackOverflow:http://stackoverflow.com/questions/2106163/target-net-3-5-c-cli-in-visual-studio-2010-beta-2

In many cases manually adding <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences> to the <PropertyGroup Label="Globals"> section of your vcxproj file may resolve the issue by suppressing the addition of System.Core. Other issues may exist though...
File Name Submitted By Submitted On File Size  
C1001.zip 5/21/2010 3 KB