This project has moved. For the latest updates, please go here.

Exception with OID Variables comparation

Topics: bug report (break and fix)
Sep 15, 2008 at 8: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 9:22 PM
I have test another codes and with this simple code also fails:

ObjectIdentifier id=null;

            if (id == null)
            {
                 ......
Coordinator
Sep 16, 2008 at 7: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.

-Lex
Coordinator
Sep 16, 2008 at 7: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.

-Lex
Sep 16, 2008 at 11:36 AM
Thank you, quick response...
Sep 16, 2008 at 5: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).

Regards.
Coordinator
Sep 17, 2008 at 1: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.

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