Welcome to the XSharp News Server and Forum

You are welcome to participate in the XSharp newsgroups and forum.

The XSharp News Server can be found at news.xsharp.info, port 119 (nntp). You can login with the user name XSharpUser and password X#Rulez!.
You can also post through the web interface. In that case you need to create a user account first.
The newsgroups and web interface are not synchronized yet. We are working on that.

When posting to the newsgroups and forums we ask you kindly to follow the rules that you can find here: https://www.xsharp.info/faq/39-xsharp-news-server-rules

Debugging in Visual Studio

More
1 week 4 days ago #1 by Dick
Dick created the topic: Debugging in Visual Studio
Regular readers will know that I dislike Visual Studio very much, especially compared to programming in VO. Main problem is the fact that you can not isolate an entity so .prg/.cs based code with all code in it in some random order and unsortable on last changed/added leaves a cluttered mess.

Also high in my VS annoyance top 10 is debugging. I have posted multiple messages about this in newsgroups since 2013. I didn't really get a solution, one of the suggestions then was that multiple VS versions could cause the extra steps but as I have VS 2015 only on a system which has seen a full new W10 installation and no other VS version since, this can't be the cause. As now we have this forum with easily accessible attachments I have compiled a PDF with the 8 steps/screens I have to go through before I can start debugging while in VO, with Debug status on, I can do the same at once.

In the preview the link to the PDF didn't seem to work. If it still doesn't, please use www.ic2.be/VS/VSDebugging.pdf


I would especially like to hear from those of you who wrote earlier how much better VS was in their eyes than VO. Basically I've got 2 questions:

1) Do you experience the same steps as I show in the PDF on getting a run time error (as unhandled exception)?
2a) If no, what did you do to prevent this?
2b) If yes, why then do you consider debugging better than in VO?

Dick

File Attachment:

File Name: VSDebugging.pdf
File Size:206 KB
Attachments:

Please Log in to join the conversation.

More
1 week 4 days ago #2 by Chris Pyrgas
Chris Pyrgas replied the topic: Debugging in Visual Studio
Hi Dick,

You need to press many more buttons, because you are not using VS the way it was designed. Not saying I prefer this way or not, but in VS you are supposed to always (or usually) start your app from the IDE by clicking on the green arrow button, which starts your app in debug mode. When you do that, when an error is found in your app execution, it will be shown instantly, with no additional windows etc.

What you did instead of that, is that you run the .exe directly. Try doing that in VO, run the .exe directly, will you have any option to debug the app if a problem arises? I think there's no possibility at all. Only thing you do is to run it from within the IDE, VO opens the app in special mode, ready for the debugger. So you need to do the same thing in VS (or in XIDE), run the app in the Debugger ready mode.

About the error itself, the very first window shown when debugging starts says "Collection was modified; enumeration operation may not execute". The debugger is pointing you to a line of code where you are using foreach in the iSelection collection. That's it, no more other info needed, most probably you are modifying iSelection inside the loop that enumerates it and this is not allowed. Should be easy to fix this. In case you do really want to modify it within the loop, don't use foreach, but use a custom for loop, in which you can do anything you want with the collection.

Chris

XSharp Development Team
chris(at)xsharp.eu

Please Log in to join the conversation.

More
1 week 4 days ago #3 by Dick
Dick replied the topic: Debugging in Visual Studio
Hello Chris,

Well, this is the reply I hoped for! You are absolutely right - using Start Debugging indeed directly goes to the error. That's great to know; thanks - I've been asking this multiple times and now we see that a picture says more than 1000 words.

However, I do not completely agree with your comparison of VO. The point is when I start debugging, in both VO and VS, the program will also stop at every breakpoint which may be unwanted. But in VO, with debug on, and starting Run instead of Debug, I still get directly to the program line with the error. That is different from running an exe. VS does not do that (maybe there is a setting to run the debug mode without stopping at breakpoints?). So I still think VS is doing the job worse, but with a bit of compromising it's by far not as bad as I experiences so far.

PS: The error itself I already solved. Actually it was partly caused by the fact that C# is difficult to read with all the accolades - I put a refresh statement (changing the collection) within instead of just outside the Foreach loop. This is of course well avoidable (VS Professional shows a tooltip since 2015 telling which statement a } closes) but, as many things compared to VO, it's almost always more effort to get things working.

Dick

Please Log in to join the conversation.

More
1 week 4 days ago #4 by Dick
Dick replied the topic: Debugging in Visual Studio
I have one additional remark. From my comments it looks like I hate VS in every respect and find nothing positive. That is not true. The problem I experience is that using VS is often more cumbersome than using VO in a couple of fields I consider most important - which means it's more time consuming.

In the meantime I found that I can disable all breakpoints (without deleting them) from the Debug menu which means that with a small extra step, VS debugging will actually be better than VO (yes, I admit!) - however only on using C# . Reasons:

1) I don't have to set (AEFs/MEFs/entities) to debug mode on for one or more parts of the program which is the only way to do it in VO as end users exe's with debug standard on my fail sometimes. That's good.
2) Inspecting VO variables like arrays goes only to 64 steps. In VS I have not yet seen a limit.
3) The immediate mode is more comprehensive than VO's Ctrl X. However - that goes for C# (and maybe VB). For Vulcan compatible debugging, I have to translate the commands to C# and they are also case sensitive which makes it a bit of a guess to enter them.

So in short: with my freshly gained knowledge, C# debugging is better than VO debugging. But because of -the important- problem in 3) I still think VO debugging is much better than Vulcan compatible debugging in VS. I have not yet tried Core X#, maybe the immediate window works there with 'untranslated' commands?

Dick

Please Log in to join the conversation.

More
1 week 4 days ago #5 by Phil Hepburn
Phil Hepburn replied the topic: Debugging in Visual Studio
Dick,

Life will be 'more sweet' for you if you just give up comparing VO and the repository with VS etc., etc.. There seems little to no point.

Just move forward, and learn to use VS in the best way possible, and get useful tips from your colleagues. I did this many years back and I have never looked back. And I am far from being and expert - BUT - I seem to survive quite satisfactorily.

VS is a different way of doing things - so just go with the flow ;-0)

Best regards,
Phil.

Please Log in to join the conversation.