Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by Gizmoi · Mar 15, 2013 at 11:02 AM · monodevelopenumdebuggingbreakpoint

The requested item has been unloaded

While broken into my code using MonoDevelop, if I attempt to inspect some - not all - variables, MonoDevelop says the value is "The requested item has been unloaded".

I have no idea what that means, or why MonoDevelop / Unity decided to 'unload' that particular value.

It is getting increasingly annoying as I have to resort to Debug.Log and then sifting through other people's Logs to find the ones I'm interested in.

I have tried Googling to no avail, please tell me someone else has had this problem?

I'm using Unity 4.0 Pro on Mac OS X 10.8.2.

Thanks in advance.

Edit: Example code:

 Damage = (int)(content.getNumber("damage"));
 Round = (int)(content.getNumber("seq"));
 
 OpponentMove = (Move)int.Parse(content.getString("moveId"));
 WinnerID = content.getString("winner");


Damage, Round and WinnerID may all be in scope, but OpponentMove will not.

Sometimes if I use the variable, for example, Debug.Log(OpponentMove), it will be available for inspection. But only sometimes.

Comment
Add comment · Show 8
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image John108 · Apr 23, 2013 at 04:43 PM 0
Share

I have this problem on my machine at work that's running Unity 4.1. Don't get it on my home machine that's running a version pre 4.0 (can't remember off the top of my head). The main thing I've noticed it on is enums, don't think I've ever been able to inspect one. If you find a solution I'd really appreciate it if you could let me know.

avatar image Gizmoi · May 02, 2013 at 10:26 AM 0
Share

I have noticed that it happens on enums, I'm not 100% sure if it's exclusively enums but I'm fairly sure it's not with every enum. But as you probably noticed, Opponent$$anonymous$$ove is an enum.

avatar image Andy-Block · May 29, 2013 at 09:35 AM 0
Share

Also seeing this here - don't suppose you found a solution or workaround?

avatar image Gizmoi · Jun 01, 2013 at 07:09 PM 0
Share

Nope, I've resorted to using Debug.Log to exa$$anonymous$$e any enums I find. Although at the moment Unity locks up upon attempting to break into a function that contains any enums.

avatar image graslany · Nov 27, 2013 at 10:02 AM 0
Share

That new monodevelop is all shiny and full of new stuff, but it's also loaded with a LOT of annoying bugs ! Why has it been included in the Unity bundle while it's clearly in a beta state at best ?

$$anonymous$$ine also triggers the infamous "item has been unloaded" exception when I disable a breakpoint, start the program with the debugger attached, and re-enables the breakpoint (an error popup is then displayed and my breakpoint no longer works). This is not however an exotic use case !

Show more comments

9 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by Artless · Apr 12, 2015 at 01:47 PM

You can patch Unity Monodevelop source to fix this bug and rebuild some dlls. I did that and uploaded dlls, you can just download and replace: There are Dlls for Monodevelop version 2.8.2 and 4.0.1 https://www.dropbox.com/s/p5gnzv8y8pcbdor/MonoDevelop_Patches.zip?dl=0 These dlls work for me, if you get problems, you can download Unity Monodevelop source and build them manually (I will point what needs to be added below).

In this dlls there are two fixes: First for not showing enum, and second for not showing generic collections saying "unknown type 'System.Collections.Generic.CollectionDebuggerView'1 mscorlib". Fix for inspecting collections is just ignoring custom Debugger Proxy class and using plain inspector, so you will see all inner members of List and Dictionary.

