Options

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

PawelPPawelP Posts: 4
edited February 27, 2013 2:02PM in SmartAssembly
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:
    this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser();
    ((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).BeginInit();

    // 
    // 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;
    
    ((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).EndInit();
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=2.0.0.0, 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?

Comments

  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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.
  • Options
    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.
Sign In or Register to comment.