RuntimeHost.Initialize() vs. Initialize(Stream)

67 views
Skip to first unread message

RFuente

unread,
Dec 31, 2013, 4:10:08 AM12/31/13
to ssh...@googlegroups.com
Hi Petro.

I'm studying the posibilites of loading a custom configuration (RuntimeConfig.xml) and have noticed something it could be improved. Suppose we have a very simple script:

Console.WriteLine('Hello world!');
return 'Ok';

If we initialize using RuntimeHost.Initialize(); everything works as expected.
If we initialize using RuntimeHost.Initialize(new FileStream(...)) reading a RuntimeConfig.xml in which we have added one custom Assembly, and the path to the DLL is incorrect, the initialization process must fails at some point because we get this error: Namespace 'Console' is not found.

I have searched through the code up to BaseAssemblyManager.LoadAssemblies(). Method Assembly.Load() produces an exception (because the file is not found) which is caught at RuntimeHost.Initialize() try-finally block, thus not fulfilling the initialization process.

In the same way you check for duplicates before adding an assembly, maybe a simple if System.IO.File.Exists could be added before reference.Load(). What do you think?

Thank you very much for this awesome work!

Petro Protsyk

unread,
Jan 3, 2014, 7:03:16 AM1/3/14
to ssh...@googlegroups.com
Thanks for suggestion. I will take a look


2013/12/31 RFuente <fuente...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "SSharp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ssharp+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages