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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:59:21+00:00 2026-05-31T10:59:21+00:00

i really wonder why assemblyResolver not working? Also i can not use foreach (byte[]

  • 0

i really wonder why assemblyResolver not working? Also i can not use


foreach (byte[] binary in deCompressBinaries)
ApplicationHost.Load(binary);

how to fire AssemblyResolve? please look my reference question: http://stackoverflow.com/questions/9721686/how-to-use-appdomain-createdomain-with-assemblyresolve

    protected void LoadApplication()
    {

        AppDomainSetup domainSetup = new AppDomainSetup();
        domainSetup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
        domainSetup.DisallowBindingRedirects = false;
        domainSetup.DisallowCodeDownload = true;
        domainSetup.LoaderOptimization = LoaderOptimization.SingleDomain;
        //domainSetup.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
        ApplicationHost = AppDomain.CreateDomain("Test.Service", null, domainSetup);
        object obj = ApplicationHost.CreateInstanceAndUnwrap("Test.Process", "Test.ApplicationLoader");

        Assembly objExecutingAssemblies = Assembly.GetExecutingAssembly();
        AssemblyName[] arrReferencedAssmbNames = objExecutingAssemblies.GetReferencedAssemblies();

        foreach (AssemblyName assName in arrReferencedAssmbNames)
        {
            ApplicationHost.Load(assName);
        }


        ApplicationHost.AssemblyResolve += new ResolveEventHandler(OnAssemblyResolve);

        List<byte[]> deCompressBinaries = new List<byte[]>();
        foreach (var item in AppPackage.Item.AssemblyPackage)
            deCompressBinaries.Add(item.Buffer);
        var decompressvalues =  DeCompress(deCompressBinaries);
        deCompressBinaries.Clear();
        deCompressBinaries = decompressvalues.ToList();

        foreach (byte[] binary in deCompressBinaries)
            ApplicationHost.Load(binary);

        Assembly[] assAfter = AppDomain.CurrentDomain.GetAssemblies();
    }

    Assembly OnAssemblyResolve(object sender, ResolveEventArgs args)
    {
        return Assembly.Load(args.Name);
    }
  • 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-31T10:59:22+00:00Added an answer on May 31, 2026 at 10:59 am

    The AssemblyResolve will never fire, because you’re loading up all the assemblies in the LoadApplication method – AssemblyResolve will only be called if the required assembly reference fails to be resolved.

    I would suggest running fuslogvw.exe so that you can visualize what is going on.

    If you want to load the assemblies on an as-needed basis, the block of code:

    List<byte[]> deCompressBinaries = new List<byte[]>();
    foreach (var item in AppPackage.Item.AssemblyPackage)
    deCompressBinaries.Add(item.Buffer);
    var decompressvalues =  DeCompress(deCompressBinaries);
    deCompressBinaries.Clear();
    deCompressBinaries = decompressvalues.ToList();
    
    foreach (byte[] binary in deCompressBinaries)
        ApplicationHost.Load(binary);
    
    Assembly[] assAfter = AppDomain.CurrentDomain.GetAssemblies();
    

    will need to be worked into the AssemblyResolve. The block currently loads EVERYTHING into the AppDomain, so you’d have to rework that piece of logic.

    Of course, the other thing you might want do is not to re-invent the wheel, and use ILMerge.

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

Sidebar

Related Questions

I am really stuck on a rewrite rule and wonder if anyone can help.
I really wonder why facebook and google can change the url without reloading the
I'm not really familiar with Ant and i wonder how to print the name
I really wonder why this question hasn't popped up here so far. I have
Sometimes I really wonder if my code is lastable. I do everything to make
Really stupid question, sorry, but I can't find it on google (I'm sure it's
It may help if you are on a Mac and use TextMate, though not
I'm a really beginner so my question may be appear ridiculous.. But, i wonder
I wonder whether someone can help me please. I'm trying to implement the mysql_insert_id()
I'm new at Matlab. You may find this question silly but I really wonder

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.