locked
Issuels following VoIP ChatterBox Sample RRS feed

  • 问题

  • Hi,

        I tried to build a WP 8 VoIP application following the Chatterbox Sample, and when it runs I got the following exception with one line at "BackGroundProcessController.cs"

        public void ConnectUi()

        {

                ...

                

               

    this.server = (WMCSWrap)WindowsRuntimeMarshal.GetActivationFactory(typeof(wmcs_metro.OutOfProcess.WMCSWrap)).ActivateInstance();

               

    this.server.SetSimulatedFlag(true);

      

         ...

    }

       

       

     

    {System.InvalidCastException: Unable to cast object of type 'wmcs_metro.OutOfProcess.WMCSWrap' to type 'wmcs_metro.OutOfProcess.__IWMCSWrapPublicNonVirtuals'.

       at System.StubHelpers.StubHelpers.GetCOMIPFromRCW_WinRT(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget)
       at wmcs_metro.OutOfProcess.WMCSWrap.SetSimulatedFlag(Boolean isSimulated)
       at CWCFWrap.BackgroundProcessController.ConnectUi()
       at CWCFWrap.WrapMetro.GetInstance()
       at CWCFWrap.WrapAccount..ctor()
       at CWCFWrap.WrapAccount.GetInstance()
       at LoginPage.Btn_SignIn_Click(Object sender, RoutedEventArgs e)
       at System.Windows.Controls.Primitives.ButtonBase.OnClick()
       at System.Windows.Controls.Button.OnClick()
       at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
       at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)}

    I've also found a warning which seems to be related to this issue and cannot really figure out how to fix it as my backend rt component contains types from both wmcs_metro & wmcs_metro::OutOfProcess namespace.

    C:\Program Files (x86)\MSBuild\Microsoft\WindowsPhone\v8.0\Microsoft.Phone.Packaging.targets(599,9): warning : The output filename �wmcs_metro.winmd� should match the namespace wmcs_metro.OutOfProcess for one of types in the .winmd file. If they don't match, it could cause an error in runtime detection of these types. For correct runtime behavior, ensure the filename of the .winmd file matches a namespaces for one of the contained types and build again.   

     

    I have been stuck here for quite some days, would very appreciate if anybody could kindly help. I do see someone in the forum met the same issue, but unfortunately there's no contact info available.  

     

     

     

    2013年9月20日 8:49

全部回复

  • I just found that the original "wmcs_metro.winmd" will be split into 2 files "wmcs_metro.winmd" + "wmcs_metro.OutOfProcess.winmd" after running the Midl commands.

    So after I changed the main application's reference to these two files, the warning went away.

    However, I still have the exception during run time.

    {System.InvalidCastException: Unable to cast object of type 'wmcs_metro.OutOfProcess.WMCSWrap' to type 'wmcs_metro.OutOfProcess.__IWMCSWrapPublicNonVirtuals'.

       at System.StubHelpers.StubHelpers.GetCOMIPFromRCW_WinRT(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget)

    Please kindly help!

    2013年9月20日 12:53
  • Problem resolved, in case there are still anybody facing the same issue as I did, here is what I have found: 

    This is because the ProxyStub.dll does not match with the RT's dll. 

    I added reference to the RT's project in the UI project, and added (instead of "add as link") the ProxyStub.dll into the UI project, so Visual Studio made a copy of the proxyStub dll and use the copied one for the App.

    Later on, after I changed the RT dll, the proxyStub.dll was not updated, which caused the mismatch. 


    2013年11月22日 23:32