FerroCoder
Member
- Joined
- Jul 20, 2023
- Messages
- 18
- Programming Experience
- 10+
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:
0
The wrapper classes are partially defined as:
(Yeah, I'm carrying MFC habits into C#.)
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.
FC
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:
C#:
class CPauseClass
{
CPause m_pPause = new CPause( true );
CTask m_tMyTask = null;
...
} // CPauseClass
class CDCBiasClass
{
CDCBias m_dcDCBias= new CDCBias( true );
CTask m_tMyTask = null;
...
} // CDCBiasClass
class CHysteresisClass
CHysteresis m_hHysteresis = new CHysteresis( true );
CTask m_tMyTask = null;
...
} // CHysteresisClass
(Yeah, I'm carrying MFC habits into C#.)
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.
FC