You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
After updating from version 111.2 to 111.3, a C++/CLI project that uses libraries that use Restsharp reports a C2870 #2233
We use a C++/CLI project as a bridge between a native C++ application (Embacadero C++ Builder) and a .Net 8 project (the C++/CLI library provides a C interface for the C++ application, which in turn is used to call partial functionality of project parts that have already been migrated to .Net).
This worked as long as our .Net libraries used at most version 111.2.0 of Restsharp. With the update to 111.3.0, the C++/CLI project throws several C2870 errors:
"C2870 'RestSharp': a namespace definition must appear either at file scope or immediately within another namespace definition <...>.nuget\packages\restsharp\111.3.0\lib\net8.0\RestSharp.dll"
Current workaround: RestSharp downgrade to 111.2
To Reproduce
Create a new solution with a "C# Class Library" (I use .net 8), add Restsharp 111.3.0 per nuget as Dependency
Add a new "CLR Class Library (.NET)"-Project, add the C#-Assembly as Dependency
Build => C2870
Downgrade the Restsharper-nuget to 111.2.0
Build => Success
Expected behavior
The upgrade from 111.2.0 to 111.3.0 should not cause an error
Desktop (please complete the following information):
At our company, we have therefore been forced to remove RestSharp from our project.
We are also planning to do the same, especially given the security vulnerabilities in the older versions.
Activity
xenexelen commentedon Jul 12, 2024
Error also in 111.4.0
adv12 commentedon Oct 21, 2024
Seeing this as well. Same setup: .NET 8, C++/CLI application.
KrissyN commentedon Mar 10, 2025
Is this related to: #2223
This is a significant problem for us, we are having to downgrade the version of RestSharp because of it.
iamxonfug commentedon Mar 26, 2025
I getting this with RestSharp 112 and its becoming a blocker.
xenexelen commentedon Mar 30, 2025
At our company, we have therefore been forced to remove RestSharp from our project. Unfortunately, it cannot be used in combination with C++CLI.
KrissyN commentedon Mar 31, 2025
FlorianHielscher commentedon Nov 20, 2025
Our company is blocked switching to 112.