[gme-users] GME BON2 Add-on throws an exception everytime thatcan't becaught!!!!!

James Hill hillj at isis.vanderbilt.edu
Thu Jan 12 12:18:07 CST 2006


Hey Zoli, 

> 
> What code do you have in globalEventPerformed() ?

I don't have any code in this method. I only have code in
objectEventPerformed ().

> Do you experience that exception upon import, if you comment 
> out objectEventPerformed()'s contents?
> 

I commented out all the contents and the same exception is occuring.
Something outside the scope of objectEventPerformed is throwing the
***Unhandled and unknown exception was thrown in BON2Component
ObjectEvent*** exception. I have also experienced the same problem when
trying to handle the OET_RegistryChanged event when OET_ObjectCreated is
sent as well.

> A Note: Import/Open/Close use-case is special for the 
> following reason:
> the GUI (GME.Application COM object) is being 
> registered/deregistered as a client of the Mga.Project COM 
> object, just to-be-created.
> Thus, if you just write into globalEventPerformed the 
> following command:
> 
> 	m_project->consoleMsg( "Global Event happened: Import 
> XML", MSG_INFO);
> 

I don't understand what using the consoleMsg has to do w/ what I'm doing
since I'm not trying to write to the console?!?!?! I just want to import
an existing model.

Thanks,

James

> It will cause exactly the same uncatchable exception [which 
> you are facing now], becaue the consoleMsg method tries to 
> get from the MgaProject its client called: GME.Application, 
> which is not yet registered, because the process of opening 
> is under way.
> For this reason I have introduced into Bon2 the Bool 
> isGmeAvailable() const method.
> The correct form then:
> 	if( m_project->isGmeAvailable())
> 		m_project->consoleMsg( "....", ...);
> 
> This BON2 update will come in the next release.
> 
> Zoli
> 
> > -----Original Message-----
> > From: gme-users-bounces at list.isis.vanderbilt.edu
> > [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On 
> Behalf Of James 
> > Hill
> > Sent: Wednesday, January 11, 2006 7:17 PM
> > To: gme-users
> > Subject: [gme-users] GME BON2 Add-on throws an exception everytime 
> > that can't becaught!!!!!
> > 
> > 
> > Hello all,
> > 
> > I am creating an add-on and its throwing an exception that I can't 
> > catch. I have tried adding a try...catch block around my 
> code and it's 
> > still failing. The exception is apparently being thrown 
> deep inside of 
> > BON and within the scope of the method that calls 
> > Component::objectEventPerformed (). The exception that is 
> occuring is 
> > **Unhandled and unknown exception was thrown in BON2Component
> > ObjectEvent!** This exception is thrown everytime I try to 
> import an 
> > XME file. The add-on works fine while the project is open and being 
> > used. I have enclosed the source code since it's small. Any 
> assistance 
> > as to what I am doing wrong is greatly appreciated.
> > 
> > void Component::objectEventPerformed( Object& object, unsigned long 
> > event, VARIANT v ) {
> >   try
> >   {
> >     // Get the name of the object type. Only monitor <Component> 
> >     // and <ComponentAssembly> objects.
> >     std::string name = object->getObjectMeta ().name ();
> > 
> >     if (name == "Component" || name == "ComponentAssembly")
> >     {
> >       BON::FCO fco = object;
> >       BON::Attribute uuid = fco->getAttribute ("UUID");
> > 
> >       if (uuid)
> >       {
> >         // We only handle the creation events at this stage.
> >         if (event == MON::OET_ObjectCreated)
> >         {
> >           // Create an UUID and add the <uuid_manager_> event
> >           // listener to the object.
> >           uuid->setStringValue (PICML::CreateUuid ());     
> >         }
> >         else if (event == MON::OET_AttributeChanged)
> >         {
> >           // Validate the UUID of the object.
> >           if (!PICML::ValidUuid (uuid->getStringValue ()))
> >           {
> >             uuid->setStringValue (PICML::CreateUuid ());
> >           }
> >         }
> >       }
> >     }
> >   }
> >   catch (...)
> >   {
> >     // This does not catch the exception!!! It's being caught in 
> > ComponentObj.
> >     // Some local variable defined before invoking this 
> method throws 
> > an exception
> >     // whenever it is destroyed. I have no idea why?!?!?!
> >     AfxMessageBox ("Gotcha");
> >   }
> > 
> > Thanks,
> > 
> > James
> > 
> > --------------------------------------------
> > 
> > James H. Hill - Ph.D. Student
> > Research Assistant - ISIS / DOC Group
> > 
> > Microsoft Student Ambassador
> > Department of EECS / Computer Science Program Vanderbilt 
> University, 
> > Nashville, TN
> > 
> > Email: j.hill at vanderbilt.edu
> > 
> > _______________________________________________
> > gme-users mailing list
> > gme-users at list.isis.vanderbilt.edu
> > http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
> > 
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
> 


More information about the gme-users mailing list