FranxCDOFranx wrote:
Hey Sergey, if you are referring to me yes I didn't not understand as I am a beginner in this field. I am trying to debug and find the reason for the wrong multiplication. If you want to be more specific to the problem as to how I should debug and fix the algorithm please do. Thank you.
Being the beginner does not provide an excuse for not debugging; it's just that at first you have to debug more then when you get more experience.
Please see my comment to the question. Let me continue. For most bugs, the process of debugging shows the property of
convergence (
https://en.wikipedia.org/wiki/Series_%28mathematics%29#Absolute_convergence[
^]): after next step, you come closer to figuring out of the bug, which you can do in a finite number (practically, small number of steps). Your task is to build a process of converging debugging step. I already described the idea "hypothesis and confirmation" steps in one of my comments to the question.
Some more hints:
When you stopped at some break point, you can always find where it comes from using Debug window "call stack". It is most useful when you debug incorrect
recursion. In all cases, to understand programming in general, you need to understand how call stack works to provide the usual mechanism of calls, parameter passing and return, and also the nature of stack variables and exception.
In "hypothesis" approach, you can temporary disable some or all break point instead of removing them, as it's very likely that eventually you have to start over. In the watch window, you can mark the object with the tag revealing its referential identity (you can do the same in code only using
System.Object.ReferenceEquals
, but it's more useful during debugging).
Certainly scan all menus of all debug windows and try it all out. It will take minimal time but will be extremely useful and pay off very soon. Look at help pages on all those operations.
—SA