Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline johnnyontheweb  
#1 Posted : 22 September 2021 17:36:55(UTC)
johnnyontheweb


Rank: Member

Groups: Registered
Joined: 15/10/2013(UTC)
Posts: 19

Was thanked: 3 time(s) in 1 post(s)
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:
Quote:
No 'library.XmlSerializers.dll' found in 'MyDocument.exe'.


I can only press ok, and then another message:
Quote:
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

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Davide Carpi  
#2 Posted : 22 September 2021 20:55:34(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,647
Man
Italy
Location: Italy

Was thanked: 1329 time(s) in 875 post(s)
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.

Edited by user 23 September 2021 08:41:42(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline johnnyontheweb  
#3 Posted : 23 September 2021 09:12:22(UTC)
johnnyontheweb


Rank: Member

Groups: Registered
Joined: 15/10/2013(UTC)
Posts: 19

Was thanked: 3 time(s) in 1 post(s)
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.micr...mbly?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.co...r-one-of-its-dependencie)
IMHO the message boxes I get should be removed from code.

Edited by user 23 September 2021 10:56:50(UTC)  | Reason: Not specified

Offline johnnyontheweb  
#4 Posted : 27 October 2022 16:05:16(UTC)
johnnyontheweb


Rank: Member

Groups: Registered
Joined: 15/10/2013(UTC)
Posts: 19

Was thanked: 3 time(s) in 1 post(s)
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,095kb) downloaded 6 time(s).

Edited by user 18 November 2022 17:39:42(UTC)  | Reason: attached sample

Offline johnnyontheweb  
#5 Posted : 19 January 2023 13:05:35(UTC)
johnnyontheweb


Rank: Member

Groups: Registered
Joined: 15/10/2013(UTC)
Posts: 19

Was thanked: 3 time(s) in 1 post(s)
I noticed that the generated .EXE has this code in it (function Resolver):
Quote:
if (text.ToLower().EndsWith(".resources.dll" ))
{
return null;
}


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

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


but only a developer can change this in Smath.

thanks in advance
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.