Fix for Enum: in SoftDebuggerAdaptor.cs TryCast function you can "eat" AppDomainUnloadedException and continue

            if (valueType is TypeMirror) {
                 fromType = (TypeMirror) valueType;
     
                 try {
                     if (toType != null && toType.IsAssignableFrom (fromType))
                     return obj;
                 }
                 catch (AppDomainUnloadedException excep) {
                 }                
                 
                 // Try casting the primitive type of the enum
                 EnumMirror em = obj as EnumMirror;

Fix for generic collections: In ObjectValueAdaptor.cs GetProxyObject function instead of throwing if Proxy Object could not be loaded, return plain object it ignores proxy attribute for List, Dictionary, etc:

             try
             {
                 if (ttype == null)
                     return                obj;
                                 
                 object val = CreateValue (ctx, ttype, obj);
                 return val ?? obj;
             } catch (Exception ex) {
                 ctx.WriteDebuggerError (ex);
                 return obj;
             }

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TimK_personal · Jun 23, 2015 at 03:37 PM 0
Share

You are my new hero!

avatar image Zennichimaro · Jul 31, 2015 at 07:45 AM 0
Share

fyi: copy to /Applications/Unity/$$anonymous$$onoDevelop.app/Contents/$$anonymous$$acOS/lib

avatar image
4

Answer by ICEYHOTSTUNTA · Sep 13, 2013 at 11:34 PM

Such an annoying problem... Re-attaching the debugger while the game is running seems to fix the issue for me, it's still lame I have to do all that clicking to see an enum... Hopefully this helps someone else out!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
2

Answer by baddie · Sep 06, 2013 at 07:36 PM

This is a bug in MonoDevelop, been there for ages, probably won't be fixed for the next few years.

I've found the following work around. For every enum in your code, you can add:

public int debugView_enumName {get {return (int) enumName; }}

This will let you then view the enum casted to an int in the watch window. Certainly a dirty solution, but we have to do what we can in these dark times.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image NaxiaLascif · Nov 19, 2013 at 10:48 PM 0
Share

Can you clarify what you are doing with that function and where you are putting it?

avatar image baddie · Nov 19, 2013 at 10:56 PM 0
Share

The function just casts the enum that you want to view to an int, you put it alongside the member enum you want to view. Its just a way to make the debugger display the value (whereas usually it refuses to show the value of an enum).

avatar image
2

Answer by bcooley · May 29, 2014 at 09:29 PM

This is not a MonoDevelop problem, it's actually a Unity problem - but there is a workaround (see below).

The issue is that Unity constantly re-creates the .csproj files for MonoDevelop, which is not the standard way that MonoDevelop (or any IDE for that matter) actually works. This causes MonoDevelop's caching system (which is based on some sort of hash of the project file) for it's completion data to become invalid, causing lots of issues related to code completion and debugging (not just enums). The completion data for the project is actually pointing to a previous completion cache file and will not pick up any new definitions of enums, which causes the debugger to throw an exception when trying to show the enum value.

The solution is this: every now and then clear the caches. These are located on Mac in /Users/yourusername/Library/Caches/MonoDevelop-Unity-4.0/DerivedData (there is a corresponding folder on Windows but I don' t know where it is exactly). Deleting all of the files in this folder will clear the completion data cache, and force MonoDevelop to re-create the caches. This of course will only work once as Unity will then blow away your project files the next time you run Unity - so you'll have to do it every now and then to have the IDE re-sync it's caches.

The ultimate solution is for Unity to stop trashing project files they way they are doing it and allow MonoDevelop to work the way it supposed to work. If they need to update the project files, they need to do so in such a way that MD can correctly associate the new project file with the cached completion data in its completion cache.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bcooley · May 29, 2014 at 09:35 PM 0
Share

This also seems to fix a lot of other annoying issues in Unity-$$anonymous$$onoDevelop that seem to be related to stale/invalid completion data.

avatar image graslany · Jun 07, 2014 at 06:23 AM 0
Share

I tried this on windows (the relevant folder is C:\\Users\\yourlogin\\AppData\\Local\\$$anonymous$$onoDevelop-Unity-4.0\\Cache\\DerivedData), but in my case the requested items were more unloaded than ever.

avatar image
0

Answer by ShawnFeatherly · Dec 06, 2013 at 08:31 PM

I've been having the same problem. I've been using this method to spam Debug.Log:

 private string PropertyDump(object variable)
 {
     var stringPropertyNamesAndValues = variable.GetType().GetProperties()
         .Where(pi => pi.PropertyType == typeof(string) && pi.GetGetMethod() != null)
         .Select(pi => new 
         {
             Name = pi.Name,
             Value = pi.GetGetMethod().Invoke(variable, null)
         });

     System.Text.StringBuilder dump = new System.Text.StringBuilder();
     foreach (var pair in stringPropertyNamesAndValues)
     {
         string pairAsString = string.Format("Name: {0} Value: {1}{2}", pair.Name, pair.Value, System.Environment.NewLine);
         dump.Append(pairAsString);
     }
     return dump.ToString();
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

28 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Breakpoints stopped triggering in MonoDevelop 4.0.1 4 Answers

Why does monodevelop sets "pink", nonfunctioning breakpoints ? 1 Answer

mono develop debugging stops on lines without breakpoints 2 Answers

Unity 4.3.1 - debugger won't break at breakpoints 0 Answers

How to access static members in the watch/immediate window when debugging with MonoDevelop 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges