Skip to content

Conversation

@dotnet-maestro
Copy link
Contributor

@dotnet-maestro dotnet-maestro bot commented Aug 19, 2024

This pull request updates the following dependencies

From https://github.com/dotnet/runtime

  • Subscription: 417b4c89-9f23-476a-5003-08dcbc3022d8
  • Build: 20240819.2
  • Date Produced: August 19, 2024 11:27:25 AM UTC
  • Commit: 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae
  • Branch: refs/heads/main
Microsoft Reviewers: Open in CodeFlow

…0819.2

Microsoft.Internal.Runtime.WindowsDesktop.Transport , Microsoft.NET.Sdk.IL , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.ILAsm , Microsoft.NETCore.ILDAsm , Microsoft.NETCore.Platforms , Microsoft.Win32.Registry.AccessControl , Microsoft.Win32.SystemEvents , runtime.win-x64.Microsoft.NETCore.ILAsm , runtime.win-x86.Microsoft.NETCore.ILAsm , System.CodeDom , System.ComponentModel.Composition , System.ComponentModel.Composition.Registration , System.Configuration.ConfigurationManager , System.Data.Odbc , System.Data.OleDb , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices , System.DirectoryServices.AccountManagement , System.DirectoryServices.Protocols , System.Formats.Nrbf , System.IO.Hashing , System.IO.Packaging , System.IO.Ports , System.Management , System.Reflection.Context , System.Reflection.MetadataLoadContext , System.Resources.Extensions , System.Runtime.Caching , System.Runtime.Serialization.Formatters , System.Security.Cryptography.Pkcs , System.Security.Cryptography.ProtectedData , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceModel.Syndication , System.ServiceProcess.ServiceController , System.Speech , System.Text.Encoding.CodePages , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Windows.Extensions , VS.Redist.Common.NetCore.SharedFramework.x64.9.0
 From Version 9.0.0-rc.1.24414.5 -> To Version 9.0.0-rc.1.24419.2
@dotnet-maestro dotnet-maestro bot requested a review from a team as a code owner August 19, 2024 12:06
Copy link
Contributor

@dotnet-policy-service dotnet-policy-service bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go, you big red fire engine!

@lonitra
Copy link
Member

lonitra commented Aug 19, 2024

Error:

Did not expect any exception, but found System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.InvalidCastException: Invalid cast from 'System.__ComObject' to 'SHDocVw.IWebBrowser2'.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
--- End of inner exception stack trace ---
at System.Reflection.MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at AxSHDocVw.AxWebBrowser.Navigate(String uRL)
at System.Windows.Forms.Tests.AxWebBrowserTests.<AxWebBrowser_Navigate_ShouldNotThrowException>b__7_0(AxWebBrowser c) in C:\Users\lonitra\source\repos\winforms\src\System.Windows.Forms\tests\UnitTests\System\Windows\Forms\AxWebBrowserTests.cs:line 72

Updating the test to remove any assertions and only a simple call to method AxWebBrowser.Navigate2 gives us callstack and error message

Message: 
System.InvalidCastException : Invalid cast from 'System.__ComObject' to 'SHDocVw.IWebBrowser2'.
Stack Trace: 
RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

@AaronRobinsonMSFT We have tests that are invoking methods on AxWebBrowser to ensure they are working properly and do not throw, but seems we are now getting an invalid cast exception somewhere in runtime. Are you familiar with any changes that occurred that would now cause this exception to be thrown?

@AaronRobinsonMSFT
Copy link
Member

@lonitra I recently did some work in this area, see dotnet/runtime#105965. This wasn't supposed to be in .NET 9, so that is odd. I must have muddled when it was inserted. Let me do a check today.

@AaronRobinsonMSFT
Copy link
Member

I've not debugged this yet, but since this single set of narrow test cases I'm dubious my changes are related. My changes were more impacting and if they cause issues it would likely be systemic. I will debug shortly though.

@AaronRobinsonMSFT
Copy link
Member

The issue is the following two blocks of code: https://github.com/dotnet/runtime/blob/65141b6f40e4352bfa0da33f0b019c28c1beb28a/src/coreclr/vm/methodtable.cpp#L484-L518

With dotnet/runtime#105965, __ComObject now implements IDynamicInterfaceCastable. This means the order of the checks is important. Branches that involved IsComObjectType() should always take priority over those with IsIDynamicInterfaceCastable(). This path was missed and we clearly don't have a test case in dotnet/runtime for it. I will see what I can do about adding a test and getting a fix in tomorrow.

@AaronRobinsonMSFT
Copy link
Member

@lonitra This has been fixed with dotnet/runtime#106677.

@lonitra
Copy link
Member

lonitra commented Aug 20, 2024

Closing as this seems to contain changes from runtime main branch
#11946 supersedes this

@lonitra lonitra closed this Aug 20, 2024
@dotnet-maestro dotnet-maestro bot deleted the darc-release/9.0-dacb973e-addf-45d3-8e6e-57f73d89ebb4 branch August 20, 2024 20:02
@github-actions github-actions bot locked and limited conversation to collaborators Sep 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants