Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

After updating from version 111.2 to 111.3, a C++/CLI project that uses libraries that use Restsharp reports a C2870

Aperta
#2,233 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cpp, csharp
Ambito
api, backend

Direzione di ricerca

Inizia con la riproduzione segnalata: una .NET 8 C# Class Library che usa RestSharp 111.3.0 come dipendenza e un progetto CLR Class Library (.NET) che vi fa riferimento. Confronta la compilazione C++/CLI con RestSharp 111.2.0 e 111.3.0, quindi verifica che gli errori C2870 non si verifichino più dopo l'aggiornamento senza ricorrere alla soluzione alternativa del downgrade.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

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

  1. Create a new solution with a "C# Class Library" (I use .net 8), add Restsharp 111.3.0 per nuget as Dependency
  2. Add a new "CLR Class Library (.NET)"-Project, add the C#-Assembly as Dependency
  3. Build => C2870
  4. Downgrade the Restsharper-nuget to 111.2.0
  5. 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):

  • OS: Microsoft Windows 11 Pro (Build 10.0.22631)
  • .NET 8
  • RestSharp Version 111.2.0 and 111.3.0
Lingua principale
C#
Stelle
9.8k
Fork
2.3k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di restsharp/RestSharp

Tutte le issue di restsharp/RestSharp

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.