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. General Programming
  3. C#
  4. Can VS2005 catch exceptions in external dll-s?

Can VS2005 catch exceptions in external dll-s?

Scheduled Pinned Locked Moved C#
visual-studiodebuggingquestion
1 Posts 1 Posters 0 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.
  • D Offline
    D Offline
    Dragan Matic
    wrote on last edited by
    #1

    If I do something like this: int i = Convert.ToInt32("asdfas"); without the try/catch block and start a program with the above line in VS2005, the IDE will catch the exception, show the appropriate message and position to the problematic line. On the other hand, if I have an assembly that is loaded at run-time, for instance like this: a = Assembly.Load(strAssembly); Type ObjectType = a.GetType(strClass); object obj = Activator.CreateInstance(ObjectType); MethodInfo mi = ObjectType.GetMethod("SomeMethod", pars); mi.Invoke(obj, null); and there is an unhandled exception somewhere in the assembly, VS2005 will not catch that exception (even if assembly is compiled as DEBUG and can be debugged into) but instead 'mi.Invoke' will exit with generic exception 'exception has been thrown by the target of the invocation'. Is there a way for VS2005 to catch these exceptions and position to problematic line like it does with non run-time loaded assemblies? Dragan Matic

    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