A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

Answered A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

  • Monday, January 03, 2011 8:13 AM
     
     

    Hi,

    I have a solution with several C# (WPF) projects created in Visual Studio 2010 under Windows XP SP3.

    When I launch my application get the following exception:

    A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
    A first chance exception of type 'System.IO.FileNotFoundException' occurred in PresentationFramework.dll
    A first chance exception of type 'System.Xaml.XamlObjectWriterException' occurred in System.Xaml.dll
    A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll

    Additional information: 'Set property 'System.Windows.ResourceDictionary.Source' threw an exception.' Line number '8' and line position '18'.

    The exception appears in my application xaml (App.xaml) when I add a resource dictionary located at a different project (CommonRes) of the same solution.

    <Application x:Class="S80.App"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 StartupUri="MainWindow.xaml">
        <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="pack://application:,,,/CommonRes;component/Dictionary1.xaml" />
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
        </Application.Resources>
    </Application>

    If I remove the ResourceDictionary.Source the exception dissapears.

    Even if the Dictionary1.xaml is empty get the same exception.

    Dictionary1.xaml:

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
       
    </ResourceDictionary>

     

    any ideas?

    Thanks,

All Replies

  • Monday, January 03, 2011 8:32 PM
     
     
    Did you add a reference to the project that contains the dictionary?
  • Wednesday, January 05, 2011 8:30 AM
     
     Answered

    Hi,

     

    I resolved the error creating my main project again, and then adding the classes. That is, the same code but with a new project ???.

    I suppose something of the project was corrupted. My solution is under file-level version control (Visual Source Safe), so Visual Sourcesafe may be the responsible.

     

    Thanks,

     

  • Wednesday, January 05, 2011 8:42 AM
    Moderator
     
     

    Hi Demogorgo,

    Sorry for jumping in.

    I'm glad it is resolved and it might be caused by configuration file lost or project references corrupt when checking out.

    If you meet this issue again, be free to post a thread at VSS forum:

    http://social.msdn.microsoft.com/Forums/en/vssourcecontrol/threads

    Thanks for sharing.

     

    Best Regards,

    Ziwei Chen

     

     


    Ziwei Chen [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Wednesday, January 05, 2011 8:43 AM
    Moderator
     
     

    Hi Demogorgo,

    Sorry for jumping in.

    I'm glad it is resolved and it might be caused by configuration file lost or project references corrupt when checking out.

    If you meet this issue again, be free to post a thread at VSS forum:

    http://social.msdn.microsoft.com/Forums/en/vssourcecontrol/threads

    Thanks for sharing.

     

    Best Regards,

    Ziwei Chen

     

     


    Ziwei Chen [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.