none
[UWP][VB]Determining Both Namespaces for Ambiguous Namespaces Errors RRS feed

  • Question

  • I am working on a UWP app using VB.NET, and am receiving the following error:

    'File' is ambiguous in the namespace 'System.IO'.

    But as you can see in the message, it tells me 'System.IO' but no other namespace. What is the other namespace that it is ambiguous with? If I replace 'File' with 'System.IO.File' in my code, it does not make any difference. The problem started when I installed the portable.aforge.vision NuGet package (and I will probably need to install some of the other portable.aforge packages). I am unaware of any System.IO namespace in the package, but if there is, shouldn't I be able to use them both by using the fully qualified names (System.IO.File instead of File, for example)? Thank you for any help.


    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Tuesday, December 25, 2018 2:00 AM

Answers

  • Does it help if you also install the latest “shim” package?

    However, you probably cannot use the features of File class. There are specific ways to access the files in UWP.


    • Edited by Viorel_MVP Tuesday, December 25, 2018 9:38 AM
    • Marked as answer by Nathan Sokalski Tuesday, December 25, 2018 3:48 PM
    Tuesday, December 25, 2018 9:34 AM

All replies

  • Perhaps you are looking for the wrong namespace.

    https://msdn.microsoft.com/en-us/library/mt185496.aspx?f=255&MSPPError=-2147217396


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Tuesday, December 25, 2018 2:47 AM
    Moderator
  • That is not the case or the question. First of all, my code completely worked before adding the NuGet package (I hadn't added all the features I want to include, but the code worked, including using System.IO.File to save & load files). Second, my post is about how to figure out what namespace it is ambiguous with (it cannot decide between System.IO and what other namespace)? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Tuesday, December 25, 2018 2:57 AM
  • Does it help if you also install the latest “shim” package?

    However, you probably cannot use the features of File class. There are specific ways to access the files in UWP.


    • Edited by Viorel_MVP Tuesday, December 25, 2018 9:38 AM
    • Marked as answer by Nathan Sokalski Tuesday, December 25, 2018 3:48 PM
    Tuesday, December 25, 2018 9:34 AM
  • Thanks! I installed the shim package (well, actually shim.drawing, but shim is one of it's dependencies), and it seems to be good. I'm not exactly sure what that did, but it seems to have fixed the problem. Thanks!

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Tuesday, December 25, 2018 3:48 PM