This project has moved and is read-only. For the latest updates, please go here.

Exception with OID Variables comparation

Topics: bug report (break and fix)
Sep 15, 2008 at 9:40 PM
Hi all,

When I try to debug this code I obtain an "'System.StackOverflowException' occurred in SharpSnmpLib.dll":

            ObjectIdentifier OID_N_ALARMA = new ObjectIdentifier(new uint[] { 1, 3, 6, 1, 4, 1, 23632, 2, 2, 5, 3 });
            Integer32 numeroAlarma = null;
            if (e.InformRequest.Variables.Count == 4)
                foreach (Lextm.SharpSnmpLib.Variable n in e.InformRequest.Variables)
                    if (n.Id == OID_N_ALARMA)
                        numeroAlarma = (Integer32)n.Data;

I think is a bug in '==' method. I use the TwinTower 1.4.

Best regards

Sep 15, 2008 at 10:22 PM
I have test another codes and with this simple code also fails:

ObjectIdentifier id=null;

            if (id == null)
Sep 16, 2008 at 8:22 AM
Hi, thanks for the report. After changing a few types from value types to reference types, something like this is broken. I am going to fix them as soon as possible.

Sep 16, 2008 at 8:37 AM
All operator == implementations inside 1.4 RC1 have the same problem.

            if (left == null)
                return right == null;

should be changed to

            if ((object)left == null)
                return (object)right == null;

This fix is going to be checked in tonight when I get home.

Sep 16, 2008 at 12:36 PM
Thank you, quick response...
Sep 16, 2008 at 6:17 PM
Hi again,

We have tried to compile Source Code 15737 to check if the problem is solved but we found similar problem with OctetString class. We suppose that is same problem (I hope).

Sep 17, 2008 at 2:58 AM
Hi it seems that I did not correct all of them yesterday. I am going to fix them all tonight.

Thank you so much.

Marked as answer by lextm on 10/6/2013 at 9:30 PM