1 Pages (5 items)
Error in generating exe and using plugin - Error in generating exe and using plugin in sheet - Messages
#1 Posted: 9/22/2021 11:36:55 AM
Hello all,
I successfully wrote a plugin for SMath Studio, that uses a "library.dll" which is loaded on-the-fly during execution (BTW, with System.Reflection.Assembly.LoadFrom).
All fine, except when I save the sheet in .EXE format. Starting the .exe, a window claiming:
I can only press ok, and then another message:
I press ok again and then, finally, the window is shown, and everything inside works perfectly.
The file 'library.XmlSerializers.dll' does not exist and it is not generated during building. To be sure it is never generated, I set up the proper flag in Visual Studio in the original "library" project.
I'm using v.0.99.
Can anyone help on this? I suspect this is a bug that affects SMath Studio .exe generation and related only to XmlSerializers.
thanks in advance
I successfully wrote a plugin for SMath Studio, that uses a "library.dll" which is loaded on-the-fly during execution (BTW, with System.Reflection.Assembly.LoadFrom).
All fine, except when I save the sheet in .EXE format. Starting the .exe, a window claiming:
QuoteNo 'library.XmlSerializers.dll' found in 'MyDocument.exe'.
I can only press ok, and then another message:
QuoteUnhandled exception while loading: 'library.XmlSerializers.dll'.
I press ok again and then, finally, the window is shown, and everything inside works perfectly.
The file 'library.XmlSerializers.dll' does not exist and it is not generated during building. To be sure it is never generated, I set up the proper flag in Visual Studio in the original "library" project.
I'm using v.0.99.
Can anyone help on this? I suspect this is a bug that affects SMath Studio .exe generation and related only to XmlSerializers.
thanks in advance
#2 Posted: 9/22/2021 2:55:34 PM
It might be a nested dependancy of library.dll as it seems from the error message? library.xmlserializers.dll seems to me a custom library made for the dll you are using. If it is the case, you have to create/copy the 2nd library on compiling and declare the plugin dependancy, even if that library is not relevant for what you wrap in SMath Studio (this is because how the Net framework loads the libraries). If you have access to the sources of library.dll you might consider to get rid of anything related to that library and compile a custom one without ties to it.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Posted: 9/23/2021 3:12:22 AM
Thanks for the reply. This is exactly the point, library.dll has no ties with library.XmlSeriazers.dll: XmlSerializers are automatically generated by .NET framework to speed-up execution, but they don't appears in dependencies.
In addition, as I said I already configured the build of library.dll to get rid of any other dependencies and to NOT generate XmlSeriazer dll (see https://social.msdn.microsoft.com/Forums/en-US/5d5ff712-abac-4b37-b718-7ce19fc0f228/generate-serialization-assembly?forum=netfxremoting).
The command "Preview in SMath viewer" is not affected by this issue, hence I suspect there's something in saving .exe.
EDIT: seeing the .exe generated by SMath in ILSpy to look for dependencies, library.dll and library.XmlSeriazers.dll are not listed. But I noticed the flag "compressAssemblies" - is there an internal list of assemblies to be put together in the .exe?
EDIT2: after a deeper search over the internet, it seems a normal behaviour of .NET framework (see https://stackoverflow.com/questions/21559983/could-not-load-file-or-assembly-myapp-xmlserializers-or-one-of-its-dependencie)
IMHO the message boxes I get should be removed from code.
In addition, as I said I already configured the build of library.dll to get rid of any other dependencies and to NOT generate XmlSeriazer dll (see https://social.msdn.microsoft.com/Forums/en-US/5d5ff712-abac-4b37-b718-7ce19fc0f228/generate-serialization-assembly?forum=netfxremoting).
The command "Preview in SMath viewer" is not affected by this issue, hence I suspect there's something in saving .exe.
EDIT: seeing the .exe generated by SMath in ILSpy to look for dependencies, library.dll and library.XmlSeriazers.dll are not listed. But I noticed the flag "compressAssemblies" - is there an internal list of assemblies to be put together in the .exe?
EDIT2: after a deeper search over the internet, it seems a normal behaviour of .NET framework (see https://stackoverflow.com/questions/21559983/could-not-load-file-or-assembly-myapp-xmlserializers-or-one-of-its-dependencie)
IMHO the message boxes I get should be removed from code.
#4 Posted: 10/27/2022 10:05:16 AM
Anyone?
This is a really annoying problem when saving to .exe. It would be sufficient to take out the warning messages.
Warning message boxes should be avoided directly from Smath code. See attached sample (NextFEM Designer should be installed to see errors, look at the pictures in zip otherwise): errorsSmathExe.zip (1 MiB) downloaded 21 time(s).
This is a really annoying problem when saving to .exe. It would be sufficient to take out the warning messages.
Warning message boxes should be avoided directly from Smath code. See attached sample (NextFEM Designer should be installed to see errors, look at the pictures in zip otherwise): errorsSmathExe.zip (1 MiB) downloaded 21 time(s).
#5 Posted: 1/19/2023 7:05:35 AM
I noticed that the generated .EXE has this code in it (function Resolver):
This is to discard resource DLLs. Similarly for my problem there should be also:
but only a developer can change this in Smath.
thanks in advance
Quoteif (text.ToLower().EndsWith(".resources.dll" ))
{
return null;
}
This is to discard resource DLLs. Similarly for my problem there should be also:
Quoteif (text.ToLower().EndsWith(".xmlserializers.dll" ))
{
return null;
}
but only a developer can change this in Smath.
thanks in advance
1 Pages (5 items)
-
New Posts
-
No New Posts