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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:41:24+00:00 2026-06-11T21:41:24+00:00

I am working on some software that supports the use of Reporting modules. Basically

  • 0

I am working on some software that supports the use of Reporting modules. Basically we don’t want to ship ALL reports by default as it just creates unnecessary bloat so I am looking for an efficient way to check the present exe and dll for valid modules that can by dynamically added at runtime. So far I’ve experimented with setting a custom Attribute in AssemblyInfo and used at as a flag like so:

private void GetReportModules() { 
        try {
            var dlls = Directory.GetFiles(Directory.GetCurrentDirectory()).Where(x => Path.GetExtension(x) == ".dll" || Path.GetExtension(x) == ".exe");
            dlls = dlls.OrderBy(x => Path.GetFullPath(x)).Where(x => {
                try {
                    return null != System.Reflection.Assembly.LoadFrom(x);
                } catch (Exception) {
                    Console.WriteLine("Skipping {0} - does not load using reflection.", Path.GetFileName(x));
                    return false;
                }
            });

            foreach (var dll in dlls) {
                System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom(dll);
                object[] attributes = assembly.GetCustomAttributes(typeof(ReportNameAttribute), false);
                if (attributes.Count() > 0) {
                    // dynamically include the assembly as a menu item
                }
            }

        } catch (Exception ex) { throw new GenericException(ex); }
    }

The problem being that I literally have to load every dll and exe twice which doesn’t seem very efficient. Can anyone suggest a way that they’ve accomplished something similar to this before or a way to improve what I’m doing?

It would be seriously awesome if I could check the Attributes without needing to first load the Assembly.

  • 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-11T21:41:25+00:00Added an answer on June 11, 2026 at 9:41 pm

    Reflection has it’s cost. usually, it’s not too expensive if you do it once (remember to cache the results. if they’re need to be refreshed every now and then, you can use timer for this).

    If you don’t want to load all the assemblies and check, you can use configuration file where user must explicitly define what should be loaded.

    You can also set a special folder that should include only dll’s that are relevant for this thing, by definition – anything in this folder would be something you’d like to load.

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

Sidebar

Related Questions

I'm working with some very old, monolithic software that is basically a heavily customized
I'm working on some software to manage a device that communicates with a remote
I'm working on a Qt based software that involves some cryptography. The only three
I'm working on a script that is supposed to install some software from a
I'm working on a plugin for Avogadro (chemistry software) that uses pyqt. I've some
I am working on some software that does a sparse matrix-vector multiply. The matrix
I'm working on a plugin for some software that I'm planning on selling someday.
I'm working on some old(ish) software in PHP that maintains a $cache array to
I am working on some software that should be used for a special type
I have some trial software that I wish to distribute to clients. I want

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.