Interface Re-Implementation on Windows Runtime

Hey Guys,
I just noticed a weird behavior while trying to compile some code. I just wanted to ask if I am missing something or interface re-implementation is not allowed on Windows Runtime.
So a simple example:
public interface IMyInterface
void MyFirstMethod();
void MySecondMethod();
public class MyFirstClass : IMyInterface
void IMyInterface.MyFirstMethod()
// TODO:
void IMyInterface.MySecondMethod()
// TODO:
public class MySecondClass : MyFirstClass, IMyInterface
void IMyInterface.MyFirstMethod()
// TODO: something else
This would at worst case scenario would give a compiler error but would compile (I think) on a .net application. (see
http://blogs.msdn.com/b/ericlippert/archive/2011/12/08/so-many-interfaces-part-two.aspx  and )
Is compilation different on windows runtime? Anybody faced the same issue?
Thanks in advance...
Can Bilgin
Blog
Samples CompuSight

Hi Can,
As a guidance/rule any public class in a WinRT component that we develop should be sealed as otherwise one will start extending unmanaged code in managed code. Same guidance should be applicable to anything that is given by Microsoft (controls in this
case, which are part of namespace Windows.UI.Xaml in Windows.winmd).
For immediate resolution I will suggest you create a Windows Runtime component and in that you extend any WinRT control to do what you are trying. I think that will fix your immediate issue, if that does not work then it is truly a bug. 
For why those controls are not sealed I can understand and think that there is a need of a new keyword in C# to mark classes open to extend as WinRT component i.e. unmanaged but sealed for just .NET managed code :)
-- Vishal Kaushik --
Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful'
if it helps you. Happy Coding!!!
My Samples
My Codeplex Project

Similar Messages

  • How to use multi async method in Windows Runtime Component (C#)

    I want to migrate an async method into Windows Runtime Component.
    CookieContainer cc = await utility.GetCookieContainer();
    But the content of async method still contains async methods.
    public async Task<CookieContainer> GetCookieContainer()
    if (stsAuthToken != null)
    if (DateTime.Now > stsAuthToken.Expires)
    this.stsAuthToken = await GetMsoStsSAMLToken();
    AuthCookies cookies = await GetAuthCookies(this.stsAuthToken);
    CookieContainer cc = new CookieContainer();
    Cookie samlAuthCookie = new Cookie("FedAuth", cookies.FedAuth)
    Path = "/",
    Expires = this.stsAuthToken.Expires,
    Secure = cookies.Host.Scheme.Equals("https"),
    HttpOnly = true,
    Domain = cookies.Host.Host
    cc.Add(this.spSiteUrl, samlAuthCookie);
    Cookie rtFACookie = new Cookie("rtFA", cookies.RtFA)
    Path = "/",
    Expires = this.stsAuthToken.Expires,
    Secure = cookies.Host.Scheme.Equals("https"),
    HttpOnly = true,
    Domain = cookies.Host.Host
    cc.Add(this.spSiteUrl, rtFACookie);
    this.cookieContainer = cc;
    And even GetMsoStsSAMLToken and GetAuthCookies contain async methods...
    How to migrate it?

    Hi Matt,
    I'm sorry for my unclear description.
    My WinRT Component is for Javascript. If I use folloiong codes, error occurs.
    public static async Task<bool> GetInternal(string url, string username, string password)
    bool r = await AuthUtility.Create(new Uri(url), username, password);
    return r;
    The error is
    SharePointWindowsRuntimeComponent.Common.GetInternal(System.String, System.String, System.String)' has a parameter of type 'System.Threading.Tasks.Task<System.Boolean>' in its signature. Although this generic type is not a valid Windows Runtime type,
    the type or its generic parameters implement interfaces that are valid Windows Runtime types.  Consider changing the type 'Task' in the method signature to one of the following types instead: Windows.Foundation.IAsyncAction, Windows.Foundation.IAsyncOperation,
    or one of the other Windows Runtime async interfaces. The standard .NET awaiter pattern also applies when consuming Windows Runtime async interfaces. Please see System.Runtime.InteropServices.WindowsRuntime.AsyncInfo for more information about converting managed
    task objects to Windows Runtime async interfaces.
    Some articles said, Task<T> is not WinRT type and should be converted to IAsyncOperation<T>. Only stirng, int, bool, object, array of above types and some 'simple' type can be used. (The
    related article)
    Then I try to convert Task<bool>, but the codes don't work.
    Above is why I ask this question.
    If async method can be used in WinRT component directly, please let me know why I got above error.
    Thanks.

  • "general access denied error" while implementing out-of-process COM Server Implementation in Windows Phone 8.1

    I have a Service (.exe) where I was registering for my COM Component like below
    CoInitializeEx(NULL, COINIT_MULTITHREADED);
    HRESULT hres = CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0);
    if (hres != S_OK)
    OutputDebugStringA("Security Descriptor not initialized");
    ITypeLib* pTypeLib;
    HRESULT hr_1 = LoadTypeLibEx(L"ServiceIdl.tlb", REGKIND_REGISTER, &pTypeLib);
    if (pTypeLib != NULL)
    pTypeLib->Release();
    RegisterServer(L"Service.exe", CLSID_classAImpl, L"ClassAImpl Sample", L"Component.ClassAImpl", L"Component.ClassAImpl.1", 0);
    g_hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    DWORD reg = 0;
    IClassFactory *pIFactory = new classAFactory;
    HRESULT hr0 = CoRegisterClassObject(CLSID_classAImpl, pIFactory, CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &reg);
    if (FAILED(hr0))
    OutputDebugStringA("classAImpl is not registered");
    CoUninitialize();
    exit(1);
    HRESULT hr1 = CoResumeClassObjects();
    if (hr1 == S_OK)
    OutputDebugStringA("classAImpl is Resumed Registering");
    WaitForSingleObject(g_hEvent, INFINITE);
    CloseHandle(g_hEvent);
    CoRevokeClassObject(reg);
    pIFactory->Release();
    CoUninitialize();
    From Client Code I am CreatingInstance  Like Below
    COSERVERINFO si;
    MULTI_QI qi;
    COAUTHINFO cai = { RPC_C_AUTHN_NONE, RPC_C_AUTHZ_NONE, 0, RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IMPERSONATE, 0, EOAC_NONE };
    si.dwReserved1 = 0;
    si.pwszName = L"\\\\localhost";
    si.pAuthInfo = &cai;
    si.dwReserved2 = 0;
    qi.pIID = &IID_classA;
    qi.pItf = NULL;
    qi.hr = 1;
    CoInitializeEx(NULL, COINIT_MULTITHREADED);
    HRESULT hr = CoCreateInstanceEx(CLSID_classAImpl, 0, CLSCTX_LOCAL_SERVER, &si, 1, &qi);
    hr returning error "general access denied error";

    I think we may run into the limitations mentioned in the remarks of CoCreateInstanceFromApp doc(show as below). If you can provide a repro project, I
    can give you more details about what happens.
    The CoCreateInstanceFromApp function reads class registrations only from Fusion contexts and manifests, and from the HKLM\SOFTWARE\Classes\CLSID registry hive.
    Only built-in classes that are supported in the app container are supplied. Attempts to activate unsupported classes, including all classes installed by 3rd-party code as well as many Windows classes, result in error code
    REGDB_E_CLASSNOTREG.
    The CoCreateInstanceFromApp function is available to Windows Store apps. Desktop applications can call this function, but they have the same restrictions as Windows Store apps.
    If you are trying to call some windows classes in your library, I will suggest you check how to create windows runtime out of process component by viewing
    this sample. This is what I usually do.
    To be honest, I did not try to implement the out of process COM component using the method you tried as we previsouly do on desktop. I will suggest you try to register a very simple library(like a signle class and single interface which returns an integer),
    and see if it will work.
    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    Alan Yao
    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

  • How to view COMPONENTCONTROLLER interface 's implement class

    Every WDA has COMPONENTCONTROLLER  ,and it has  interface, How to view class implemented this interface?

    >
    Abhimanyu Lagishetti wrote:
    > WDA is stored as meta data, there are no objects generated in the system when you activate your web dynpro component, the classes are generated at runtime only
    >
    > Abhi
    Actually that's not true.  The interfaces get built as you are editing the component and compile like any other class when you activate. They are just hidden from the class builder to keep people from messing around with them directly and to keep from cluttering up the object navigator. They have to be built as you go otherwise SAP would have had to build a special syntax checker and code parser for the ABAP Code Completion for WDA (which we didn't do).
    You can view the interfaces however.  There is a button on the toolbar (or you can press CTRLSHIFTF1 or the menu path GOTO->Controller Interface).
    http://www.flickr.com/photos/tjung/2740591187/
    It displays the interface in a dialog window:
    http://www.flickr.com/photos/tjung/2741429324/
    Also in ABAP 7.1 and higher, the interace is also visible via the code completion via the implementation of the interface in WD_THIS.
    http://www.flickr.com/photos/tjung/2740610915/

  • How can I consume a c# windows runtime component in a WRL (C++) class?

    I would like to instantiate a class of a C# windows runtime project, from a WRL project.
    In order to make the C# class I have created a WRL project to generate an interface for it to implement. This has worked, but I would rather do it all in the one C# project. I don't know how to do this, and I also don't know how to finally consume the C#
    project (and the resulting .winmd file) from a Wrl project. 

    You're right; I'll post back here.
    Edit: I asked over here:
    https://social.msdn.microsoft.com/Forums/windowsapps/en-US/53a77d09-01b1-4039-8ad3-207b47b08775/how-can-i-consume-a-c-windows-runtime-component-in-a-wrl-c-class?forum=winappswithnativecode#53a77d09-01b1-4039-8ad3-207b47b08775

  • Best practice for Javadoc comments in both an interface and implementation

    For the Spring project I'm writing, I have interfaces with typically 1 implementation class associated with it. This is for various good reasons. So I'm trying to be very thorough with my Javadoc comments, but I realize I'm basically copying them over from interface to implementation class. Shouldn't Javadoc have a setting or be smart enough to grab the comments from my interface if the implementation class doesn't have a comment? Unless of course there is interesting information about the implementation, it's rare the 2 sets of comments would be different.

    Thanks Thomas!! Exactly what I was looking for. Here's the JavaSE 6 version of the page you provided:
    http://java.sun.com/javase/6/docs/technotes/tools/windows/javadoc.html#inheritingcomments

  • I want to  implement the Window autoresize in java swing application

    Hai...
    i want implement the window autoresize functionality in my java application. Same time i want to minimize and maximize my won window. and my java application develop one more frame at time disply in single window so i want disply the thaminal view formate in all frame
    Thanx to Advance.
    ARjun...

    ????????

  • Issue with implementing Find window

    Hi,
    I am facing an issue with implementing Find window. The find window everything is working fine, but when I am opening the form I am facing the following error
    'Error: To retrieve the Information in this block, use menu option view -> query by example -> Enter to invoke enter-query mode, then view -> Query by example > Run to run your query..'
    when I click 'Ok', it is navigating to the FInd window.
    How can I avoid the above error message?
    And also after searching, I navigate to the main window to display the records, but the 'Find' torch icon is not getting enabled, how do I that?
    Thanks,
    Ramu

    Thanks for the reply.
    Yes, I have the QUERY_FIND trigger with the code as 'APP_STANDARD.EVENT('QUERY_FIND');'
    And also 'first navigation data block ' to my result block. Now that the error is gone, But still the Find Icon is not enabled
    Please advice.
    Thanks,
    Ramu
    Edited by: Ramu Chennuri on Oct 21, 2008 8:32 AM

  • Adobe Reader XI (11.0.08) doesn't create thumbnail (bitmap) using Microsoft Interface IExtractImage -- Extract on Windows Server 2008 R2, when exe to generate thumbnail is launched from Windows service.

    Adobe Reader XI (11.0.08) doesn't create thumbnail (bitmap) using Microsoft Interface IExtractImage --> Extract on Windows Server 2008 R2, when exe to generate thumbnail is launched from Windows service.
    But if exe is launched as standalone, then interface IExtractImage --> Extract, gives Bitmap to generate thumbnail of PDF document.
    Above problem occurs only for PDF documents, if we tried same with other software like CAD -CATIA it works without any problem.
    Is there any security concerns form PDF side, which doesn't allow to generate Bitmaps, if exe to generate it is launched form Windows service.

    It might be deliberate, Acrobat and Reader software is not intended to run in a service environment.

  • TypeLoadException: "Types from custom Windows Runtime components are not supported in desktop applications"

    When trying to use a custom Windows Runtime component in a desktop application, a TypeLoadException is thrown.
    Why aren't custom Windows Runtime components supported in desktop applications? Is this something that will change in the future?
    Thanks,
    Tom
    luck favours the prepared

    If you are targeting the .NET Framework 4.5 you could try to add a <PropertyGroup> element to your project file and a reference to the WinMD file as described here:
    http://stackoverflow.com/questions/12136585/using-custom-windows-runtime-components-in-non-metro-applications
    Thefull list of the WinRT classes that are available to desktop apps is available here:
    http://msdn.microsoft.com/en-us/library/windows/desktop/hh920511%28v=vs.85%29.aspx#windows_runtime_classes
    Please refer to the following links for more information:
    http://msdn.microsoft.com/en-us/magazine/jj651570.aspx
    http://stackoverflow.com/questions/12745703/how-can-i-use-the-windows-ui-namespace-from-a-regular-non-store-win32-net-app
    https://software.intel.com/en-us/articles/using-winrt-apis-from-desktop-applications
    Please remember to mark helpful posts as answer and/or helpful.

  • I would like to create a pop-up window appear from Labview Interface. In this window, I will have a slide control and an image taken from a camera. The main VI have to run while pop-up window is open. How can I do ?

    When I pushed a button, this pop-up window has to appear. There will be a slide control and a picture from a camera in this window. Is it possible to make appear this windows while main VI Interface continue to run ? How can I do this ? Thank you for your answers.
    Cyril.

    Here you go. This is simple example. Maybe not the best way, I am just
    beginner in LV and still not comfortable with data flow that much. I prefer
    events, so I would change this to use Event Structures.
    When you click on OK button on SliderMain, it opens Slider.vi. Now both
    windows are open and you can interact with both. Now if you click on OK
    again with Slider.vi open, you run into problems. Only thing I did was
    change VI properties of slider.vi, mainly window appearance.
    vishi
    "Cy" wrote in message
    news:[email protected]..
    > I would like to create a pop-up window appear from Labview Interface.
    > In this window, I will have a slide control and an image taken from a
    > camera. The main VI hav
    e to run while pop-up window is open. How can I
    > do ?
    >
    > When I pushed a button, this pop-up window has to appear. There will
    > be a slide control and a picture from a camera in this window. Is it
    > possible to make appear this windows while main VI Interface continue
    > to run ? How can I do this ? Thank you for your answers.
    > Cyril.
    [Attachment SliderMain.vi, see below]
    [Attachment Slider.vi, see below]
    Attachments:
    SliderMain.vi ‏16 KB
    Slider.vi ‏11 KB

  • Implementi​ng Windows API Shell Execute call

    I am trying to implement the Windows API call in LabVIEW named ShellExecute.  I have created the attached VI and I do not understand why it will not run correctly.  I am hoping that a user on the forum will see the problem and be able to suggest what is wrong.  Thank you for any help!
    Attachments:
    ShellExecute.vi ‏43 KB

    Remove the quotation marks from the list of strings for your commands and it will work.
    You also don't need them for the path, but there they don't seem to make a difference.
    Also, instead of using a multi-line string, you can use a property node to get the string values of the ring and index array to pick the right string.
    Try to take over the world!

  • How to implement "irregular window" in cocoa

    hello,
    How to implement ellipse window or triangle window in cocoa. Thank you very much!

    Have a look at CocoaDev's page on this subject here and Apple's sample code RoundTransparentWindow here (this link is in CocoaDev's page but it's since been updated to a slightly different URL).

  • Regarding Interface methods implementation

    Hi,
    I have a interface with 3 methods.
    public interface test{
    public void A();
    public void B();
    public void C();
    public class IntImpl implements test{
    public void B(){
    //implementation
    Can we implement an interface with out implementing all the methods of interface .instead implementing a few methods in the interface?
    i came to know that we can do the above one with out any exceptions? So any of you can resolve this issue ..
    Thanks in advance
    Sri

    Can we implement an interface with out implementing
    all the methods of interface .instead implementing a
    few methods in the interface?In other words: can we implement an interface without implementing it?
    The answer should be obvious.
    i came to know that we can do the above one with out
    any exceptions? Sure, it's quite easy, you already did it. The stuff above won't compile, hence it won't throw an exception when running.
    Or you can also avoid compiler errors by declaring IntImpl as abstract. Which means you didn't implement the interface though.

  • Pattern b/w Remote interface & Container implementation  class

    Which pattern is followed by EJB Remote interface & Container implementation class of that interface?Is there anyting mentioned in specs?
    This questoin was asked to me by many people.I think it is Command design pattern as it hides away all the details of actual business implementation.but at same time I doubt if it is Facade?
    Anyone who knows about this?
    Thanx in advance
    Sidhu

    Rarely is software represent a single pattern, it typically represents multiple patterns.
    Which pattern is followed by EJB Remote interfaceThe remote interface is an example of a facade pattern. This presents a public interface which is an abstraction of the real interface.
    Container implementation class of that interface? The implementation is an example of what I think of as a double proxy pattern. That is acting as two distinct proxies. The first being the the remote callingof EJB standard functions via the Skelton implementation. I.E. The underlying EJB/RMI interface. The Second being a application level proxying of the business logic seen in most RL implementation.
    The use of an UID ID beans is an example of a memento.
    I think it is Command design pattern as it hides away all the
    details of actual business implementation.Not directly, though an AppServer programmer may use the Command Pattern to resolve the remote connections. The User Application Programmer may also use this pattern. The key element of Command Pattern is the Invoker executing an concrete class via abstraction or interface of a polymorphic class. You can think of this as a specialisation of the
    Martin

Maybe you are looking for

  • Double-clicking on files doesn't open them

    Just started today: If I navigate to a file in the Finder and double-click on it, nothing happens. It doesn't open. If I open the application (e.g., MS Word) and go to the file menu and choose Open, navigate to the file, the file will open. But it ha

  • Major problems with new update

    so I updated my iPod about a week ago and ever since I cannot sign onto aim nor can I chat through facebook. Is anyone else having these problems? What can I do about them?

  • Lumonics HD-300 of Spectra-Physics PDL-3 driver

    Hello all: I am not sure if this is the correct forum, but it's worth a shot... Does anyone know if there exists anywhere a Labview VI driver for either: a) Lumonics HD-300 dye laser b) Spectra-Physics PDL-3 dye laser Both VI's would essentially be s

  • Fan Issues with DV6-7000 series (probably with DV7-7000 series too)

    So I've installed Arch on my brand new laptop, and I'm unable to change the fan speed. The fan does run, but on the lowest possible setting, which means the laptop gets very hot. I've followed the wiki here: https://wiki.archlinux.org/index.php/Fan_S

  • Plsql block as required

    hi , a plsql block and the result will be like --> Title01 has taken by zero students. --> Title02 has taken by ten students. --> Title03 has taken by five students. i got a question in this manner i am a beginner kinda help me out . regards, beginne