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 7823979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:26:20+00:00 2026-06-02T08:26:20+00:00

Project I’ve developed a remoting class which is used to replace a subset of

  • 0

Project

I’ve developed a remoting class which is used to replace a subset of WCF. This has been done because we are targeting a mobile Plattform with Unity3D and need to keep the Memory consumption as small as possible. ( So we don’t need to include System.ServiceModel which actually has a size of 2.7MB which is a lot for a small mobile RAM )

It’s working fine right now for all types ( including complex types which will be serialized using my own serializer written years ago ) and it’s also capable to handle complex situations ( A calls B, B calls A, A returns something, B returns something ).

Method invokation

For invoking methods on the target site i’m using Type.InvokeMember which actually works for the most cases except for nullable-types. And this is the problem i’ve faced. In my interface definition the method looks like this:

public interface IServerContract 
{
    void SetUsageID(Int32? id);
}

The ServerProxy ( A object which handles the call to the remote method ) i’m doing the following:

public class ServerProxy : ProxyBase
{
    public void SetUsageID(Int32? id)
    {
         RemoteCall("SetUsageID", id);
    }
}

As usual the parameter id is boxed because the definition of RemoteCall looks like this:

public void RemoteCall(String methodName, params Object[] arguments) { ... }

At this point i got only a System.Int32 and not a nullable anymore. I’m serializing the arguments and deserializing them on the target machine. At this point i’m calling Type.InvokeMethod which causes a exception because he can’t find a method which takes a Int32 as first parameter ( second when not ignoring this ).

What is the best solution for this issue? There are serval ways but all would cause a performance impact.

  • 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-06-02T08:26:22+00:00Added an answer on June 2, 2026 at 8:26 am

    The boxing rules for int? indeed mean that once you have it as an object you see:

    • empty values are null, and nothing more can be discerned
    • non-empty values are known only as the non-nullable type
      • so specifically, passing (int)5 and (int?)5 have exactly the same appearance within object

    As such, the options available:

    • ensure method names are unique, so you can uniquely resolve by name to a MethodInfo, then use MethodInfo.Invoke (this ensures no ambiguity in the parameters)
    • try to resolve a method accepting the non-nullable type(s), then look for nullable type(s) instead (gets complex for multi-parameter methods)
    • pass more metadata about what method you are calling (increases size)

    Personally, though, I have a very simplistic view on such things… rather than trying to encode a vague multi-parameter method, another option is to simplify to always passing a single, DTO-based, parameter – i.e. instead of SetUsageID(int?) you could have SetUsage(SetUsageArgs) (or something similar), where SetUsageArgs happens to have a single property. The point being: you’re now just encoding a single DTO, and once you have deserialized that DTO there is no ambiguity.

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

Sidebar

Related Questions

Project: ASP.NET 3.5 with C# I have this much :- A table which used
A project I was working on has finished, so I've been moved on to
Requirements Project should contain 1 main application and some secondary sub applications (which uses
The project, I work on, consists of several executables which run in background and
Project CompetitionServer.exe raised exception class ESQLiteException with message 'Error executing SQL. Error [1]: SQL
Project Euler has a paging file problem (though it's disguised in other words). I
Project Euler 126 says: If we then add a second layer to this solid
Project Structure I have a silverlight project SLProj, that references a silverlight class library
Project : Game in Flex builder 4 (Actionscript Project) Language : Actionscript 3 This
Project Description: I have to make an application in android which gets the Latitude

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.