Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6907895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:29:33+00:00 2026-05-27T08:29:33+00:00

Trying to avoid the FxCop warning ‘Do not raise reserved exceptions’ from a C++/CLI

  • 0

Trying to avoid the FxCop warning ‘Do not raise reserved exceptions’ from a C++/CLI library so I decided to break down and write my own exception type.

[Serializable]
public ref class CaptureException : public Exception
{
public:
    CaptureException() : Exception() {}
    CaptureException(String^ message) : Exception(message) {}
    CaptureException(String^ message, Exception^ inner) : Exception(message, inner) {}
protected:
    CaptureException(System::Runtime::Serialization::SerializationInfo^ info, System::Runtime::Serialization::StreamingContext^ context) : Exception(info, context) {}
};

This doesn’t compile stating

error C2664: 'System::Exception::Exception(System::String ^,System::Exception ^)' : cannot convert parameter 1 from 'System::Runtime::Serialization::SerializationInfo ^' to 'System::String ^'

I’m not sure why I’m getting this error. Does the C++/CLI not have the full exception class? I’m just trying to implement the standard constructors for my exception and in C# it looks like this and compiles fine.

[Serializable]
public class CaptureException : Exception
{
    public DatabaseConnectionException() { }
    public CaptureException (string message) : base(message) { }
    public CaptureException (string message, Exception inner) : base(message, inner) { }
    protected CaptureException (
      System.Runtime.Serialization.SerializationInfo info,
      System.Runtime.Serialization.StreamingContext context)
        : base(info, context) { }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:29:34+00:00Added an answer on May 27, 2026 at 8:29 am

    StreamingContext is a value type (i.e. a struct), so you’ll want to remove the hat ^:

        CaptureException(System::Runtime::Serialization::SerializationInfo^ info, System::Runtime::Serialization::StreamingContext context) : Exception(info, context) 
    {} 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to avoid filesort but not getting luck in removing it from
I'm trying to avoid the N+1 queries problem with eager loading, but it's not
From the get go, let me say that I'm trying to avoid using pcntl_fork()
I'm trying to avoid that when a user has connected to Facebook from my
Trying to avoid the SomethingManager trap here... Let's say I'm going to write a
After trying to avoid JavaScript for years, Iv started using Query for validation in
I'm trying to avoid a composite control or using and ASCX by extending an
I'm trying to avoid code like this when reusing the same ViewUserControl in ASP.NET
I'm trying to avoid the use of magic strings as much as I can,
I'm trying to avoid the memory leak in PHP. When I create a object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.