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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:39:18+00:00 2026-05-24T05:39:18+00:00

I have a serious problem with my Unity and bootloader. It’s a circular reference.

  • 0

I have a serious problem with my Unity and bootloader. It’s a circular reference.

Let me explain what I have currently:

MainApp (winforms)

ServiceLayer – C# project

DependencyInjection – C# Project for the Container

Bootloader – C# project for the bootloader to do mappings for automapper and Unity.

Now the the bookloader has references to everything i.e. The service, the container etc the mainApp (winforms) and it does its job just great.

The problem is that I am starting the bootloader from my MainApp (winforms) like so

 DI.Container.RegisterType<IBootstrapper, Bootstrapper>(
    new InjectionConstructor(DI.Container));

            var bootstrapper = DI.Container.Resolve<IBootstrapper>();

            bootstrapper.StartUp();

Now the problem here is the following, MainApp needs a reference to Bootloader because that’s where the class and interface is – but I can’t because Bootloader has a reference to the MainApp as the bootloader registers some stuff that is in the mainapp.

I think I am getting confused somewhere, the main idea was to move the bootstrapper out of the mainapp into its own assembly and the Container has its own assembly too; the bootstrapper needs all its references including to MainApp but of course Mainapp needs a reference to bootstrapper to create it and start it up.

Edit

I could of course register the types from the mainapp by accessing the container directly but doesn’t this defeat the object of having my bootloader, which takes care of everything?

  • 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-24T05:39:19+00:00Added an answer on May 24, 2026 at 5:39 am

    I’m not an expert on this topic, the reason I found your post was because I was looking for help with a similar issue, but I think maybe there is some overlap between our problems, and maybe the stuff I’ve tried so far might be able to help you, or point you in a direction that can get you some progress.

    If you want to see all the stuff I wrote, including some diagrams, you can find it here:
    Using StructureMap, is one of these project organizations better than another?

    If there is a better answer, hopefully someone will point it out and I’ll learn from this as well.

    Basically, I think you have a couple options.

    You can merge your bootloader and MainApp into the same project. (as you said, that seems “wrong”)

    You can move the code from MainApp that is needed by BootLoader into another assembly, and then reference it from both BootLoader and MainApp.

    You can remove your reference from MainApp to BootLoader, and then use see if there are other ways to automatically get a reference to BootLoader at runtime using Unity. I’m using StructureMap, which has a feature where you tell it to scan some assemblies (at app startup), and then you can tell it to apply “default conventions”, which means if there is an interface called IWhatever, and a class Whatever:IWhatever, then it will automatically set it up so asking for an instance of IWhatever will give you a concrete instance of Whatever.

    So this way, you can have BootLoader reference MainApp at compile time, but still have code in MainApp that can access stuff in BootLoader at runtime (by using IOC and going through an interface).

    I hope this helps.

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

Sidebar

Related Questions

I have serious problem, I have deleted Java project from Eclipse and I don't
I have a serious problem. One of our servers crashed. Now I reinstalled the
Ok guys, I have a serious problem with this. I have a static class
I have a serious performance problem. I have a database with (related to this
I have a very serious problem with Visual Studio 2008. Occasionally when I right-click
I have this serious problem. I have an enumeration within 2 namespaces like this:
I have a serious problem with calculating Standard Deviation within subgroup in SSRS/SQl (whichever
i have a serious problem here. i'm trying to use a modal window in
I have a real serious problem with maple, I can't get it to display
I am a beginner in Android platform and i have encountering a serious problem.

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.