Someone knows how fast this code can kill your application? [modified]
-
private Pair<RefPoint3d> m_BoundingBox; public Pair<RefPoint3d> BoundingBox { get { **return BoundingBox**; } set { m_BoundingBox = value; } }
Did you never define a property in this way? The run-time consequence is amazing: no exceptions at all, and sudden termination of the debug session when you are hovering the call at the property in your client module. PS: the error is inside the get property, because of the not voluntary recursive cycle it generates. PPS: I have no idea how this issue can be coded, the automatic refactoring of VS2005 should make impossible to code malware property.**************************** Strong congruence for strong people; with a compatible behaviour. For a semantical way of life.
modified on Tuesday, June 10, 2008 10:22 AM
-
private Pair<RefPoint3d> m_BoundingBox; public Pair<RefPoint3d> BoundingBox { get { **return BoundingBox**; } set { m_BoundingBox = value; } }
Did you never define a property in this way? The run-time consequence is amazing: no exceptions at all, and sudden termination of the debug session when you are hovering the call at the property in your client module. PS: the error is inside the get property, because of the not voluntary recursive cycle it generates. PPS: I have no idea how this issue can be coded, the automatic refactoring of VS2005 should make impossible to code malware property.**************************** Strong congruence for strong people; with a compatible behaviour. For a semantical way of life.
modified on Tuesday, June 10, 2008 10:22 AM
-
private Pair<RefPoint3d> m_BoundingBox; public Pair<RefPoint3d> BoundingBox { get { **return BoundingBox**; } set { m_BoundingBox = value; } }
Did you never define a property in this way? The run-time consequence is amazing: no exceptions at all, and sudden termination of the debug session when you are hovering the call at the property in your client module. PS: the error is inside the get property, because of the not voluntary recursive cycle it generates. PPS: I have no idea how this issue can be coded, the automatic refactoring of VS2005 should make impossible to code malware property.**************************** Strong congruence for strong people; with a compatible behaviour. For a semantical way of life.
modified on Tuesday, June 10, 2008 10:22 AM
Marcello Faga wrote:
Someone knows how fast this code can kill your application?
It depends on the stack size of your application... :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
private Pair<RefPoint3d> m_BoundingBox; public Pair<RefPoint3d> BoundingBox { get { **return BoundingBox**; } set { m_BoundingBox = value; } }
Did you never define a property in this way? The run-time consequence is amazing: no exceptions at all, and sudden termination of the debug session when you are hovering the call at the property in your client module. PS: the error is inside the get property, because of the not voluntary recursive cycle it generates. PPS: I have no idea how this issue can be coded, the automatic refactoring of VS2005 should make impossible to code malware property.**************************** Strong congruence for strong people; with a compatible behaviour. For a semantical way of life.
modified on Tuesday, June 10, 2008 10:22 AM
I think everyone here knows that.
-
I think everyone here knows that.
Of course PIEBALD, it was a rethorical question ;) . The real question is how someone can have coded that one?
**************************** Strong congruence for strong people; with a compatible behaviour. For a semantical way of life.
modified on Wednesday, June 11, 2008 4:54 AM
-
Of course PIEBALD, it was a rethorical question ;) . The real question is how someone can have coded that one?
**************************** Strong congruence for strong people; with a compatible behaviour. For a semantical way of life.
modified on Wednesday, June 11, 2008 4:54 AM
It's actually very easy, because recursive properties are perfectly legal. And Refactoring doesn't do anything about it, because you have to invoke it manually for a specific Refactoring case. While this is definitely a subtile bug, it is a pretty common one if you are following the basic .NET Framework Naming convention to use PascalCasing for the public property and camelCasing for the private field. Intellisense can even help you to make it wrong, depending on your exact settings and what you typed before. If you put an underscore in front of the field name, it can't happen (or is at least easy to spot).
-
Of course PIEBALD, it was a rethorical question ;) . The real question is how someone can have coded that one?
**************************** Strong congruence for strong people; with a compatible behaviour. For a semantical way of life.
modified on Wednesday, June 11, 2008 4:54 AM
That problem has been presented here or in Subtle Bugs multiple times.
-
private Pair<RefPoint3d> m_BoundingBox; public Pair<RefPoint3d> BoundingBox { get { **return BoundingBox**; } set { m_BoundingBox = value; } }
Did you never define a property in this way? The run-time consequence is amazing: no exceptions at all, and sudden termination of the debug session when you are hovering the call at the property in your client module. PS: the error is inside the get property, because of the not voluntary recursive cycle it generates. PPS: I have no idea how this issue can be coded, the automatic refactoring of VS2005 should make impossible to code malware property.**************************** Strong congruence for strong people; with a compatible behaviour. For a semantical way of life.
modified on Tuesday, June 10, 2008 10:22 AM
Using automatic properties you won't run in such problem.
Giorgi Dalakishvili #region signature my articles #endregion
-
It's actually very easy, because recursive properties are perfectly legal. And Refactoring doesn't do anything about it, because you have to invoke it manually for a specific Refactoring case. While this is definitely a subtile bug, it is a pretty common one if you are following the basic .NET Framework Naming convention to use PascalCasing for the public property and camelCasing for the private field. Intellisense can even help you to make it wrong, depending on your exact settings and what you typed before. If you put an underscore in front of the field name, it can't happen (or is at least easy to spot).
That's one reason I hate camel casing. Pascal casing or Hungarian notation is my thing.
-
private Pair<RefPoint3d> m_BoundingBox; public Pair<RefPoint3d> BoundingBox { get { **return BoundingBox**; } set { m_BoundingBox = value; } }
Did you never define a property in this way? The run-time consequence is amazing: no exceptions at all, and sudden termination of the debug session when you are hovering the call at the property in your client module. PS: the error is inside the get property, because of the not voluntary recursive cycle it generates. PPS: I have no idea how this issue can be coded, the automatic refactoring of VS2005 should make impossible to code malware property.**************************** Strong congruence for strong people; with a compatible behaviour. For a semantical way of life.
modified on Tuesday, June 10, 2008 10:22 AM
Oops...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon