|
-
Jun 16th, 2005, 08:17 PM
#1
Thread Starter
Lively Member
[RESOLVED ..for the time being :D]Is .NET inherently flawed with RaiseEvents
I've made at least two fairly large apps, both of which have utterly failed. Why? They are both server applications, so it opens a new Socket thread, and some classe(s) for each session. So let's say that an event gets called - even an async event:
1. RaiseEvent MyEvent()
2. MyEvent() is raised on the host object...
3. AnotherSub() is called
4. AnotherSub() sets the object that just called the event to nothing
5. Normally, the "chain of events" ends here, but the object that called it was just terminated on step #4! The result...
"Thread (gibberish here) has exited with code 0" in debug window - a nice silent error that indicates something went horribly wrong, leaving me to guess at what.
So here's my question: Am I doing something other new people are doing (VB6 was always fine with this kind of stuff) wrong, or are my apps in need of serious overhall to avoid these "silent death" errors. It is endlessly annoying, and has killed all my large projects thus far!
edit: Oh yes, not only does the thread exit, but things "stop working" ... after the thread has died, it generally results in a lifeless program that no longer works until you restart it!
Last edited by MalcolmCarmen; Jun 17th, 2005 at 09:28 PM.
-
Jun 17th, 2005, 12:05 AM
#2
Re: Is .NET inherently flawed with RaiseEvents
nothing's wrong with .net
you're probably doing something wrong. Multi-threading can be tricky
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jun 17th, 2005, 04:56 AM
#3
Re: Is .NET inherently flawed with RaiseEvents
Stick a few breakpoints in that thread's code and then see how far it gets.
-
Jun 17th, 2005, 07:46 AM
#4
Re: Is .NET inherently flawed with RaiseEvents
If you are allowing a variable to be set to Nothing from within an event handler for that variable then it is your code that is the issue. Errors can be tricky to debug in a multithreaded environment because Action1 does something that is fine at the time, but then Action2 fails because of it. The problem is that Action2 has no idea when or where Action1 occurred, so it can't give you any information about it. Breakpoints and MessageBoxes are your friends! Also are you using synchronization techniques like SyncLock blocks?
-
Jun 17th, 2005, 09:28 PM
#5
Thread Starter
Lively Member
Re: Is .NET inherently flawed with RaiseEvents
jmcilhinney, thanks for pointing out SyncLock! This appears to be a good solution to most of my troubles!
-
Jun 17th, 2005, 10:57 PM
#6
Re: [RESOLVED ..for the time being :D]Is .NET inherently flawed with RaiseEvents
theres another one which I'm not sure what it's called in VB.NET
it's the fixed block in C#
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jun 17th, 2005, 11:06 PM
#7
Re: [RESOLVED ..for the time being :D]Is .NET inherently flawed with RaiseEvents
I doubt that there is a VB equivalent to "fixed" given that it is related to pointers. Given that the fixed statement can only be used in an unsafe context, and relates to whether the GC can move an object in memory, it is probably not useful to most people in most situations.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|