UWP List Assets Files












0















I'm trying to view the files in my "Assets" folder. I can see if one file is there because it won't allow me to add it again. However, I want to see all of the files in the debugger but I get the following error:



"To inspect the native object, enable native code debugging."



Here is the code I'm trying to debug/inspect.



StorageFolder appInstalledFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFolder assets1 = await appInstalledFolder.GetFolderAsync("Assets");
var files = await assets1.GetFilesAsync();


I've added the following code but still getting the Native code error.



StorageFolder folder = await Package.Current.InstalledLocation.GetFolderAsync("Assets");
// StorageFolder folder = ApplicationData.Current.LocalFolder;
var options = new QueryOptions();
options.FileTypeFilter.Add(".jpg");//this will add .csv files to query options
options.FolderDepth = FolderDepth.Deep;//optional
StorageFileQueryResult query = folder.CreateFileQueryWithOptions(options);
IReadOnlyList<StorageFile> fileList = await query.GetFilesAsync();


error from debugger: To inspect the native object, enable native code debugging.










share|improve this question




















  • 1





    Unable to reproduce your issue, try clean and rebuild solution or launch in release mode

    – Shubham Sahu
    Nov 18 '18 at 5:21
















0















I'm trying to view the files in my "Assets" folder. I can see if one file is there because it won't allow me to add it again. However, I want to see all of the files in the debugger but I get the following error:



"To inspect the native object, enable native code debugging."



Here is the code I'm trying to debug/inspect.



StorageFolder appInstalledFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFolder assets1 = await appInstalledFolder.GetFolderAsync("Assets");
var files = await assets1.GetFilesAsync();


I've added the following code but still getting the Native code error.



StorageFolder folder = await Package.Current.InstalledLocation.GetFolderAsync("Assets");
// StorageFolder folder = ApplicationData.Current.LocalFolder;
var options = new QueryOptions();
options.FileTypeFilter.Add(".jpg");//this will add .csv files to query options
options.FolderDepth = FolderDepth.Deep;//optional
StorageFileQueryResult query = folder.CreateFileQueryWithOptions(options);
IReadOnlyList<StorageFile> fileList = await query.GetFilesAsync();


error from debugger: To inspect the native object, enable native code debugging.










share|improve this question




















  • 1





    Unable to reproduce your issue, try clean and rebuild solution or launch in release mode

    – Shubham Sahu
    Nov 18 '18 at 5:21














0












0








0








I'm trying to view the files in my "Assets" folder. I can see if one file is there because it won't allow me to add it again. However, I want to see all of the files in the debugger but I get the following error:



"To inspect the native object, enable native code debugging."



Here is the code I'm trying to debug/inspect.



StorageFolder appInstalledFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFolder assets1 = await appInstalledFolder.GetFolderAsync("Assets");
var files = await assets1.GetFilesAsync();


I've added the following code but still getting the Native code error.



StorageFolder folder = await Package.Current.InstalledLocation.GetFolderAsync("Assets");
// StorageFolder folder = ApplicationData.Current.LocalFolder;
var options = new QueryOptions();
options.FileTypeFilter.Add(".jpg");//this will add .csv files to query options
options.FolderDepth = FolderDepth.Deep;//optional
StorageFileQueryResult query = folder.CreateFileQueryWithOptions(options);
IReadOnlyList<StorageFile> fileList = await query.GetFilesAsync();


error from debugger: To inspect the native object, enable native code debugging.










share|improve this question
















I'm trying to view the files in my "Assets" folder. I can see if one file is there because it won't allow me to add it again. However, I want to see all of the files in the debugger but I get the following error:



"To inspect the native object, enable native code debugging."



Here is the code I'm trying to debug/inspect.



StorageFolder appInstalledFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFolder assets1 = await appInstalledFolder.GetFolderAsync("Assets");
var files = await assets1.GetFilesAsync();


I've added the following code but still getting the Native code error.



StorageFolder folder = await Package.Current.InstalledLocation.GetFolderAsync("Assets");
// StorageFolder folder = ApplicationData.Current.LocalFolder;
var options = new QueryOptions();
options.FileTypeFilter.Add(".jpg");//this will add .csv files to query options
options.FolderDepth = FolderDepth.Deep;//optional
StorageFileQueryResult query = folder.CreateFileQueryWithOptions(options);
IReadOnlyList<StorageFile> fileList = await query.GetFilesAsync();


error from debugger: To inspect the native object, enable native code debugging.







c# uwp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 7:07









Martin Zikmund

23.8k63460




23.8k63460










