简体   繁体   中英

Visual studio 2015 compile error: CS0570 is not supported by the language

Migrating to VS2015, I encountered a compilation problem. No change on projects' target framework, they remain .net 4.5

The compiler seems not recognize the types of parameters

void BootstrapOIS(List<long>^ %resultDates, List<double>^ %resultRates,
    const long tradingDate, /*const*/ List<int>^ periodNumbers,
    /*const*/ List<String^>^ periods, /*const*/ List<double>^ swapsRates,
    /*const*/ List<long>^ hol);

Error CS0570 'BootstrapWrapper.BootstrapOIS(ref ?, ?, ?, ?, ?, ?, ?)' is not supported by the language

The referenced assembly:

  • Bootstrap, Version=1.0.4918.15400, Culture=neutral, PublicKeyToken=b007f9158e880332
  • Global type:
  • Architecture: x64
  • This assembly contains unmanaged code.
  • Runtime: .NET 4.0

The compilation went well with VS2013.

It looks like you are mixing standard and CLR types in your declaration. The generated code (from ILSpy) is the same but it chokes when using it from C#.

Using only CLR types in the signature seems to work:

void BootstrapOIS(List<Int64>^ %resultDates, List<System::Double>^ %resultRates,
    const Int64 tradingDate, List<Int32>^ periodNumbers, List<String^>^ periods,
    List<Double>^ swapsRates, List<Int64>^ hol);

I have run into a similar problem--supposedly Microsoft has an open bug on this.

Try removing the "const" declaration, and change tradingDate to an Int64 variable. If that resolves it then, congratulations, you have a successful workaround.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM