Assembly download with fez spider

Hello,

I’m trying to donwload an assembly of 102 KB with to fez spider, i conclude that this is to big for gadgeteer becuase it hangs. is this true. Does gadgeteer limits the amount of data to downlaod ?

I tried it with a smaller assembly of 5KB and it downloaded this very fast.

thnx

Do you have anything suspicious in the output window?

@ Architect no nothing suspicious. :frowning:

Using mainboard GHI Electronics FEZSpider version 1.0
00:07:31.532 : Network interface 0: 192.168.2.48 / 192.168.2.1 / 002103000001
00:07:31.686 : Network interface 1: 0.0.0.0 / 0.0.0.0 / 002103000002
00:07:31.839 : Network interface 2: 0.0.0.0 / 0.0.0.0 / 002103000003
00:07:31.852 : Start preload of loader assembly
00:07:31.866 : Downloading assembly TriniT.Klm.Loader.bin
The debugging target runtime is loading the application assemblies and starting execution.
00:07:32.303 : Loading assembly TriniT.Klm.Loader.bin from 3084 bytes
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘TriniT.Klm.Loader’
Assembly: TriniT.Klm.Loader (1.0.0.0) 00:07:32.898 : Creating object
00:07:32.923 : Executing Loader…
00:07:32.938 : Loading config from http://192.168.2.85/KLM/Program/config.txt
00:07:33.337 : Assemblies from URL: http://192.168.2.85/KLM/Program/assemblies.txt
00:07:33.351 : Loading assembly config
00:07:33.779 : Loading assembly from http://192.168.2.85/KLM/Program/TriniT.Klm.Program.Interface.bin
00:07:33.796 : Downloading assembly TriniT.Klm.Program.Interface.bin
Download from http://192.168.2.85/KLM/Program/TriniT.Klm.Program.Interface.bin
The debugging target runtime is loading the application assemblies and starting execution.
00:07:34.887 : Loading assembly TriniT.Klm.Program.Interface.bin from 105368 bytes

then it stops here

I chekcked my code again and is not the webclient.

I’ve found that the problem lies with the Assembly.Load here it hangs, and doesn’t return

this is the code i use to download the Assembly

        private static Assembly DownloadAndLoadAssembly(string url)
        {
            int index = url.LastIndexOf("/");
            String assembly = url.Substring(index + 1);
            assembly = assembly.Trim();

            if (assembly != String.Empty && assembly != null)
            {
                ServerUtility.DoDebug("Downloading assembly " + assembly);
                int assemblySize;
                Debug.Print("Download from " + url);
                byte[] assmbytes = ServerUtility.GetHttpBytes(url, out assemblySize);
                ServerUtility.DoDebug("Loading assembly " + assembly + " from " + assemblySize + " bytes");
                Assembly assm = Assembly.Load(assmbytes);
                ServerUtility.DoDebug("Assembly " + assembly + " loaded");
                if (assm == null)
                {
                    throw new Exception("Assembly null; invalid data downloaded from " + url + " ?");
                }
                return assm;
            }
            return null;
        }

I tested it in the emulator and it worked fine. I was wondering if it got something to do with memory.

Just to make sure. Is your assembly that you are trying to load is build with the same SDK and .Net version as your loader application on the Spider?

@ Architect, Yes it is. I tested it with the emulator and it worked fine.

Just an idea. Run GC before you load the assembly and take a note of the available memory.

I’ve found out while debugging if you pause and then click again on debugging. the assembly loads perfectly and the program continues.
I accidentally discovered this strange huh. Anyone had this issue before?

Sounds like some sort of racing issue. Do you have any threads running?

i use Thread.Sleep() in one of my functions.

I have same problem. If I load assembly in runtime, degugger freezes. I had to set breakpoint anywhere in project, and it’s starts again.

hello,
are you sure you are loading the .PE version of the assembly? remember you cannot load the dll file you must copy the .pe file and upload it to your server.

check out the WIKI here:


Next Double click on bin/Debug/le folder (le stands for little Endian) DO NOT Copy the file in bin/debug/be folder. that's (big Endian) image. 
Now you should see a file called TestPlugin1.pe (If you can't see the file extension please turn them on. google on how to do it.) 
Next Copy the TestPlugin1.pe file from "le" folder to the root of your SDCARD. This is the only file you will need and NOT THE .DLL or any other file. 

cheers;

I dont know about Don, but i do load pe, dont have sleep on thread, and still have problem. But workaround is delete and set breakpoint, for my case, i can live with that.