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

  • SEARCH
  • Home
  • 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 279739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:03:29+00:00 2026-05-12T05:03:29+00:00

Basically, my question is short and sweet: Is the following a bad idea (encapsulating

  • 0

Basically, my question is short and sweet: Is the following a bad idea (encapsulating and rethrowing ex.InnerException instead of ex)

(There’s a similar question here, but not quite… I want to reencapsulate the InnerException, so the stack trace is preserved without reflecting on internals)

public abstract class RpcProvider
{
    public virtual object CallMethod(string methodName, params object[] parameters)
    {
        MethodInfo mi = this.GetType().GetMethod(methodName);

        if (mi == null || mi.GetCustomAttributes(typeof(RpcCallAttribute), true).Length == 0)
        {
            throw new NotImplementedException("This method is not provided by this RPC provider.");
        }
        else
        {
            try
            {
                return mi.Invoke(this, parameters);
            }
            catch (TargetInvocationException ex)
            {
                throw new RpcException("There was an error in the RPC call. See the InnerException for details.", ex.InnerException);
            }
        }
    }
}

The stacktrace below seems intact and fine (well, it’s sans the internals of how reflection invokes the method), so is there an issue with this at all? For the stacktrace below to make sense, my inheritance hierachy is:

 -Oxide.Net.Rpc.RpcProvider
 |-Oxide.Net.Rpc.XmlRpc
  |-StartMenuSorter.DesktopMasters

(sanitised to protect the innocent, ie. me)

at Oxide.Net.Rpc.XmlRpc.DoRequest(Uri rpcConnectionUri, IXPathNavigable request, String userAgent) in \Projects\OxideLib\Oxide.Net\Rpc\XmlRpc.cs:line 243
at StartMenuSorter.DesktopMasters.GetIconInformation(IEnumerable`1 icons) in \Projects\StartMenuSorter\StartMenuSorter\DesktopMasters.cs:line 17
at Oxide.Net.Rpc.RpcProvider.CallMethod(String methodName, Object[] parameters) in \Projects\OxideLib\Oxide.Net\Rpc\RpcProvider.cs:line 52
at StartMenuSorter.Program.Main() in \Projects\StartMenuSorter\StartMenuSorter\Program.cs:line 36
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
  • 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-12T05:03:29+00:00Added an answer on May 12, 2026 at 5:03 am

    Looks completely reasonable: the stacktrace includes details of where the RpcProvider is calling the method, and hides gory and unnecessary reflection gubbins, so you’re fine.

    As with all error handling code, the ultimate consumer will be other developers, so it would be good to ask “do I have enough detail to debug this myself if something goes wrong?”

    As there’s not so much noise in the way as if the outer exception were thrown the technique does its job well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a similar question on SO but i reckon my problem lies elsewhere
SHORT VERSION OF QUESTION: So basically my question is: How can I set the
This is basically a rails 3 version of this question . Short of parsing
That's basically the question, is there a right way to implement operator<< ? Reading
Well the subject is the question basically. Are there any version control systems out
Short Question: Basically I am trying to add a scalar property to my entity
I've got a short question that I've been wondering about for a while. There
Hi there I have a short question about database design. I also tried the
Basically the question is how to get from this: foo_id foo_name 1 A 1
Basically my question is the exact same one as this: Simple client/server, TCP/IP encrypting

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.