Click here to Skip to main content
15,885,546 members
Home / Discussions / C#
   

C#

 
QuestionSmall question on Finalizers Pin
Foothill2-Jun-16 8:56
professionalFoothill2-Jun-16 8:56 
AnswerRe: Small question on Finalizers Pin
Dave Kreskowiak2-Jun-16 9:07
mveDave Kreskowiak2-Jun-16 9:07 
GeneralRe: Small question on Finalizers Pin
Foothill2-Jun-16 9:55
professionalFoothill2-Jun-16 9:55 
GeneralRe: Small question on Finalizers Pin
Dave Kreskowiak2-Jun-16 10:53
mveDave Kreskowiak2-Jun-16 10:53 
GeneralRe: Small question on Finalizers Pin
Foothill2-Jun-16 11:22
professionalFoothill2-Jun-16 11:22 
GeneralRe: Small question on Finalizers Pin
Dave Kreskowiak2-Jun-16 11:58
mveDave Kreskowiak2-Jun-16 11:58 
GeneralRe: Small question on Finalizers Pin
Foothill3-Jun-16 5:10
professionalFoothill3-Jun-16 5:10 
AnswerRe: Small question on Finalizers Pin
Richard Deeming2-Jun-16 9:34
mveRichard Deeming2-Jun-16 9:34 
You should definitely read Eric Lippert's two blog posts on finalizers:
When everything you know is wrong, part one | Fabulous adventures in coding[^]
When everything you know is wrong, part two | Fabulous adventures in coding[^]

Particularly this part:
Quote:
If you have a tree of objects and you are finalizing the root, then the children are still alive — because the root is alive, because it is on the finalization queue, and so the children have a living reference — but the children may have already been finalized, and are in no particularly good state to have their methods or data accessed.

Also:

Therefore, it is vitally important that finalizers do as little work as possible. Remember also that although all object pointers remain valid during finalization, it might be the case that those pointers lead to objects that have already been finalized and might therefore be less than useful. It is generally safest to avoid following object pointers in finalization code even though the pointers are valid. A safe, short finalization code path is the best.

And:

* Implement Finalize only if you hold unmanaged resources across client calls.
* Keep finalizer code simple to prevent blocking.
- Do not issue calls that could block the calling thread.


Basically, calling Thread.Join from a finalizer seems like a very bad idea. Smile | :)



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Small question on Finalizers Pin
Foothill2-Jun-16 11:02
professionalFoothill2-Jun-16 11:02 
QuestionHow to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
somagunasekaran2-Jun-16 1:35
somagunasekaran2-Jun-16 1:35 
AnswerRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
Richard Deeming2-Jun-16 2:11
mveRichard Deeming2-Jun-16 2:11 
AnswerRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
OriginalGriff2-Jun-16 4:08
mveOriginalGriff2-Jun-16 4:08 
GeneralRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
Richard MacCutchan2-Jun-16 4:35
mveRichard MacCutchan2-Jun-16 4:35 
GeneralRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
OriginalGriff2-Jun-16 4:57
mveOriginalGriff2-Jun-16 4:57 
GeneralRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
Pete O'Hanlon2-Jun-16 5:37
mvePete O'Hanlon2-Jun-16 5:37 
GeneralRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
OriginalGriff2-Jun-16 6:05
mveOriginalGriff2-Jun-16 6:05 
GeneralRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
Mycroft Holmes2-Jun-16 13:03
professionalMycroft Holmes2-Jun-16 13:03 
AnswerRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
Gerry Schmitz2-Jun-16 4:58
mveGerry Schmitz2-Jun-16 4:58 
Questionplz introduce appropriate component Pin
Member 125609791-Jun-16 22:15
Member 125609791-Jun-16 22:15 
AnswerRe: plz introduce appropriate component Pin
OriginalGriff1-Jun-16 23:07
mveOriginalGriff1-Jun-16 23:07 
AnswerRe: plz introduce appropriate component Pin
Gerry Schmitz2-Jun-16 5:20
mveGerry Schmitz2-Jun-16 5:20 
AnswerRe: plz introduce appropriate component Pin
Eddy Vluggen3-Jun-16 0:06
professionalEddy Vluggen3-Jun-16 0:06 
QuestionTest Methods Are Grayed out Pin
MadDashCoder1-Jun-16 19:24
MadDashCoder1-Jun-16 19:24 
AnswerRe: Test Methods Are Grayed out Pin
Gerry Schmitz2-Jun-16 5:13
mveGerry Schmitz2-Jun-16 5:13 
QuestionShow message box on top from windows tray application. Pin
raydebojyoti1-Jun-16 0:25
raydebojyoti1-Jun-16 0:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.