Why is .NET exception not caught by try/catch block?

前端 未结 25 807
Happy的楠姐
Happy的楠姐 2020-12-04 19:24

I\'m working on a project using the ANTLR parser library for C#. I\'ve built a grammar to parse some text and it works well. However, when the parser comes across an illeg

25条回答
  •  余生分开走
    2020-12-04 19:54

    Are you using .Net 1.0 or 1.1? If so then catch(Exception ex) won't catch exceptions from unmanaged code. You'll need to use catch {} instead. See this article for further details:

    http://www.netfxharmonics.com/2005/10/net-20-trycatch-and-trycatchexception/

提交回复
热议问题