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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:46:55+00:00 2026-05-14T05:46:55+00:00

I have a rather large and complex game in C#, and in it are

  • 0

I have a rather large and complex game in C#, and in it are various monsters. The monsters are created in the game by a MonsterCreator, and each monster has various plugins that are loaded from external DLLs.

When my monsters die, they call a method in the MonsterCreator, and the MonsterCreator removes them from the game map, removes them from its own internal list of monsters, and then finally calls the Dispose() method on the monster itself.

The dispose method calls the dispose method of each plugin, then clears up any of its own code.

This seems to work fine, with lots of monsters, but somewhere there is a bug that crops up after a while, where a monster dies, but it has already been removed – it seems the callback telling the MonsterCreator is being called over and over, when the monster should have been removed on the first call.

The likely candidate is that some of the plugins for the monster register themselves with an Event that pulses them every X number of seconds so they can perform logic. Stepping through I can see that they are unregistering with the Event when they die, but something is getting through still and I don’t know what it is.

Do you have any advice for debugging the problem? I can’t post code really because it’s split across a ton of libraries and plugin dlls, so it’s more a case of figuring out the best way to debug it.

I threw an exception in code when the monster died callback method is thrown and the monster cannot be found on the map to be removed, so I have the misbehaviing Monster, is there a way I can see what is still linked to it?

  • 1 1 Answer
  • 3 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-14T05:46:55+00:00Added an answer on May 14, 2026 at 5:46 am

    Beware that Dispose doesn’t remove the references that the other objects might have to your Monster object! So the other objects referencing your Monster can report that the Moster dies after it had actually died.

    Another popular source of mistakes is not unsubscribing from events: each subscribing to Monster‘s events makes (implicitly) a reference to the Monster instance.

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

Sidebar

Related Questions

I have a number rather large, complex xml documents that I need to loop
I have a rather large database that has alot of decimal columns in alot
I have a rather large application that has literally a hundred DDLs with Yes
I have a large old program which has some rather complex graphical displays (all
We have a rather large and complex application written in Java which is running
I have rather large project that uses ICU regex classes. Basically it might run
I have a rather large amount of data (100 MB or so), that I
I have a rather large table with 150,000 + records. It has a lot
I have a rather complex legacy ASP.Net application that is under continuous development, and
We have a rather large library that we need to periodically import (and then

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.