CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2008
    Posts
    29

    [RESOLVED] System.IO.FileNotFoundException

    There is a lot of information about this exception, but I haven't been able to find a solution.

    Background: I am a long-time C++/MFC developer, relatively new to C#/.NET. I am in the very early stages of redeveloping a very large (2+ MLines) C++/MFC program under C#/.NET 6.0. The prototype has been going well until I recently added a namespace/class. Now, on program startup I get the error of the first figure:

    Name:  System.IO.FileNotFoundException.jpg
Views: 365
Size:  24.9 KB

    CPauseClass, CDCBiasClass and CHysteresisClass are wrapper classes around CPause, CDCBias, and CHysteresis classes defined in namespaces IPause, IDCBias and IHysteresis, respectively. The class hierarchy is shown in the second figure:

    Name:  Class Hierarchy.jpg
Views: 363
Size:  28.4 KB

    The wrapper classes are partially defined as:

    Code:
    class CPauseClass
    {
    
    	CPause m_pPause = new CPause(  true );
    	CTask m_tMyTask = null;
    
    ...
    }  // CPauseClass
    
    
    class CDCBiasClass
    {
    
    	CDCBias m_pDCBias= new CDCBias(  true );
    	CTask m_tMyTask = null;
    
    ...
    }  // CDCBiasClass
    
    
    class CHysteresisClass
    
    	CHysteresis m_pHysteresis = new CHysteresis(  true );
    	CTask m_tMyTask = null;
    
    ...
    }  // CHysteresisClass
    The exception is thrown when CHysteresisClass includes the declaration for m_pHysteresis, even though the exception itself appears in the declaration of m_pMyHysteresis as in the first figure.

    Clearly a file associated with IMeasurement is not being found. No exception is thrown for ITask or IHardware. I can find no substantive difference in the IHardware and IMeasurement project properties. Both projects output equivalent files. Reference to IHardware is not throwing an exception.

    Project dependencies are properly set.

    Questions:

    - Is there a way to trap this exception? I cannot use a try/catch block since the exception is occurring on member declaration, not in procedural code.
    - Is there a way to determine which file is not being found without trapping the exception? I have copied IMeasurement.dll to the program executable folder. This didn't help
    - C# does not seem to offer path settings for included dependencies. Is there a way to expand the search path that the executable is using?
    - Is a null PublicKeyToken a problem?
    - Can anyone offer any other suggestions?

    Thanks in advance for any help that you can offer.

    FF

  2. #2
    Join Date
    Feb 2008
    Posts
    29

    Re: System.IO.FileNotFoundException

    I have resolved this issue using advise from another forum. Thanks to all who have considered this.

    FF

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,367

    Re: System.IO.FileNotFoundException

    Quote Originally Posted by FerroFun View Post
    I have resolved this issue using advise from another forum. Thanks to all who have considered this.

    FF
    Wouldn't you like to share the solution?
    Victor Nijegorodov

  4. #4
    Join Date
    Feb 2008
    Posts
    29

    Re: [RESOLVED] System.IO.FileNotFoundException

    Sorry about the late reply to the request. In the main executable project I manually added a reference to the IMeasurement namespace DLL.

    Thanks again...

    FF

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured