Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

No source available

Back to Forum: Tech Off
  • User profile image

    I'm making a WPF application in Visual C# 2010 Express and I'm getting that awful "No source available" window whenever an exception occurs, rather than the debugger just showing me the actual line where the exception occurred. This has made it impossible to debug my code.


    It happens with all WPF applications now. If I just create a new WPF application and make some sort of exception happen (by simply calling string.Format("{0}") in the constructor, for instance, I get that damned window and nothing else. It doesn't happen when I try a console or winforms application.


    Has anyone else seen this happen too, and have you found a fix? Google reveals nothing useful.



  • User profile image

    I just noticed that if I generate the exception anywhere other than in the MainWindow constructor, behaviour is as expected. Now I'm starting to doubt myself. Has this always been the case?

  • User profile image

    @Bas:WPF by default needs a parameterless constructor, and depending on the issue you sometimes get helpful information but sometimes you do not.


    String.Format is available as an overloaded binding parameter so you can do something like DataContext="{Binding Path=BasLightbulbs, String.Format={} It finds {0} lightbulbs}" so there never is usually a need to do it in the code behind.


    Of all the things Visual Studio is good at, reasoning about XML syntax issues is still very poor. I have just spent a couple of days finding a hard to debug issue with third party components. Also make sure to look in the output window in visual studio as any binding issues are sure to show up there. In general always try to ensure that your control or whatever is visible in the xaml as you write code, as this will reduce the time you waste compiling and debugging.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.