Main Site Documentation

Panda II - Assembly.Load


#1

Hi there,

I posted a message few weeks ago about using Assembly.Load to load an external assembly from my SD card.

Nothing is working. In the standard .NET we have Assembly.LoadFrom() which loads an assembly with the given path. In .NET MF I only have Assembly.Load(), so i use it with File.ReadAllBytes.

My Code is

Assembly.Load(File.ReadAllBytes("\\SD\\myAssembly.dll));

and it just doesn’t work.

All I get from Assembly.load is null. No exception whatsoever.

Has anyone achieve that on Panda II with an assembly on the SD card ? how did you get it working ?

Thanks, any help is appreciated,


#2

Pyxis OS does a lot of dynamic loading I believe http://skewworks.com/


#3

Yep, I’ve already looked at pyxis 2 source code, and all I found in it is the same Assembly.Load on File.ReadAllBytes, the same code as mine, I don’t see what I’m missing.

I’m thinking maybe the assembly I’m trying to load isn’t well built ? It’s a class library application, maybe I need to set some specific settings in it ?

I don’t understand why I don’t get an Exception if something is wrong.
Is this functionality even supported on Panda II ?


#4

I do not think Panda has less feature in that area but it has less RAM to have assembles in RAM.


#5

So, is the problem from my Panda II ? You think if I try this on anoter card it will work ? Or do you think the problem is from my code ?


#6

Check the size of the generated PE file. Match that against available RAM of Panda II.


#7

[quote]My Code is
Assembly.Load(File.ReadAllBytes("\SD\myAssembly.dll));[/quote]

might be a stupid question but, are you trying to load the assemblies from the .dll file? you should use the .pe file, i dont have a Panda yet, i have a Domino and:


var a = Assembly.Load(File.ReadAllBytes(@ "\SD\data\classlibtest.dll")); // <- a is null
var b = Assembly.Load(File.ReadAllBytes(@ "\SD\data\classlibtest.pe")); // <- b contains my assemblies

works for me.


#8

Oh man thx, I’ll try it first thing tomorow but I’m quite sure that’s my problem. How could I be so stupid.
I’ll let you know as soon as I try.

Thanks you all !!!


#9

Doh! That would be a problem :wink:
Don’t worry we all make oversights like that…be sure to use the pe from the LE folder too…not that I ever used the wrong one :whistle:


#10

And it finaly works.

Thanks everyone for your help. Hope some day I can make it up to you.


#11

Yay! Happy coding :slight_smile: