Share Panel Window Transition COM error
-
24 Januari 2012 16:10
I’m experimenting with the Share functionality by creating a Share Consumer that can route the content passed to it from another application to different destinations “within the app” based on what the user selects.
Example: I open tweet@rama and click the Share Charm which launches my application. My application then gives the user the option to choose specific sub categories which will bring up a form for that option. If my app was a messaging app the options could be something like “Send as email” and “Send as SMS” each of which would bring up a separate sub form with different options and validation.
When the user selects a an option I load a user control as follows:
Window.Current.Content = new SampleControl();
Window.Current.Activate();
When I run the app, it seems to work as expected. If I have the debugger attached I get the following error:
System.InvalidCastException was unhandled by user code
Message=Unable to cast COM object of type 'System.__ComObject' to interface type 'Windows.Graphics.Display.IDisplayPropertiesStatics'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{6937ED8D-30EA-4DED-8271-4553FF02F68A}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
Source=mscorlib
StackTrace:
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW_WinRT(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
at Windows.Graphics.Display.DisplayProperties.add_OrientationChanged(DisplayPropertiesEventHandler handler)
at System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeMarshal.NativeOrStaticEventRegistrationImpl.AddEventHandler[T](Func`2 addMethod, Action`1 removeMethod, T handler)
at System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeMarshal.AddEventHandler[T](Func`2 addMethod, Action`1 removeMethod, T handler)
at SampleControl_Loaded(Object sender, RoutedEventArgs e) in REMOVED.xaml.cs:line 33
InnerException:
CODE (Generated by Visual Studio 11):
private void Page_Loaded(object sender, RoutedEventArgs e)
{
if (_displayHandler == null)
{
_displayHandler = Page_OrientationChanged;
_layoutHandler = Page_LayoutChanged;
}
DisplayProperties.OrientationChanged += _displayHandler; (EXCEPTION COMES UP HERE)
ApplicationLayout.GetForCurrentView().LayoutChanged += _layoutHandler;
SetCurrentOrientation(this);
}Is this a quirk in the runtime at this point or a sign I’m going about this in the wrong way?
Anthony Zoko
Software Development Manager/ Architect
DePaul University
College of Computing and Digital Media (CDM) http://www.cdm.depaul.edu
Software Architect - DePaul University - CTI- Diedit oleh Anthony Zoko 24 Januari 2012 16:14
Semua Balasan
-
10 Februari 2012 15:20Moderator
Anthony - can you send me a project to test? MSMALL at Microsoft.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
-
07 April 2012 14:46
I similar issues when trying to debug sharing.
Also occurs with MS samples : run both sample share source app & sample share target app in debugger, in source app bring up share charm and select target app : COM errorWithout debugger attach everthing seems OK.
Likewise for my own app => can't debug share code in target app.
-
16 April 2012 13:51ModeratorDo you have a project that you can send me to debug?
Matt Small - Microsoft Escalation Engineer - Forum Moderator
-
16 April 2012 17:50You can repo the issue by running both the share source sample and share target sample SDK apps in the debugger. Just bring up the share charm in the source app and select the target app in the list, you'll get a COM error
-
16 April 2012 19:22ModeratorOK I'll work on that this week.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
-
20 April 2012 15:38Moderator
Hi - I can reproduce this problem and will file a bug on it.Matt Small - Microsoft Escalation Engineer - Forum Moderator
- Disarankan sebagai Jawaban oleh Matt SmallMicrosoft Employee, Moderator 20 April 2012 15:38