Repository navigation
Description
Application Name: WinQuickLook
OS: Windows 10 RS5
CPU: X64
.NET Build Number: 5.0.100-preview.2.20163.4
App Location:
App Source on GitHub link : https://github.com/shibayan/WinQuickLook
Verify Scenarios:
1). Windows 10 RS5 X64 + .NET Core SDK build : 3.1 : Pass
2). Windows 10 RS5 X64 + .NET Core SDK build : 5.0.100-preview.1.20125.9: Pass
3). Windows 10 RS5 X64 + .NET Core SDK build : 5.0.100-preview.2.20163.4: Fail
Repro Machine Environment Info :
.NET Core SDK (reflecting any global.json):
Version: 5.0.100-preview.2.20163.4
Commit: b5bccca3f5
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100-preview.2.20163.4\
Host (useful for support):
Version: 5.0.0-preview.2.20160.6
Commit: d12f79a
.NET Core SDKs installed:
5.0.100-preview.2.20163.4 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 5.0.0-preview.2.20160.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.0-preview.2.20160.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.0-preview.2.20160.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Repro steps:
On the repro machine (10.159.67.178)
- Start application from "C:\Repro\WinQuickLook\WinQuickLook.exe"
- Open Windows Explorer, select any item, folder or file
- Press Space bar
Expected Result:
It should show information about selected item in windows explorer
Actual Result:
Application crashes
Event Viewer Log :
Application: dotnet.exe
CoreCLR Version: 5.0.20.16006
.NET Core Version: 5.0.0-preview.2.20160.6
Description: The process was terminated due to an internal error in the .NET Runtime at IP 00007FFBEF05C2E4 (00007FFBEEED0000) with exit code c0000005.
Faulting application name: dotnet.exe, version: 5.0.20.16006, time stamp: 0x5e67fb06
Faulting module name: coreclr.dll, version: 5.0.20.16006, time stamp: 0x5e67eae9
Exception code: 0xc0000005
Fault offset: 0x000000000018c2e4
Faulting process id: 0x1a54
Faulting application start time: 0x01d5fad8a8bf9c6b
Faulting application path: C:\Program Files\dotnet\dotnet.exe
Faulting module path: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.0-preview.2.20160.6\coreclr.dll
Report Id: c07817b9-df85-4a2a-9cbc-c57e9c05aaa3
Faulting package full name:
Faulting package-relative application ID:
Stack Trace :
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at WinQuickLook.WinExplorerHelper.GetSelectedItemCore(WinQuickLook.Interop.IWebBrowserApp)
at WinQuickLook.WinExplorerHelper.GetSelectedItem()
at WinQuickLook.App.PerformQuickLook()
at System.Windows.Threading.DispatcherOperation.InvokeDelegateCore()
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at System.Windows.Application.Run()
at WinQuickLook.App.Main()
Findings:
Source code can be found at repro machine : C:\Repro\WinQuickLook_source
System.AccessViolationException Exception after this line:
shellFolder.GetDisplayNameOf(pidl, SHGDNF.FORPARSING, out var str)
https://github.com/shibayan/WinQuickLook/blob/master/WinQuickLook/Interop/ComInterfaceExtension.cs
Repro machine could be found at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1082949
Activity
Dotnet-GitSync-Bot commentedon Mar 16, 2020
I couldn't add an area label to this Issue.
Checkout this page to find out which area owner to ping, or please add exactly one area label to help train me in the future.
danmoseley commentedon Mar 16, 2020
@DotNetAppCompatFeiWang can you please get full native call stack? Attach VS native debugger or windbg and repro it.
danmoseley commentedon Mar 16, 2020
@AaronRobinsonMSFT i put the interop label given that's apparently the point of the AV and the code worked in 3.1
DotNetAppCompatFeiWang commentedon Mar 17, 2020
Add Call Stack :
AaronRobinsonMSFT commentedon Mar 17, 2020
I am unable to see this failure anywhere. I keep getting the following and then an immediate crash. @DotNetAppCompatFeiWang can you please collect a full DMP and leave it on the machine so someone can investigate. Thanks.
DotNetAppCompatFeiWang commentedon Mar 17, 2020
Saved on the repro machine at "C:\Repro\WinQuicklook.dmp".
BTW, after launch application, don't click on notifyicon, it crashes, we ignore it because it is same on 3.0.x & 3.1.x.
danmoseley commentedon Mar 24, 2020
@AaronRobinsonMSFT do you have what you need? I know @richaverma1 is tracking this one.
AaronRobinsonMSFT commentedon Mar 24, 2020
@danmosemsft I didn't realize the urgency of this issue. I have all that I need locally. Focusing on this issue.
danmoseley commentedon Mar 24, 2020
@DotNetAppCompatFeiWang when posting blocks of output like the callstack above, please surround with triple back ticks (```) on their own line above and their own line below. This fixes the formatting. You see I have done that with your callstack above, as Aaron did with his.
AaronRobinsonMSFT commentedon Mar 24, 2020
Okay I think this is more likely a JIT bug. Here is how I am getting there.
The following is the failing stack:
Disassembly of top frame:
Register state after
00007FFA0A7F5BF5above.Once the frame returns, the
RBPregister is dereferenced as follows at00007FFA0A7F4CE8thus leading to the A/V.I have a local repro and can provide additional information if needed. Perhaps JITDump of
ComInterfaceExtension.GetDisplayNameOf()?/cc @BruceForstall @dotnet/jit-contrib
1 remaining item
briansull commentedon Mar 24, 2020
Debug instructions:
Set a breakpoint upon entry of the method
ComInterfaceExtension.GetDisplayNameOf
There should be a push rbp at the start of the method.
Step past it (observe the value being pushed is not zero)
then set a data break point on the stack area where rbp was saved.
hit go and find out who is overruning the stack and writing a zero value on the saved rbp
AaronRobinsonMSFT commentedon Mar 25, 2020
Simplified repro below.
DotNetAppCompatFeiWang commentedon Apr 20, 2020
Any update about this?
AaronRobinsonMSFT commentedon Apr 21, 2020
@DotNetAppCompatFeiWang This appears to have uncovered a long standing bug in the interaction between the JIT and COM-RPC. The size of the struct defined above is incorrect based on its official MIDL definition for 64-bit. For a 64-bit process the size should be 272. In a 32-bit process the size is 264. That is the issue. The JIT has gotten smarter and this incorrect size definition has lurked for a long time. Note that the defined offsets are also incorrect for 64-bit - they should be 8.
I have some investigations I want to perform to provide the best guidance on how to fix the definition. At the moment and probably the best fix is to indicate the maximum size the struct could ever be which is 272. That size will work for both 32 and 64 bit.
AaronRobinsonMSFT commentedon Apr 21, 2020
After an additional investigation into this issue, it has been determined this is indeed a long standing issue with the current definition when used in a 64-bit process (i.e. it worked by accident). The official native definition of
STRRETdoesn't define the type in terms of COM-RPC, that is found inShTypes.Idland comes with the Windows SDK. The correct managed layouts that are compatible with COM-RPC are as follows:Managed definition 32-bit:
Managed definition 64-bit:
DotNetAppCompatFeiWang commentedon Apr 29, 2020
This bug found by AppCompat lab, documentation was added. It is not a breaking change but changes in JIT exposed a longstanding bug but since this usage is common, it is addressed with product documentation and add a link to the PR below.
dotnet/docs#18087
AaronRobinsonMSFT commentedon Apr 29, 2020
@DotNetAppCompatFeiWang Thanks for closing the loop here. Appreciate the diligence.