-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Application Name: Transmogrify, SUBSTitute (These two apps affected)
OS: Windows 10 RS5
CPU: X64
.NET Build Number: dotnet-sdk-7.0.100-alpha.1.22057.7
Verify Scenarios:
1). Windows10 RS5 x64+dotnet-sdk-7.0.100-alpha.1.22057.7: Fail
2). Windows10 RS5 x64+dotnet-sdk-7.0.100-alpha.1.21568.2: Pass
3). Windows10 RS5 x64+dotnet-sdk-6.0.200-preview.21603.2: Pass
App Source and App Checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1460206
Repro steps:
This is .net core3.0 app, but we are running it on 7.0, machine only have 7.0 installed, and DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2, so it runs on 7.0
- Copy Transmogrify from server to local machine.
- Launch Transmogrify.exe
Expected Result:
App launch successful.
Actual Result:
App launch failed.
Exceptions from Event Log:
Application: Transmogrify.exe
CoreCLR Version: 7.0.22.5610
.NET Version: 7.0.0-alpha.1.22056.10
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Windows.Markup.XamlParseException: 'The invocation of the constructor on type 'Transmogrify.Pages.ProjectOverviewControls.OverviewRibbon' that matches the specified binding constraints threw an exception.' Line number '12' and line position '10'.
---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Type 'System.Windows.Media.MILCMD_POP' from assembly 'PresentationCore, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' has zero size.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at Transmogrify.Services.LibraryService.<>c.<GetAvailableEndpointTypes>b__6_1(Assembly a) in E:\App Source\Transmogrify\Transmogrify\Services\LibraryService.cs:line 34
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Transmogrify.Services.LibraryService.GetAvailableEndpointTypes() in E:\App Source\Transmogrify\Transmogrify\Services\LibraryService.cs:line 35
at Transmogrify.Pages.ProjectOverviewControls.OverviewRibbon.AddEndPointTypesToMenu() in E:\App Source\Transmogrify\Transmogrify\Pages\ProjectOverviewControls\OverviewRibbon.xaml.cs:line 36
at Transmogrify.Pages.ProjectOverviewControls.OverviewRibbon..ctor() in E:\App Source\Transmogrify\Transmogrify\Pages\ProjectOverviewControls\OverviewRibbon.xaml.cs:line 29
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
System.TypeLoadException: Type 'System.Windows.Media.MILCMD_POP' from assembly 'PresentationCore, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' has zero size.
--- End of inner exception stack trace ---
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
at MS.Internal.AppModel.AppModelKnownContentFactory.BamlConverter(Stream stream, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter)
at MS.Internal.AppModel.MimeObjectFactory.GetObjectAndCloseStream(Stream s, ContentType contentType, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter)
at System.Windows.Navigation.NavigationService.GetObjectFromResponse(WebRequest request, WebResponse response, Uri destinationUri, Object navState)
at System.Windows.Navigation.NavigationService.DoNavigate(Uri source, NavigationMode f, Object navState)
at System.Windows.Navigation.NavigateQueueItem.Dispatch(Object obj)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at Transmogrify.App.Main()
Minimal Repro steps:
dotnet-sdk-7.0.100-alpha.1.22057.7 sdk should be installed on the machine.
- Create a .NET 6.0 WPF project.
- Add Using System.Windows; namespace in MainWindow.xaml.cs file.
- Add following highlighted code in MainWindows's construct function:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
IEnumerable<Type> lst2 = assemblies.SelectMany(a => a.GetTypes()).Where(a => a.Name.StartsWith("MILCMD"));
Type type = lst2.FirstOrDefault(a => a.FullName == "System.Windows.Media.MILCMD_POP");
}
}
- Build the project.
- Go to bin\Debug\net6.0-windows folder, assign the Microsoft.WindowsDesktop.App to 7.0.0-alpha.1.22055.1:
{
"runtimeOptions": {
"tfm": "net6.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "6.0.0-rc.2.21452.2"
},
{
"name": "Microsoft.WindowsDesktop.App",
"version": " 7.0.0-alpha.1.22055.1"
}
]
}
}
- Launch the exe under bin\Debug\net6.0-windows
Reproduce demo attached in https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1460206.
Expected Result:
The exe can run successfully.
Actual Result:
Exe doesn't launch successfully.
Exception from Event Viewer:
Application: GetTypeException.exe
CoreCLR Version: 7.0.22.5610
.NET Version: 7.0.0-alpha.1.22056.10
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Windows.Markup.XamlParseException: 'The invocation of the constructor on type 'GetTypeException.MainWindow' that matches the specified binding constraints threw an exception.' Line number '6' and line position '9'.
---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Type 'System.Windows.Media.MILCMD_POP' from assembly 'PresentationCore, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' has zero size.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at GetTypeException.MainWindow.<>c.<.ctor>b__0_0(Assembly a) in C:\Users\v-weiwc\source\repos\GetTypeException\GetTypeException\MainWindow.xaml.cs:line 29
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at GetTypeException.MainWindow..ctor() in C:\Users\v-weiwc\source\repos\GetTypeException\GetTypeException\MainWindow.xaml.cs:line 30
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
System.TypeLoadException: Type 'System.Windows.Media.MILCMD_POP' from assembly 'PresentationCore, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' has zero size.
--- End of inner exception stack trace ---
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__1_0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at GetTypeException.App.Main()
Findings:
- Compare the PresentationCore.dll version from dotnet-sdk-7.0.100-alpha.1.22057.7 and dotnet-sdk-7.0.100-alpha.1.21568.2, we found they have different versions. In dotnet-sdk-7.0.100-alpha.1.22057.7, it is 7.0.22.5501, and in dotnet-sdk-7.0.100-alpha.1.21568.2, it is 7.0.21.56606.
- Since the error is unable to load 'System.Windows.Media.MILCMD_POP' type from PresentationCore.dll, we use ILSpy to reflect the PresentationCore.dll, and found 'System.Windows.Media.MILCMD_POP' type exists in dotnet-sdk-7.0.100-alpha.1.22057.7 and the access modifier is internal, no difference with dotnet-sdk-7.0.100-alpha.1.21568.2.
- We tried retarget the app from .netcore3.0 to .net 7.0, the same exception when finding 'System.Windows.Media.MILCMD_POP' type.
@dotnet-actwx-bot @dotnet/compat