none
How to ignore some exception in Visual Studio 2019 new version RRS feed

  • Question

  • Hello:
    I have some C# .net code using Puppeteer, most of the time, it works well.  But sometimes, I see some errors, like the following:
    PuppeteerSharp.PuppeteerException
      HResult=0x80131500
      Message=Protocol error (Runtime.callFunctionOn): Session closed. Most likely the Page has been closed.Close reason: Target.detachedFromTarget
    As I just want to ignore this kind of error, so I write some code like this:

    try
    {
    do something in C#
    }
    catch (PuppeteerException ex)
    {
    Console.Write(ex.Message);
    }
    My code worked before when I used VS 2019 Version 16.1; 16.2; but now, I am using VS 2019 Version 16.3.2
    The above code simply not working in Debug mode, the program always stops at the catch statement.
    I want to setup the exception setting to continue in this case, but failed.
    I searched around, most of the articles about this issue seem just tell me how to break on this case, which is rather 
    narrow-minded, I just want to continue as this kind of error is not important.
    Please advice on how to change the Exception Settings in Visual Studio 2019 Version 16.3.2 to continue when the exception is handled by user.  Not to break at all!
    Thanks,

    Friday, October 4, 2019 11:17 PM

Answers

  • Hello:

    I seemed to find one solution, as the exception happened again, I un-check break on this type of exception, so my program can continue.  VS 2019 version 16.3.2 seems to remember what I did with the exception settings, so until now, it didn't break again at the same point.

    But I still think VS 2019 the newest version needs better documents on how to handle this kind of situation, not let the developers to guess what could happen.

    Sunday, October 6, 2019 5:22 AM

All replies

  • Visual Stuido has nothing to do with the exception that the .NET framework is throwing. All VS is doing is catching the exception that .NET is throwing. 

    Maybe in VS, you don't run the program in debug mode.

    I searched around, most of the articles about this issue seem just tell me how to break on this case, which is rather 
    narrow-minded, I just want to continue as this kind of error is not important.

    ??????? It seems that you have some kind of 3rd party tool program that you need to be talking to the 3rd party vendor about as to why it's throwing exceptions.

    Friday, October 4, 2019 11:33 PM
  • Report this under the following issue page since this is a third party repo and not part of C#. You can also use the "feedback" button at the top of the IDE if so desire to indicate change in behavior.

    https://github.com/kblok/puppeteer-sharp/issues


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Friday, October 4, 2019 11:41 PM
    Moderator
  • Hello:

    If you read my description carefully, I said: for Visual Studio 2019 Version 16.1 and 16.2, my code worked, so I can continue to run the program without breaking on the break-points.  But now, as I am using Visual Studio 2019 Version 16.3.2, my program can't continue, it always stops.

    If you have used VS 2019 Version 16.3.2, you should know that VS 2019 Version 16.3.2 adds tons of compiler warnings, errors.  I think this has some kind of relation with my issues.

    Thanks

    Saturday, October 5, 2019 6:48 AM
  • f you read my description carefully, I said: for Visual Studio 2019 Version 16.1 and 16.2, my code worked, so I can continue to run the program without breaking on the break-points.  But now, as I am using Visual Studio 2019 Version 16.3.2, my program can't continue, it always stops.

    This is inexperience talking here. Just becuase you went to a newer version of VS doesn't mean that the .NET Framework has not been updated or patched as well. Again, VS doesn't throw exceptions. .NET throws the exception, becuase of a program error.

    If you have used VS 2019 Version 16.3.2, you should know that VS 2019 Version 16.3.2 adds tons of compiler warnings, errors.  I think this has some kind of relation with my issues.

    Compiler warnings can be related to components your program is using, like a 3rd party DLL is out dated and no longer is fully compatible with the .NET Framework. Waning messages means you are being warned and there could potential problems with the program that could lead to compile errors eventually. 

    Again, this is a 3rd party vendor issue with the 3rd party component you are talking about, which means talk to the vendor.


    • Edited by DA924x Saturday, October 5, 2019 7:14 AM
    Saturday, October 5, 2019 7:14 AM
  • You are referring to 'First Chance Exceptions'?
    https://devblogs.microsoft.com/devops/understanding-exceptions-while-debugging-with-visual-studio/
    If this is really a break on 'First Chance Exception', maybe there was a change in the default settings of 'Exception Settings (Debug->Windows->Exception Settings).
    Does (New) 'Exception Dialog' / 'Exception Assistant' give a clue?
    (Not working with VS 2019 yet - in VS 2017 'Debug->Options...' 'Debugging->General' 'Use the new Exception Helper' had to be checked).
    That most of the articles about this issue are about how to enable a break is quite normal - for this is a debugger feature, allowing to narrow down the position, where an exception was thrown.
    Debuggers normally do/should not break for 'every kind' of 'First Time Exception', unless told to do so.

    With kind regards

    Saturday, October 5, 2019 10:49 AM
  • Hello:

    I seemed to find one solution, as the exception happened again, I un-check break on this type of exception, so my program can continue.  VS 2019 version 16.3.2 seems to remember what I did with the exception settings, so until now, it didn't break again at the same point.

    But I still think VS 2019 the newest version needs better documents on how to handle this kind of situation, not let the developers to guess what could happen.

    Sunday, October 6, 2019 5:22 AM
  • Hello:

    I seemed to find one solution, as the exception happened again, I un-check break on this type of exception, so my program can continue.  VS 2019 version 16.3.2 seems to remember what I did with the exception settings, so until now, it didn't break again at the same point.

    But I still think VS 2019 the newest version needs better documents on how to handle this kind of situation, not let the developers to guess what could happen.

    https://docs.microsoft.com/en-us/visualstudio/debugger/managing-exceptions-with-the-debugger?view=vs-2019
    Sunday, October 6, 2019 5:29 AM