Creating object stops execution of entire function
-
MyObject is a public class from an external class library, I am setting both vars and adding event delegates in the Init() function. I am executing it as you describe above but it will only step in if the 'new MyObject()' line is not there. With the line 'MyObject obj = new MyObject()' in the code when I step into that function all debug buttons are greyed out apart from stop, pause and restart and it does not step into the function, however if I comment out the ' = new MyObject()' it does step into the function and executes the DoSomething() and DoSomethingElse(). I do not change anything other than commenting out the ' = new MyObject()' to make it step into the code.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
Hi, who is calling Init ? some constructor ? is it a first time call ? has MyObject class already been called (hence compiled by JIT) ? Any chance MyObject can not be found at run-time (separate DLL maybe ?). Please show code for MyObject (at least: members and constructor). :)
Luc Pattyn [My Articles] [Forum Guidelines]
-
Hi, who is calling Init ? some constructor ? is it a first time call ? has MyObject class already been called (hence compiled by JIT) ? Any chance MyObject can not be found at run-time (separate DLL maybe ?). Please show code for MyObject (at least: members and constructor). :)
Luc Pattyn [My Articles] [Forum Guidelines]
Init is being called by the Start event of the main class for the app. It is a first time call. MyObject has not been called before but I have left the app for 10 mins and it is still hung so I would think it unlikely it was the JIT compiler. I would expect to see an exception if the class could not be found rather than the app hanging but the class is in a referenced DLL next to the app. I cannot show the code for MyObject as it is a third-party .NET assembly.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
-
Init is being called by the Start event of the main class for the app. It is a first time call. MyObject has not been called before but I have left the app for 10 mins and it is still hung so I would think it unlikely it was the JIT compiler. I would expect to see an exception if the class could not be found rather than the app hanging but the class is in a referenced DLL next to the app. I cannot show the code for MyObject as it is a third-party .NET assembly.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
Hi did you try using a try / catch block in order to catch exception ???
-
Hi did you try using a try / catch block in order to catch exception ???
I have a try...catch block inside the Init() function to catch the exception but the problem is that the execution does not enter the Init() functio if that line exists so therefore no exception is thrown.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
-
I have a try...catch block inside the Init() function to catch the exception but the problem is that the execution does not enter the Init() functio if that line exists so therefore no exception is thrown.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
use the try catch before the call to the init function
-
use the try catch before the call to the init function
I should have mentioned, I have also wrapped the Init() in a try...catch but again, nothing, no exception, nothing, just a hung application.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
-
I should have mentioned, I have also wrapped the Init() in a try...catch but again, nothing, no exception, nothing, just a hung application.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
OK sorry Can you give more details about the MyObject class ???? and the environment that your application running ??? thanks
-
OK sorry Can you give more details about the MyObject class ???? and the environment that your application running ??? thanks
The environment is Visual Studio 2003, .NET 1.1, Windows XP. The MyObject class is a third-party assembly containing lots of system calls, I understand that the problem could well be within the assembly and not my code and therefore out of my reach to fix but I would like to understand how a problem in a DLL assembly could stop the debugger entering the calling function, I could understand if it hung on the constructor of the MyObject class but I cannot see how it could hang on the calling function.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
-
I should have mentioned, I have also wrapped the Init() in a try...catch but again, nothing, no exception, nothing, just a hung application.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
OK, now what is MyObject class supposed to do ? any idea what would be inside its constructor ? have you other apps that use MyObject successfully ? :)
Luc Pattyn [My Articles] [Forum Guidelines]
-
OK, now what is MyObject class supposed to do ? any idea what would be inside its constructor ? have you other apps that use MyObject successfully ? :)
Luc Pattyn [My Articles] [Forum Guidelines]
The MyObject implements a set of delegates which attach to system events allowing them to be handled by a .NET 1.1 application which they would otherwise not be able to do. I have no idea what would be in the constructor unfortunately but on further testing I have found that a call to a static function within the class prodcues the same result so I am confident it is an issue with the assembly but that still doesn't get me any closer to why the entire function does not execute.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
-
The environment is Visual Studio 2003, .NET 1.1, Windows XP. The MyObject class is a third-party assembly containing lots of system calls, I understand that the problem could well be within the assembly and not my code and therefore out of my reach to fix but I would like to understand how a problem in a DLL assembly could stop the debugger entering the calling function, I could understand if it hung on the constructor of the MyObject class but I cannot see how it could hang on the calling function.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
I run into some problems with the debugger (crushes,hangs and so on) usually while doing some system programming, the solution to that in most cases was just restart. you can try one of the following: 1.try to debug on another machine (check that you don't have problem in your environment) 2.use the System.Diagnostics.Debugger.Break(); command in order to force break. 3 use the sos debug extension in order to examine the runtime steps at execution 4 restart your computer and try again
-
The MyObject implements a set of delegates which attach to system events allowing them to be handled by a .NET 1.1 application which they would otherwise not be able to do. I have no idea what would be in the constructor unfortunately but on further testing I have found that a call to a static function within the class prodcues the same result so I am confident it is an issue with the assembly but that still doesn't get me any closer to why the entire function does not execute.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
OK, sounds like there is a problem with a static initializer in MyObject. I can see two ways forward now: - contact the author - try figuring out what is in the initializer using Reflector. I assume you are on .NET 2.0 or 3.x; you might want to try MyObject inside a .NET 1.1 project, just to see if it works for you; the simplest invocation of MyObject should be sufficient. BTW I am not impressed by a "third party" that calls its stuff "MyObject". Good luck !
Luc Pattyn [My Articles] [Forum Guidelines]
-
OK, sounds like there is a problem with a static initializer in MyObject. I can see two ways forward now: - contact the author - try figuring out what is in the initializer using Reflector. I assume you are on .NET 2.0 or 3.x; you might want to try MyObject inside a .NET 1.1 project, just to see if it works for you; the simplest invocation of MyObject should be sufficient. BTW I am not impressed by a "third party" that calls its stuff "MyObject". Good luck !
Luc Pattyn [My Articles] [Forum Guidelines]
It's not called MyObject, I just used that to demonstrate the problem ;) I would be equally unimpressed if it were :-D It is currently in .NET 1.1, the assembly and my project are both 1.1. I've contacted the author and waiting on a reply. The question I was asking more than what could be wrong with the assembly as I realise it is the assembly causing the problem is how that problem could cause my function not to be executed even before any calls are made to the assembly, I would expect it to fail at the point of referencing the assembly but at least execute the function calls above it.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
-
It's not called MyObject, I just used that to demonstrate the problem ;) I would be equally unimpressed if it were :-D It is currently in .NET 1.1, the assembly and my project are both 1.1. I've contacted the author and waiting on a reply. The question I was asking more than what could be wrong with the assembly as I realise it is the assembly causing the problem is how that problem could cause my function not to be executed even before any calls are made to the assembly, I would expect it to fail at the point of referencing the assembly but at least execute the function calls above it.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
__DanC__ wrote:
I would expect it to fail at the point of referencing the assembly but at least execute the function calls above it.
I understand that is what would be expected, but when you reach the Init() method, the first thing that happens is the JIT compiles it; so it wonders about the MyObject class, it must locate it, and at some point in time, also statically initialize it. I am not sure exactly when that is supposed to happen; it must be deterministic of course, and I know the exact order is surprisingly complex; long time ago I suffered from a bug in that area, dont recall whether it was in 1.0 or 1.1 tho. I think it is safe to assume static constructors get executed at the start of the calling method (your Init), since the JIT in general must cope with a complex flow graph and multiple references to the class, so it cannot always (and hence does not even try to) predict which one will occur first, hence it will go for early initialization. You could proof this true or false by pushing the MyObject stuff and following code inside Init() one level deeper... :)
Luc Pattyn [My Articles] [Forum Guidelines]
-
The environment is Visual Studio 2003, .NET 1.1, Windows XP. The MyObject class is a third-party assembly containing lots of system calls, I understand that the problem could well be within the assembly and not my code and therefore out of my reach to fix but I would like to understand how a problem in a DLL assembly could stop the debugger entering the calling function, I could understand if it hung on the constructor of the MyObject class but I cannot see how it could hang on the calling function.
Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!
turn MyObject class to a static one, if you cannot, i think i had the same problem with DirectX, where i tried to identify a class which contains a directX identifications. it threw me a bizzar exception. and what i did is putting a breakpoint and run the program pressing F10, at first, it threw me an exception but thenit ran normally. try that. it's so fool but you don't encounter this exception in *.exe file!