Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. What do you do?

What do you do?

Scheduled Pinned Locked Moved The Lounge
questionloungecsharpvisual-studiodebugging
62 Posts 41 Posters 9 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Michael Dunn

    Logging, logging, and more logging. In my main product (see .sig) I put in lots of logging just in case some critical part blows up. And since the app deals with IE and network communication - two areas that are susceptible to errors - it's really come in handy many times. We can ask the customer to send us a log (the log is encrypted, but they can click a button and it's zipped up into a CAB file on their desktop that they mail us) and many times that gives us enough info to provide a fix, or at least an explanation and a workaround. It does take extra work to do the logging, but it's like comments - if you write the logging at the same time as the "real" code, it ain't bad.

    --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

    R Offline
    R Offline
    Rocky Moore
    wrote on last edited by
    #31

    Yeah, I agree! One of the first steps in a major application, logging.. Too many people are spoiled by debuggers, I still remember Printf as being my debugging tool :)

    Rocky <>< Latest Code Blog Post: OpenID - C# project! Latest Tech Blog Post: Want to test Joost (video on demand) - I have invites!

    R 1 Reply Last reply
    0
    • Richard Andrew x64R Richard Andrew x64

      Thanks for your excellent post. The client and I do make extensive use of Remote Assistance, but the crashes are intermittent, and we can't be connected all day long.

      -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

      R Offline
      R Offline
      Rocky Moore
      wrote on last edited by
      #32

      Yeah, that is where logging first in so good. Even if the crash itself does not generate an error in the log, if you have enough tracing points in the program, you will know the last things that were happening prior to the crash by looking in the log and seeing when the log was restarted. I always used a method of logging that allowed me to enable it from either a command line option or in a config file for the program. It would be setup so that I could specify a level of trace so that it could program simple overview or a level of great detail. Normally, the apps would have it turned off, but if a problem appeared, would have the client set the value to overview and if that did get the information I needed, I would have the keep increasing the level of detail until it did. This can cost a slight overhead in performance when it is turned off, but the logging is critical when things go wrong!

      Rocky <>< Latest Code Blog Post: OpenID - C# project! Latest Tech Blog Post: Want to test Joost (video on demand) - I have invites!

      1 Reply Last reply
      0
      • N Nish Nishant

        Richie308 wrote:

        Do you happen to know if the VS remote debugger works across the internet? It doesn't specifically say in the docs. It says only "Across domains" which I'm not sure is the same thing.

        I think you'd have to ask the client to allow you to VPN in to their network. I don't think it would work over the Internet - specially since I assume your client would have appropriate proxies and firewalls in place.

        Regards, Nish


        Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
        C++/CLI in Action

        Fly on your way like an eagle Fly as high as the sun On your wings like an eagle Fly and touch the sun

        C Offline
        C Offline
        CKnig
        wrote on last edited by
        #33

        Right - it will almost surely not work over the internet - and you will have to do a cross domain debuging session which can be a real pain (you know you have to be in the "debuging-role" on the remote computer). Bye the way a domain is some kind of "networking-namespace" ;)

        1 Reply Last reply
        0
        • Richard Andrew x64R Richard Andrew x64

          I'm only looking for general advice with this question, that's why I posted it in the lounge. Please accept my groveling apologies if this is not appropriate for the lounge. When your app is having mysterious crashes on the client's machine, and you cannot replicate them on your development machine, what on Earth is there to do about it? Assuming it's not an option to install Visual Studio onto the client machine, and the fact that the crashes are random and infrequent enough to make a remote debug session impractical, what strategy can be employed?

          -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

          M Offline
          M Offline
          micmanos
          wrote on last edited by
          #34

          It really depends on your application as there are many methods of identifying such problems. Usually this can occur for the following reasons ... 1. Older DB engine ... you have SQL2005 he's got MSDE. 2. You use local DB acces (SQL2005Express), he uses remote (SQL2005Server). 3. ODBC driver issue. 4. Different OS Service Pack. 5. Networking is more strict .... he's got firewalls, proxys, ... etc.:~ 6. Wrong Framework version ... (silly, i know).:doh: 7. You use DLLs from other apps (Ms-Office, ... etc) that are different than the ones on your clinet. 8. G.A.C issue (God help us all !!!!:omg:) 9. Click once issue / App needs admistrative privileges.:confused: 10. Our own (or the customers for that mater) stupidity .... e.x: I had a firewall that i set to prevent system wide hooks for applications (others than IE, .. etc), thus crashing several of my .NET assemblies. It took me 1 week to figure that out. X| 11. a million other tiny issues that can occur. :~ Things to do ... 1. IMPORTANT: Define your error trapping and logging approach, BEFORE starting coding. It WILL make the whole logging proccess A LOT faster and easier. 2. Log procedure execution (parameters, results, stack, .. .etc). 3. Log SQL statements. 4. Log object creation, memory usage (It's hard, i know). 5. Log file activity. 6. Log assembly activity. 7. Log errors. 8. Provide "Send error report" functionality to your application. Many were the times where the so called BUG, wasn't a bug at all. The above logging method has helped me pinpoint the problem and identify it as a 'Bug' and issue a patch to fix it or as a 'Customer Lack of IT knowhow' and help the customer pinpoint it and fix it.

          Richard Andrew x64R 1 Reply Last reply
          0
          • R Rajesh R Subramanian

            Give your machine to the client.

            H Offline
            H Offline
            HomeSen
            wrote on last edited by
            #35

            But you have to convince him it's the only option he has ;-) I would suggest taking his machine instead (maybe for a week or so). And start local debugging. I think it would be best. Or, if your customer can't do without his PC, make a complete image of his system, and install it in a virtual machine.

            1 Reply Last reply
            0
            • T Tim Carmichael

              Ok, that get's a 5...

              B Offline
              B Offline
              bywin
              wrote on last edited by
              #36

              Here here, all for passing the buck. say AYE.

              B 1 Reply Last reply
              0
              • M micmanos

                It really depends on your application as there are many methods of identifying such problems. Usually this can occur for the following reasons ... 1. Older DB engine ... you have SQL2005 he's got MSDE. 2. You use local DB acces (SQL2005Express), he uses remote (SQL2005Server). 3. ODBC driver issue. 4. Different OS Service Pack. 5. Networking is more strict .... he's got firewalls, proxys, ... etc.:~ 6. Wrong Framework version ... (silly, i know).:doh: 7. You use DLLs from other apps (Ms-Office, ... etc) that are different than the ones on your clinet. 8. G.A.C issue (God help us all !!!!:omg:) 9. Click once issue / App needs admistrative privileges.:confused: 10. Our own (or the customers for that mater) stupidity .... e.x: I had a firewall that i set to prevent system wide hooks for applications (others than IE, .. etc), thus crashing several of my .NET assemblies. It took me 1 week to figure that out. X| 11. a million other tiny issues that can occur. :~ Things to do ... 1. IMPORTANT: Define your error trapping and logging approach, BEFORE starting coding. It WILL make the whole logging proccess A LOT faster and easier. 2. Log procedure execution (parameters, results, stack, .. .etc). 3. Log SQL statements. 4. Log object creation, memory usage (It's hard, i know). 5. Log file activity. 6. Log assembly activity. 7. Log errors. 8. Provide "Send error report" functionality to your application. Many were the times where the so called BUG, wasn't a bug at all. The above logging method has helped me pinpoint the problem and identify it as a 'Bug' and issue a patch to fix it or as a 'Customer Lack of IT knowhow' and help the customer pinpoint it and fix it.

                Richard Andrew x64R Offline
                Richard Andrew x64R Offline
                Richard Andrew x64
                wrote on last edited by
                #37

                Thank you for your good post. I dread hand-coding log function calls for every little thing going on in the app. But I understand that that is what has to be done. However, if you log too much, the log file becomes too huge, and they can't email it! :doh:

                -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

                1 Reply Last reply
                0
                • Richard Andrew x64R Richard Andrew x64

                  I'm only looking for general advice with this question, that's why I posted it in the lounge. Please accept my groveling apologies if this is not appropriate for the lounge. When your app is having mysterious crashes on the client's machine, and you cannot replicate them on your development machine, what on Earth is there to do about it? Assuming it's not an option to install Visual Studio onto the client machine, and the fact that the crashes are random and infrequent enough to make a remote debug session impractical, what strategy can be employed?

                  -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

                  M Offline
                  M Offline
                  M Josef
                  wrote on last edited by
                  #38

                  You may use a globale exception handler to catch all the unhandled exceptions. e.Exception.StackTrace can be very usefull to show you what's going on.. Regards

                  1 Reply Last reply
                  0
                  • R Rocky Moore

                    Yeah, I agree! One of the first steps in a major application, logging.. Too many people are spoiled by debuggers, I still remember Printf as being my debugging tool :)

                    Rocky <>< Latest Code Blog Post: OpenID - C# project! Latest Tech Blog Post: Want to test Joost (video on demand) - I have invites!

                    R Offline
                    R Offline
                    Rajesh R Subramanian
                    wrote on last edited by
                    #39

                    Rocky Moore wrote:

                    I still remember Printf as being my debugging tool

                    Printf has saved my life several times. :) It is the best 'debugging tool'!

                    1 Reply Last reply
                    0
                    • R Rajesh R Subramanian

                      Give your machine to the client.

                      N Offline
                      N Offline
                      NormDroid
                      wrote on last edited by
                      #40

                      :laugh:, yes that has actually been done in the past.

                      .net is a box of never ending treasures, every day I get find another gem.

                      1 Reply Last reply
                      0
                      • Richard Andrew x64R Richard Andrew x64

                        I'm only looking for general advice with this question, that's why I posted it in the lounge. Please accept my groveling apologies if this is not appropriate for the lounge. When your app is having mysterious crashes on the client's machine, and you cannot replicate them on your development machine, what on Earth is there to do about it? Assuming it's not an option to install Visual Studio onto the client machine, and the fact that the crashes are random and infrequent enough to make a remote debug session impractical, what strategy can be employed?

                        -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

                        J Offline
                        J Offline
                        Jonas Hammarberg
                        wrote on last edited by
                        #41

                        Activate logging;) Once I run into a crash. The responsible developer - "It works here. Send your machine to me.". And he was serious... rgds /Jonas

                        1 Reply Last reply
                        0
                        • Richard Andrew x64R Richard Andrew x64

                          I'm only looking for general advice with this question, that's why I posted it in the lounge. Please accept my groveling apologies if this is not appropriate for the lounge. When your app is having mysterious crashes on the client's machine, and you cannot replicate them on your development machine, what on Earth is there to do about it? Assuming it's not an option to install Visual Studio onto the client machine, and the fact that the crashes are random and infrequent enough to make a remote debug session impractical, what strategy can be employed?

                          -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

                          R Offline
                          R Offline
                          reshi999
                          wrote on last edited by
                          #42

                          As said before the best solution is to code in logging\debug functionality, this can be driven via initiation parameters pretty easily. Another technique is to strengthen all error handling (try...catch), and report consistent error info - The standard dotnet error report tends to only report side effects in my experience. Are you publishing the project using the dotnet setup file? I've found that it has a bug that if a dll exists on the computer it will not install it, a frustrating issue which I normally resolve by forcing the DLL's to be copied to the program folder - not good but it works!

                          Richard Andrew x64R 1 Reply Last reply
                          0
                          • R reshi999

                            As said before the best solution is to code in logging\debug functionality, this can be driven via initiation parameters pretty easily. Another technique is to strengthen all error handling (try...catch), and report consistent error info - The standard dotnet error report tends to only report side effects in my experience. Are you publishing the project using the dotnet setup file? I've found that it has a bug that if a dll exists on the computer it will not install it, a frustrating issue which I normally resolve by forcing the DLL's to be copied to the program folder - not good but it works!

                            Richard Andrew x64R Offline
                            Richard Andrew x64R Offline
                            Richard Andrew x64
                            wrote on last edited by
                            #43

                            reshi999 wrote:

                            Are you publishing the project using the dotnet setup file?

                            It's a native app. And unfortunately the problem looks like a stack fault, so I don't even get an exception to handle. The app just silently disappears.

                            -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

                            R 1 Reply Last reply
                            0
                            • Richard Andrew x64R Richard Andrew x64

                              reshi999 wrote:

                              Are you publishing the project using the dotnet setup file?

                              It's a native app. And unfortunately the problem looks like a stack fault, so I don't even get an exception to handle. The app just silently disappears.

                              -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

                              R Offline
                              R Offline
                              reshi999
                              wrote on last edited by
                              #44

                              Ouch nasty, this would indicate to me: a. Missing libraries, reinstall .net framework and make sure PC is fully updated b. Bad hardware, have seen faulty RAM cause this kind of problem c. Virus, its a long shot but check that they have half decent security installed

                              1 Reply Last reply
                              0
                              • M Michael Dunn

                                Logging, logging, and more logging. In my main product (see .sig) I put in lots of logging just in case some critical part blows up. And since the app deals with IE and network communication - two areas that are susceptible to errors - it's really come in handy many times. We can ask the customer to send us a log (the log is encrypted, but they can click a button and it's zipped up into a CAB file on their desktop that they mail us) and many times that gives us enough info to provide a fix, or at least an explanation and a workaround. It does take extra work to do the logging, but it's like comments - if you write the logging at the same time as the "real" code, it ain't bad.

                                --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

                                L Offline
                                L Offline
                                Luc Pattyn
                                wrote on last edited by
                                #45

                                I concur. Add logging from day one. When problems arise, if necessary, add more logging and assertions. And the first thing to log is the machine's characteristics, including everything from the Environment and SystemInfo classes. Then compare the logs of: - the dev machine - the target machine while running fine - the target machine while having problems :)

                                Luc Pattyn [My Articles]

                                1 Reply Last reply
                                0
                                • P Patrick Etc

                                  log4net has saved my ass on several occasions. It's easy and reliable and just about the best logger for .NET I've ever seen so that's what I'd suggest. http://logging.apache.org/log4net/[^]

                                  D Offline
                                  D Offline
                                  David Veeneman
                                  wrote on last edited by
                                  #46

                                  What kind of performance hit does Log4Net incur? Can I leave it turned off to avoid the performance hit, then have the customer turn it on if they're having problems? Thanks.

                                  David Veeneman www.veeneman.com

                                  P 1 Reply Last reply
                                  0
                                  • Richard Andrew x64R Richard Andrew x64

                                    I'm only looking for general advice with this question, that's why I posted it in the lounge. Please accept my groveling apologies if this is not appropriate for the lounge. When your app is having mysterious crashes on the client's machine, and you cannot replicate them on your development machine, what on Earth is there to do about it? Assuming it's not an option to install Visual Studio onto the client machine, and the fact that the crashes are random and infrequent enough to make a remote debug session impractical, what strategy can be employed?

                                    -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

                                    A Offline
                                    A Offline
                                    Adadurov
                                    wrote on last edited by
                                    #47

                                    back in times of using Visual C++ 6.0 we built .map files for our products' binary modules and kept these files for every build that was approved for delivery to customers. if user experienced a crash, all we needed from him/her was crashing module name and address, (and some information about user actions that precedeed the crash) which was provided by Windows. with that we could trace crash to source file and line number using .map file and try to fix it. of course, this approach works only with simple bugs.

                                    1 Reply Last reply
                                    0
                                    • Richard Andrew x64R Richard Andrew x64

                                      I'm only looking for general advice with this question, that's why I posted it in the lounge. Please accept my groveling apologies if this is not appropriate for the lounge. When your app is having mysterious crashes on the client's machine, and you cannot replicate them on your development machine, what on Earth is there to do about it? Assuming it's not an option to install Visual Studio onto the client machine, and the fact that the crashes are random and infrequent enough to make a remote debug session impractical, what strategy can be employed?

                                      -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

                                      W Offline
                                      W Offline
                                      WhiteSpy
                                      wrote on last edited by
                                      #48

                                      It's a pain in the A$$ but you might try putting additional code in to monitor (write to file) where the program is (top of the sub routine) when it crashes you'll at least have an idea of where it was when it happened. On really tough ones we've done this. Then we go in and do the same thing with the individual routine adding code as we think of things that may be causing it. We do this until we find and can reproduce the error on the badly acting machine. We once bought our client a loaner machine so that we could take the bad acter to our office. You may not be able to do that, but it helped us find a bad driver that was causing the problem.

                                      1 Reply Last reply
                                      0
                                      • D David Veeneman

                                        What kind of performance hit does Log4Net incur? Can I leave it turned off to avoid the performance hit, then have the customer turn it on if they're having problems? Thanks.

                                        David Veeneman www.veeneman.com

                                        P Offline
                                        P Offline
                                        Patrick Etc
                                        wrote on last edited by
                                        #49

                                        In my experience, the performance hit is so low that I haven't observed it, and I've used it in real time systems without problem. That said, if logging isn't necessary for any but debug operations, there's still no reason to have it turned on UNLESS you're trying to debug. No point in generating tons of log files that will never be used.

                                        1 Reply Last reply
                                        0
                                        • B bywin

                                          Here here, all for passing the buck. say AYE.

                                          B Offline
                                          B Offline
                                          Ballpoint Penguin
                                          wrote on last edited by
                                          #50

                                          I'm sorry, but I'm going to have to consult with a few other people before I can say "Aye." Could you please give me your name and phone number, and after I've done some checking I can get back to you? :-D

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups