Code Monkey home page Code Monkey logo

Comments (7)

fremag avatar fremag commented on June 9, 2024

Hi,

I'm sorry you have this bug but unfortunately, without the dump file, I can't reproduce it.
I've loaded some of my dump files and had no issue.
I understand why you can't send yours.

Do you run Memoscope with the compiled binaries or with the source code/Visual Studio ?
If you can run it in debug mode, could you put a conditional breakpoint here:
image

then send me the value of "Type" variable ?
I'd like to see why this type is seen as an array type in the 'Lone target' analysis but has no component type.

from memoscope.net.

FroggieFrog avatar FroggieFrog commented on June 9, 2024

Originally I started it via binaries.
Now I started it via Visual Studio and used QuickWatch for "Type" and "Type.GetType()" (see attached files).
Also later there is a follow up NullRef:

Exception thrown: 'System.NullReferenceException' in MemoScope.exe
loneTargetInformations was null.

Type.txt
GetType.txt
2018_01_22_09_06_54_memoscope net_debugging_microsoft_visual_studio

from memoscope.net.

fremag avatar fremag commented on June 9, 2024

Thanks for the feedback and details.
It's really weird because it looks like the delegate's invocation list (_invocationList field) is a simple System.Object instead of the expected array System.Object[].
So of course the ComponentType is null and then you get a NullRef exception.
Well, I'm debugging and I see that it happens only when the _invocationCount is 0 so the program doesn't loop on the expected array's items.
When _invocationCount == 1, there is no _invocationList because the handler is in _target and there is no need for an array.

Could you debug and break like you did and give me details from the previous call in the stack ?
Something like this :
image

I'm sorry to bother you but it's not easy to debug when you can reproduce the issue on your computer...

from memoscope.net.

FroggieFrog avatar FroggieFrog commented on June 9, 2024

I noticed that there is a property "IsNull" which is "true".
2018_01_25_09_14_38_memoscope net_debugging_microsoft_visual_studio

from memoscope.net.

fremag avatar fremag commented on June 9, 2024

You're right.
The adress is 0 so the invocList is null and empty of course.
invocList can be null if you remove all handlers from a delegate but in this case invocCountValue == 0 .
I wonder why you have invocList == null and invocCountValue != 0...
Sometimes strange things happens if the dump is taken while GC is working, maybe it's the reason of this ?
Any way, I will add a check to avoid the exception and a warning too maybe.

                internal static IEnumerable<ClrObject> EnumerateHandlers(ClrObject clrObject)
		{
			ClrObject target = clrObject[TargetFieldName];
			ulong targetAddress = target.Address;

			if (targetAddress != clrObject.Address)
			{
				yield return clrObject;
			}
			else
			{

				var invocCount = clrObject[InvocationCountFieldName];
				var v = invocCount.SimpleValue;
				var invocCountValue = (long)v;
				var invocList = clrObject[InvocationListFieldName];
// Check invocList is not null
				if (! invocList.IsNull)
				{
					for (int i = 0; i < invocCountValue; i++)
					{
						var targetObject = invocList[i];
						yield return targetObject;
					}
				}
			}
		}

from memoscope.net.

FroggieFrog avatar FroggieFrog commented on June 9, 2024

I locally added your fix and it worked. I could analyze my dump file. Thank you.

from memoscope.net.

fremag avatar fremag commented on June 9, 2024

You're welcome.
Thank you for your time and help to improve Memoscope.

from memoscope.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.