Is it possible to build custom mscorlib.dll without any use of native code (pinvoke allowed :-)?
I've tried a little experiment this weekend to see how hard it would be to do it and had following problems:
- I've added one class System.Static to my version of mscorlib but had TypeLoadException with message that it can't load type 'System.Static`1' from 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. So it seems that somehow it's still loading MS library. How to avoid that (I'm using /nostdlib switch already)?.
- When I named my mscorlib 'mycorlib' I had errors that System.Object must have a parent class
- If I have generic type T and I'm doing
new T()
it's translated by c# compilator toActivator.CrateInstance<T>()
which in MS implementation callsRuntimeTypeHandle.CreateInstance(...)
which is native method. Can I call it from my mscorlib or is it included in mscorlib provided by MS?
My goal was to test the possibility of writing my versions of int, double, string and other standard types. I want to use MS CLR, but just provide my managed code classes.
Is it possible?