Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Pre-Purchase Questions/Problems Collapse All
Subject Author Date
James Devlin Sep 4, 2007 - 2:46 PM

Hi,

We are evaluating Prof-UIS MFC for use in an in-house application at my company. I’ve used the free version of Prof-UIS successfully in the past, and am familiar with the process of building the libraries, integrating them with the IDE, and so forth. The issue I am having (which is holding up our evaluation) is that while I’m able to compile and link the Prof-UIS libraries successfully, when I go to run our application with Prof-UIS I get the following error:

"An unhandled exception of type ’System.IO.FileLoadException’ occurred in
Unknown Module. Additional information: Could not load file or assembly ’OurApplicationName,
Version=1.0.2207.30381, Culture=neutral, PublicKeyToken=f456eafc1bd82344’ or
one of its dependencies. Could not find or load a type. (Exception from
HRESULT: 0x80131522)"


I did some research and it turns out that this error relates to a .NET restriction on the number of global fields allowed in an assembly built under /clr (please view the following links for more info):

http://www.thescripts.com/forum/thread445787.html


http://aspalliance.com/groups/microsoft_public_dotnet_languages_vc/ng-1351975_Could_not_load_Assembly.aspx


http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=165750&SiteID=1


http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=137548&SiteID=1


I should mention that our application is a mixed-mode MFC application which has a lot of native code and occasionally we host a managed .NET window using the MFC wrappers. We’re building with /clr, in other words, and it produces the above error - regardless of whether I link to the DLL or static lib version of Prof-UIS.

If I take Prof-UIS out, the error goes away. If I keep Prof-UIS in, but removed the managed code from our projects, compiling everything natively without /clr, everything works fine. It’s only when I both a) have /clr turned on and b) try to use Prof-UIS that I get the error.

So, I believe but am not positive that the Prof-UIS component is triggering this error, as I know it uses a large number of global fields, string literals, and other elements which contribute to the error (please follow the links for details). I was wondering if you guys had any information on this error or, alternately, information about customers who’ve successfully used Prof-UIS in a managed environment.

Again, this issue is preventing me from demonstrating the Prof-UIS library to the people with the authority to make the purchase. Please help me to resolve this issue.

Thanks!
James

Technical Support Sep 5, 2007 - 8:05 AM

If you are going to use a version of Prof-UIS compiled with /clr, the first thing you should do is to invoke the Prof-UIS project options, select the Configuration Properties | C/C++ | Code Generation tree item and specify Yes in the Enable String Pooling property. This should be enough to resolve the problem. But if you are using too large assemblies, you may have to split Prof-UIS into several smaller modules or exclude some features from its build using __EXT_MFC_NO_*** preprocessor symbols defined and commented out at the beginning of the ../Prof-UIS/Include/Prof-UIS.h file. We used Prof-UIS with /clr turned on in a large project and there were no problems with it that there was no need to reduce the functionality or split it. But we came to conclusion that it is much more simple and effective to use a non-/clr version of Prof-UIS in projects like yours. Just use /clr in your EXE and don’t use it in Prof-UIS. Besides, it’s also possible to create EXE projects where Prof-UIS is used but the main UI thread’s message loop is tracked by .NET’s run-time. Please do not hesitate to provide us with any details if you come across any difficulties.