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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:56:01+00:00 2026-05-30T21:56:01+00:00

I have a C# 2.0 class with the following code: public class MyClass :

  • 0

I have a C# 2.0 class with the following code:

public class MyClass : MarshalByRefObject, IDisposable 
    {
        private string _appName;
        private AppDomain _app;

        public MyClass(string appName)
        {
            _appName = appName;
            _app = AppDomain.CreateDomain("NewDomain" + _appName);
            _app.DoCallBack(new CrossAppDomainDelegate(CallBackMethod));
        }

        public void Dispose()
        {
            AppDomain.Unload(_app);
        }

        public static void CallBackMethod()
        {
            //some operations
        }
    }

This class is contained under a Class Library Project, then referenced from a Web Application Project.

So, in my web page I just instance the object, expecting that the constructor of the class would create that new AppDomain and perform the specified operations:

MyClass objMyClass = new MyClass("12022012213456");

But I keep getting this error:

Could not load file or assembly ‘MyNamespace.MyClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The system cannot find the file specified.

But the curious thing here is that this exception is happening at this line:

_app.DoCallBack(new CrossAppDomainDelegate(CallBackMethod));

And as you can see, it’s happening on MyClass, so I don’t understand how could it tell me that the assembly could not be found if the code is already being executed??? I just don’t get it.

BTW, I’m a newbie at the usage of AppDomain, maybe I’m confused with some concept.

  • 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-30T21:56:02+00:00Added an answer on May 30, 2026 at 9:56 pm

    It appears that the AppDomain you created (_app) is having problems locating your MyClass class in it’s assembly. Your CreateDomain has not provided any AppDomainSetup information so it has no context for the current app domains directories nor assemblies. You have two options, provide a propertly configured AppDomainSetup or call _app.Load(Assembly.GetExecutingAssembly.FullName) prior to your DoCallBack method.

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

Sidebar

Related Questions

I have the following code : public class MyClass { private readonly string name;
If I have the following code: public class MyClass { public string myName {
I have the following code: public class AppDomainArgs : MarshalByRefObject { public string myString;
I have the following code: [test.h] class MyClass { public: string Name; MyClass(); void
I have following code public class TEST { public static void main(String arg[]){ try
I have the following code: public partial class queryTerm : System.Web.UI.UserControl { private static
I have the following code: public class Test extends JFrame implements ActionListener{ private static
I have my code organized as following class MyClass { public: typedef void (MyClass::Ptr2func)();
Let's say I have the following class: class MyClass { private: int Data; public:
I have a question about the following code: class MyClass : private boost::noncopyable {

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.