Red Gate forums :: View topic - Could not load type 'System.Windows.Forms.AxHost/State'
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 6
SmartAssembly 6 forum

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

Search in SmartAssembly 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
PawelP



Joined: 05 Jan 2012
Posts: 3
Location: Poland

PostPosted: Thu Jan 05, 2012 12:30 pm    Post subject: Could not load type 'System.Windows.Forms.AxHost/State' Reply with quote

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:

    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?
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6643

PostPosted: Thu Jan 05, 2012 5:11 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Nameless301



Joined: 27 Feb 2013
Posts: 1
Location: United States

PostPosted: Wed Feb 27, 2013 8:02 pm    Post subject: Same Issue Reply with quote

I Have this same issue, we've automated our build and when I revert to 6.2 I get the error
Quote:
SmartAssembly build failed: The type initializer for 'SmartAssembly.ConsoleApp' threw an exception.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group