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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:42:34+00:00 2026-05-21T11:42:34+00:00

I am using reflection to invoke a method in an external assembly. The external

  • 0

I am using reflection to invoke a method in an external assembly. The external class / method is in a WCF data service.

The WCF data service uses information loaded from a custom configuration section in the web.config,

 <configSections>
  <section name="myCustomSection" type="MyWcfService.MyCustomSection, MyWcfService" />
 </configSections>

Loading the configuration variables works fine in the wcf service but not when trying to invoke its methods through reflection via a seperate app. I tried putting the configuration information in the local app.config but I get the same error.

This is the code in the local application:

 Assembly assembly = Assembly.LoadFile
            ("C:\\MyProject\\MyWcfService.dll");

        Type[] t = assembly.GetTypes();

        foreach (var v in t)
        {
            if (v.Name == "MyType")
            {
                var instance = Activator.CreateInstance(v); 
                v.InvokeMember("MyMethod", BindingFlags.InvokeMethod, null, instance, null);
            }
        }  

And this is the code from the external assembly (wcf service) that is producing the error,

   MyCustomSection configSection = ConfigurationManager.GetSection("myCustomSection")
          as MyCustomSection ;

configSection is coming up null – ‘object reference not set to an instance of an object’.

If its looking in the local applications app.config rather than the web.config, adding the same config information locally should work, I would think.

Thanks.

  • 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-21T11:42:35+00:00Added an answer on May 21, 2026 at 11:42 am

    You may need to register with the AppDomain.CurrentDomain.TypeResolve event. This link has an example of how to use it.
    http://msdn.microsoft.com/en-us/library/system.appdomain.typeresolve.aspx

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

Sidebar

Related Questions

Is there a way to Invoke an overloaded method using reflection in .NET (2.0).
How can I invoke a method with parameters using reflection ? I want to
Using reflection on a method definition I would like to find out if the
Does creating an object using reflection rather than calling the class constructor result in
I am writing a Clone method using reflection. How do I detect that a
In C# is there a technique using reflection to determine if a method has
I try to run a jar using reflection with the the getMethod and invoke
I have situation where I have to call method of interface using reflection, like
How do I invoke a method (e.g. setter inside object class) on an already
How do I get a method using reflection based on a parameter value when

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.