asked Nov 17 '18 at 16:13









Trey BalutTrey Balut

57531025




57531025








  • 1





    Unable to reproduce your issue, try clean and rebuild solution or launch in release mode

    – Shubham Sahu
    Nov 18 '18 at 5:21














  • 1





    Unable to reproduce your issue, try clean and rebuild solution or launch in release mode

    – Shubham Sahu
    Nov 18 '18 at 5:21








1




1





Unable to reproduce your issue, try clean and rebuild solution or launch in release mode

– Shubham Sahu
Nov 18 '18 at 5:21





Unable to reproduce your issue, try clean and rebuild solution or launch in release mode

– Shubham Sahu
Nov 18 '18 at 5:21












1 Answer
1






active

oldest

votes


















1














This is reproducible by hovering mouse over the variable when debugging:



Reproduction of the error



The reason for this error is the fact that the returned instance is not a classic .NET type but a projection of a native WinRT list into .NET. The proof of this Visual Studio displays just System.__ComObject instead of a type. However, this type acts as a IReadOnlyList<StorageFile> so you can use it as a list even though it is a native type.



If you want to be able to see the contents in the debugger, you will need to manually convert it to a purely .NET type, for example using ToArray LINQ extension method:



var files = 
(await ApplicationData.Current.LocalFolder.GetFilesAsync())
.ToArray();


This will make files a regular .NET array, which is fully inspectable by the debugger.



Debugger now displays data






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53353033%2fuwp-list-assets-files%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    This is reproducible by hovering mouse over the variable when debugging:



    Reproduction of the error



    The reason for this error is the fact that the returned instance is not a classic .NET type but a projection of a native WinRT list into .NET. The proof of this Visual Studio displays just System.__ComObject instead of a type. However, this type acts as a IReadOnlyList<StorageFile> so you can use it as a list even though it is a native type.



    If you want to be able to see the contents in the debugger, you will need to manually convert it to a purely .NET type, for example using ToArray LINQ extension method:



    var files = 
    (await ApplicationData.Current.LocalFolder.GetFilesAsync())
    .ToArray();


    This will make files a regular .NET array, which is fully inspectable by the debugger.



    Debugger now displays data






    share|improve this answer




























      1














      This is reproducible by hovering mouse over the variable when debugging:



      Reproduction of the error



      The reason for this error is the fact that the returned instance is not a classic .NET type but a projection of a native WinRT list into .NET. The proof of this Visual Studio displays just System.__ComObject instead of a type. However, this type acts as a IReadOnlyList<StorageFile> so you can use it as a list even though it is a native type.



      If you want to be able to see the contents in the debugger, you will need to manually convert it to a purely .NET type, for example using ToArray LINQ extension method:



      var files = 
      (await ApplicationData.Current.LocalFolder.GetFilesAsync())
      .ToArray();


      This will make files a regular .NET array, which is fully inspectable by the debugger.



      Debugger now displays data






      share|improve this answer


























        1












        1








        1







        This is reproducible by hovering mouse over the variable when debugging:



        Reproduction of the error



        The reason for this error is the fact that the returned instance is not a classic .NET type but a projection of a native WinRT list into .NET. The proof of this Visual Studio displays just System.__ComObject instead of a type. However, this type acts as a IReadOnlyList<StorageFile> so you can use it as a list even though it is a native type.



        If you want to be able to see the contents in the debugger, you will need to manually convert it to a purely .NET type, for example using ToArray LINQ extension method:



        var files = 
        (await ApplicationData.Current.LocalFolder.GetFilesAsync())
        .ToArray();


        This will make files a regular .NET array, which is fully inspectable by the debugger.



        Debugger now displays data






        share|improve this answer













        This is reproducible by hovering mouse over the variable when debugging:



        Reproduction of the error



        The reason for this error is the fact that the returned instance is not a classic .NET type but a projection of a native WinRT list into .NET. The proof of this Visual Studio displays just System.__ComObject instead of a type. However, this type acts as a IReadOnlyList<StorageFile> so you can use it as a list even though it is a native type.



        If you want to be able to see the contents in the debugger, you will need to manually convert it to a purely .NET type, for example using ToArray LINQ extension method:



        var files = 
        (await ApplicationData.Current.LocalFolder.GetFilesAsync())
        .ToArray();


        This will make files a regular .NET array, which is fully inspectable by the debugger.



        Debugger now displays data







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 19 '18 at 7:20









        Martin ZikmundMartin Zikmund

        23.8k63460




        23.8k63460






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53353033%2fuwp-list-assets-files%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?