Type is marked as eligible but is not marked as public.

LulzyLulzy Posts: 4
edited November 22, 2010 9:52AM in SmartAssembly 5
Stack trace:
System.TypeLoadException
Could not load type '.„' from assembly 'MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=37ff7609970e6758'. The type is marked as eligible for type equivalence, but it is not marked as public.

at ..™(Object , EventArgs )
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


This always happened before a certain timer is enabled. (from another timer in the same form)
First timer is to wait before execution of next timer, in other words not much stuff here. Second timer (to-be-executed from first) loads stuff from a HTML webpage.

I have tested the program before SmartAssembly-ing it, it works fine.


Help please? I'm using trial version by the way.

Comments

  • Are you using the InternalsVisibleTo("...") attribute at all? If so, you have to be careful when obfuscating since this will potentially break the app. The solution will be to exclude the methods that have been marked with this attribute (you should have got a warning about this upon building in smartassembly (in yellow, italic font)).

    If not, I'll need to scratch my head a bit more ....
  • Hi, thanks for your reply.

    Nope, I'm not using InternalsVisibleTo() at all. And I do have a warning after building it but in orange italic font.

    At least one dependency does not have a strong name. As your assembly has been signed with a strong name, it may fail to load this dependency.

    None of my embedded dependencies load at the point of time when the error occur.
  • the head scratching commences...
  • We're going to have to trouble-shoot this process the long way- take off the smartassembly features, one-by-one, until the application works as usual. Then try to isolate the exact feature that causes the issue. This will help us narrow down what is actually happening.
  • Alright, I tried that and my program works fine if I don't have code obfuscation on..
  • I have a feeling this is related to reflection then. Are any of the obfuscated methods being called by reflection? Are any of the obfuscated classes serializable? You'll need to exclude from obfuscation either of these.
Sign In or Register to comment.