Hi Matt,
This is probably because the copy of the assembly contains the
CustomWebBrowser that you referenced in your test app is not the same one
as you're loading from. In other word, if you load two copies of the same
assembly from different location, the same class in two copies are NOT the
same type. Here's a simple test to verify the behavior:
1) Create a solution, add a Class Library which contains the custom
WebBrowser. It also contains a WinFom to use the custom WebBrowser.
2) Add a Windows Application, reference the Class Library, note the
ClassLibrary1.dll will be copied to this Windows Application's output
directory.
3) Use the output directory of Class Library to load the ClassLibrary1.dll,
however, since you're referencing the copy in output directory of Windows
Application, they will not be equal:
private void button1_Click(object sender, EventArgs e)
{
string path1 = @"c:\temp\ClassLibrary1\bin\Debug\ClassLibrary1.dl l";
string path2 =
@"c:\temp\WindowsApplication1\bin\Debug\ClassLibra ry1.dll";
Form aut = (Form)StartAUT(path1, "ClassLibrary1.Form1");
foreach(Control ctl in aut.Controls)
{
ClassLibrary1.Class1 c1 = ctl as ClassLibrary1.Class1;
Debug.Assert(c1 != null);
}
}
If you use path2 above to test, the code will run successfully.
Hope this helps.
Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.