Why WPF sucks today
-
Because the damn stupid thing does not know what a reference is. If i send object by referance then it should keep a reference to that object, and what ever change one does to that object, change should be persisted on that object. You don't know what i am talking about? http://www.codeproject.com/answers/54805/ByRef-object-value-is-lost-between-methods.aspx[^] I'm so angry right now. I did review my code 10 times already, i did not write anything wrong, the damn thing does not work. And i know it's not actually WPF problem, but .Net. But somehow this is working in VS 2005. Oh, and the binding is even worse, you can't undo binded values, so, if you make edit window, and click on cancel (changes) you can't tell him undo my bindings, instead you have to clone object first, then copy new values when you want changes to apply. must... kill... steve... ballmer... argh...
-
Because the damn stupid thing does not know what a reference is. If i send object by referance then it should keep a reference to that object, and what ever change one does to that object, change should be persisted on that object. You don't know what i am talking about? http://www.codeproject.com/answers/54805/ByRef-object-value-is-lost-between-methods.aspx[^] I'm so angry right now. I did review my code 10 times already, i did not write anything wrong, the damn thing does not work. And i know it's not actually WPF problem, but .Net. But somehow this is working in VS 2005. Oh, and the binding is even worse, you can't undo binded values, so, if you make edit window, and click on cancel (changes) you can't tell him undo my bindings, instead you have to clone object first, then copy new values when you want changes to apply. must... kill... steve... ballmer... argh...
Enver Maroshi wrote:
If i send object by reference then it should keep a reference to that object, and what ever change one does to that object, change should be persisted on that object.
Funnily enough that is how referencing works, but that is not how your code is written to work. Not the place for the lounge though, so I wrote a very quick answer over in your question. But no arguments in general though, I'm still not a fan of WPF :)
-
Because the damn stupid thing does not know what a reference is. If i send object by referance then it should keep a reference to that object, and what ever change one does to that object, change should be persisted on that object. You don't know what i am talking about? http://www.codeproject.com/answers/54805/ByRef-object-value-is-lost-between-methods.aspx[^] I'm so angry right now. I did review my code 10 times already, i did not write anything wrong, the damn thing does not work. And i know it's not actually WPF problem, but .Net. But somehow this is working in VS 2005. Oh, and the binding is even worse, you can't undo binded values, so, if you make edit window, and click on cancel (changes) you can't tell him undo my bindings, instead you have to clone object first, then copy new values when you want changes to apply. must... kill... steve... ballmer... argh...
This has nothing to do with WPF. Your understanding of VB sucks. In a proper language like C#, your code would be a compile-time error (you cannot assign to 'this'). The VB compiler silently inserts a temporary variable that makes the code compile but produce incorrect results. You may want to read an explanation of what ByRef really is[^].
-
Enver Maroshi wrote:
If i send object by reference then it should keep a reference to that object, and what ever change one does to that object, change should be persisted on that object.
Funnily enough that is how referencing works, but that is not how your code is written to work. Not the place for the lounge though, so I wrote a very quick answer over in your question. But no arguments in general though, I'm still not a fan of WPF :)
I think you did not get my question/problem correct. Oh, i did not write quesiton in lounge, i'm just complaining here. Doh, now i don't even know how to post a follow-up inside my question... i did not click on answer, instead on new forum message... Anyway, i wrote some more details....
-
This has nothing to do with WPF. Your understanding of VB sucks. In a proper language like C#, your code would be a compile-time error (you cannot assign to 'this'). The VB compiler silently inserts a temporary variable that makes the code compile but produce incorrect results. You may want to read an explanation of what ByRef really is[^].
Where do you guys see in my code that i try to assign something to "Me"? I try to add values to a collection. VB compiler does nothing wrong, since the code is correct. Either i don't see something, or you guys did overlook that i nowhere try to set a value to "Me". Me is a collection, i just add items to collection, and items are lost. This same code works perfect in .Net 2.0. But, anyway, if you want to comment my code, please do so on my question. Or give me an answer. But please, first read my code. I don't say i don't have a bug, only i don't see one. And trust me i know what a ByRef is, i am programming for 10 years already. I think i understand what a ByRef is. :)
-
Because the damn stupid thing does not know what a reference is. If i send object by referance then it should keep a reference to that object, and what ever change one does to that object, change should be persisted on that object. You don't know what i am talking about? http://www.codeproject.com/answers/54805/ByRef-object-value-is-lost-between-methods.aspx[^] I'm so angry right now. I did review my code 10 times already, i did not write anything wrong, the damn thing does not work. And i know it's not actually WPF problem, but .Net. But somehow this is working in VS 2005. Oh, and the binding is even worse, you can't undo binded values, so, if you make edit window, and click on cancel (changes) you can't tell him undo my bindings, instead you have to clone object first, then copy new values when you want changes to apply. must... kill... steve... ballmer... argh...
Only now i understand what a piece of crap i wrote. I was doing copy-paste from previous project, and i really did what you wrote, only, i did not review the class where the problem was and i indeed did try to assing a value to "Me". I was debuging only methods in parent class and did not even look at what i actually try to do. Anyway, my mistake. Sorry once again. And thnx, i would not ever noticed it without you. :-O Oh, btw, WPF does suck, and WPF editor inside VS.
-
Because the damn stupid thing does not know what a reference is. If i send object by referance then it should keep a reference to that object, and what ever change one does to that object, change should be persisted on that object. You don't know what i am talking about? http://www.codeproject.com/answers/54805/ByRef-object-value-is-lost-between-methods.aspx[^] I'm so angry right now. I did review my code 10 times already, i did not write anything wrong, the damn thing does not work. And i know it's not actually WPF problem, but .Net. But somehow this is working in VS 2005. Oh, and the binding is even worse, you can't undo binded values, so, if you make edit window, and click on cancel (changes) you can't tell him undo my bindings, instead you have to clone object first, then copy new values when you want changes to apply. must... kill... steve... ballmer... argh...
-
This has nothing to do with WPF. Your understanding of VB sucks. In a proper language like C#, your code would be a compile-time error (you cannot assign to 'this'). The VB compiler silently inserts a temporary variable that makes the code compile but produce incorrect results. You may want to read an explanation of what ByRef really is[^].
Actually, you can assign values to "this" in c# ;-) Try it inside the constructor of a struct.
-
I think you did not get my question/problem correct. Oh, i did not write quesiton in lounge, i'm just complaining here. Doh, now i don't even know how to post a follow-up inside my question... i did not click on answer, instead on new forum message... Anyway, i wrote some more details....
Enver Maroshi wrote:
I think you did not get my question/problem correct.
Heh, I think I did, hence why you deleted the question :) And don't stress about it, we all have bad days, especially when staring at the same code for hours and hours crying "Why doesn't this work!!!". Always good to get another pair of eyes on it at that point.
-
Actually, you can assign values to "this" in c# ;-) Try it inside the constructor of a struct.
Heh, talk about a corner of a corner case :)
-
Enver Maroshi wrote:
I think you did not get my question/problem correct.
Heh, I think I did, hence why you deleted the question :) And don't stress about it, we all have bad days, especially when staring at the same code for hours and hours crying "Why doesn't this work!!!". Always good to get another pair of eyes on it at that point.
Yes you did. Well, mistakes do happen :-O I deleted the question since i thought this is the way you close a "ticket" or in this case, a question. But don't know, i think it's still there. As a reminder to me to give a better check of code next time :doh:
-
Where do you guys see in my code that i try to assign something to "Me"? I try to add values to a collection. VB compiler does nothing wrong, since the code is correct. Either i don't see something, or you guys did overlook that i nowhere try to set a value to "Me". Me is a collection, i just add items to collection, and items are lost. This same code works perfect in .Net 2.0. But, anyway, if you want to comment my code, please do so on my question. Or give me an answer. But please, first read my code. I don't say i don't have a bug, only i don't see one. And trust me i know what a ByRef is, i am programming for 10 years already. I think i understand what a ByRef is. :)
ByRef in VB can mean: 1) pass-by-reference 2) pass-by-value 3) pass-by-value-result (aka copy-in, copy-out) Which of those the VB compiler chooses depends on the expression you are trying to pass to the method. You are passing "Me" ByRef. This is like trying to assign to "Me". What the VB compiler does in this case is that chooses 2), silently introduces a temporary variable and passes that instead. So in effect, the method gets called pass-by-value even though it is declared ByRef. The subtle difference between 1) and 3) can also lead to lots of hours wasted debugging. Debugging gets hard if the bug is in code the compiler silently inserted!
-
Only now i understand what a piece of crap i wrote. I was doing copy-paste from previous project, and i really did what you wrote, only, i did not review the class where the problem was and i indeed did try to assing a value to "Me". I was debuging only methods in parent class and did not even look at what i actually try to do. Anyway, my mistake. Sorry once again. And thnx, i would not ever noticed it without you. :-O Oh, btw, WPF does suck, and WPF editor inside VS.
Enver Maroshi wrote:
Oh, btw, WPF does suck, and WPF editor inside VS.
How do those grapes taste? Sour?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
Only now i understand what a piece of crap i wrote. I was doing copy-paste from previous project, and i really did what you wrote, only, i did not review the class where the problem was and i indeed did try to assing a value to "Me". I was debuging only methods in parent class and did not even look at what i actually try to do. Anyway, my mistake. Sorry once again. And thnx, i would not ever noticed it without you. :-O Oh, btw, WPF does suck, and WPF editor inside VS.
Enver Maroshi wrote:
Oh, btw, WPF does suck, and WPF editor inside VS.
Then don't use it! :)
Rocky <>< Recent Blog Post: Coca-Cola In Israel..