Error in generating exe and using plugin

Error in generating exe and using plugin - Error in generating exe and using plugin in sheet - Сообщения

#1 Опубликовано: 22.09.2021 11:36:55
johnnyontheweb

johnnyontheweb

3 сообщений из 26 понравились пользователям.

Группа: Moderator

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:
Цитата

No 'library.XmlSerializers.dll' found in 'MyDocument.exe'.



I can only press ok, and then another message:
Цитата

Unhandled 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 Опубликовано: 22.09.2021 14:55:34
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: Moderator

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 Опубликовано: 23.09.2021 03:12:22
johnnyontheweb

johnnyontheweb

3 сообщений из 26 понравились пользователям.

Группа: Moderator

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.
#4 Опубликовано: 27.10.2022 10:05:16
johnnyontheweb

johnnyontheweb

3 сообщений из 26 понравились пользователям.

Группа: Moderator

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 МиБ) скачан 23 раз(а).
#5 Опубликовано: 19.01.2023 07:05:35
johnnyontheweb

johnnyontheweb

3 сообщений из 26 понравились пользователям.

Группа: Moderator

I noticed that the generated .EXE has this code in it (function Resolver):
Цитата

if (text.ToLower().EndsWith(".resources.dll" ))
{
return null;
}



This is to discard resource DLLs. Similarly for my problem there should be also:

Цитата

if (text.ToLower().EndsWith(".xmlserializers.dll" ))
{
return null;
}



but only a developer can change this in Smath.

thanks in advance
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений