Could not load type 'System.Windows.Forms.AxHost/State'

.NET obfuscator and automated error reporting

Could not load type 'System.Windows.Forms.AxHost/State'

Postby PawelP » Thu Jan 05, 2012 11:30 am

I have a windows forms application, which is using internet browser imported as ActiveX Control into C# (from c:\\windows\\system32\\shdocvw.dll).
Method InitializeComponent() initializes browser as follows:
Code: Select all
    this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser();

    // axWebBrowser1
    this.axWebBrowser1.Enabled = true;
    this.axWebBrowser1.Location = new System.Drawing.Point(0, 33);
    this.axWebBrowser1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.OcxState")));
    this.axWebBrowser1.Size = new System.Drawing.Size(478, 420);
    this.axWebBrowser1.TabIndex = 4;

After obfuscating this code with verion 6.5 of {Smart Assembly} and running apllication I get following error:
System.TypeLoadException: Could not load type 'System.Windows.Forms.AxHost/State' from assembly 'System.Windows.Forms, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError)
at System.Resources.ResourceReader.FindType(Int32 typeIndex)
at System.Resources.ResourceReader.DeserializeObject(Int32 typeIndex)
at System.Resources.ResourceReader.LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode)
at System.Resources.ResourceReader.LoadObject(Int32 pos, ResourceTypeCode& typeCode)
at System.Resources.RuntimeResourceSet.GetObject(String key, Boolean ignoreCase, Boolean isString)
at System.Resources.RuntimeResourceSet.GetObject(String key, Boolean ignoreCase)
at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture, Boolean wrapUnmanagedMemStream)
at System.Resources.ResourceManager.GetObject(String name)
at MyApp.MyWindow.()

This is happening since upgrade from version 6.0 to 6.5. Is this connected with no more support for .NET framework 1.1?
Posts: 3
Joined: Thu Jan 05, 2012 10:57 am
Location: Poland

Postby Brian Donahue » Thu Jan 05, 2012 4:11 pm

It's definitely nothing to do with .NET Framework 1.1. It has something to do with SmartAssembly 6.5 making changes to the built-in resource reader so the state of the ActiveX object can't be accessed. This is logged as a bug with our internal reference of SA-1316.

In the meantime I'd suggest rolling back to SA v6.2 if you can.
Brian Donahue
Posts: 6590
Joined: Mon Aug 23, 2004 9:48 am

Same Issue

Postby Nameless301 » Wed Feb 27, 2013 7:02 pm

I Have this same issue, we've automated our build and when I revert to 6.2 I get the error
SmartAssembly build failed: The type initializer for 'SmartAssembly.ConsoleApp' threw an exception.
Posts: 1
Joined: Wed Feb 27, 2013 5:13 pm
Location: United States

Return to SmartAssembly 6

Who is online

Users browsing this forum: No registered users and 0 guests