-
July 19th, 2023, 01:49 PM
#1
[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:

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:

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
-
July 20th, 2023, 05:36 PM
#2
Re: System.IO.FileNotFoundException
I have resolved this issue using advise from another forum. Thanks to all who have considered this.
FF
-
July 21st, 2023, 12:59 AM
#3
Re: System.IO.FileNotFoundException
 Originally Posted by FerroFun
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
-
July 31st, 2023, 05:35 PM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|