How to properly stop script execution

How to properly stop script execution

maxyweb
Contributor Contributor
1,095 Views
9 Replies
Message 1 of 10

How to properly stop script execution

maxyweb
Contributor
Contributor

Hi everyone!
How to properly stop script execution and unload dll from memory.
Something like

if killer == true then
   (
      exit from script
      unload dll from memory
   )

 

dll - WPF interface

 

0 Likes
1,096 Views
9 Replies
Replies (9)
Message 2 of 10

denisT.MaxDoctor
Advisor
Advisor

Firstly, how was the DLL loaded? ... not every DLL can be unloaded just like that.
Secondly, what is this DLL that needs to be unloaded?

0 Likes
Message 3 of 10

maxyweb
Contributor
Contributor

@denisT.MaxDoctor  написал (-а):

Firstly, how was the DLL loaded?

 

 

dotNet.loadAssembly interface.dll

 

 

@denisT.MaxDoctor  написал (-а):

Secondly, what is this DLL that needs to be unloaded?


WPF interface (Several windows and several functions)
 
The script can be run many times during a session
and it feels like it runs slower each time, eventually crashing

 

0 Likes
Message 4 of 10

denisT.MaxDoctor
Advisor
Advisor

instead of loading assembly by path use 

Assembly.Load(File.ReadAllBytes(filePath));

then .NET should take care of the garbage collection itself

 

I'm pretty sure it's not the loaded UI that you need to care about, but some of the data and resources that were loaded with the tool.

0 Likes
Message 5 of 10

Ken_GordonQRB22
Participant
Participant

@denisT.MaxDoctor  написал (-а):

instead of loading assembly by path use 

Assembly.Load(File.ReadAllBytes(filePath));

Not working

Unknown property: "load" in undefined

filePath - tried several different path 😕

0 Likes
Message 6 of 10

denisT.MaxDoctor
Advisor
Advisor

@Ken_GordonQRB22 wrote:

@denisT.MaxDoctor  написал (-а):

instead of loading assembly by path use 

Assembly.Load(File.ReadAllBytes(filePath));

Not working

Unknown property: "load" in undefined

filePath - tried several different path 😕


Are you familiar with .NET and C#?

0 Likes
Message 7 of 10

Ken_GordonQRB22
Participant
Participant

@denisT.MaxDoctor  написал (-а):


Are you familiar with .NET and C#?


At a very low level. I'm starting to try

0 Likes
Message 8 of 10

denisT.MaxDoctor
Advisor
Advisor

Where did you get the DLL you are using? I figured you wrote it.

0 Likes
Message 9 of 10

Ken_GordonQRB22
Participant
Participant

I wrote it

0 Likes
Message 10 of 10

denisT.MaxDoctor
Advisor
Advisor

how did you write the dll if you don't know c# and .NET? 

 

Well... if you want, you can post the DLL code. I'll take a look and maybe find memory leak problems and recommend ways to fix them.

0 Likes