In the sample code of NativeXamlIslands, I add the following code to test the StorageFile::GetFileFromApplicationUriAsync API of c++/winrt in MainUserControl.cpp file, but it doesn't work:
static const Uri s_jsonFileUri{ L"ms-appx:///Images/Activities.json" };
IAsyncAction GetActivitiesAsync()
{
auto jsonText{ co_await FileIO::ReadTextAsync(co_await StorageFile::GetFileFromApplicationUriAsync(s_jsonFileUri)) };
printf("hello.\n");
}
MainUserControl::MainUserControl()
{
GetActivitiesAsync();
InitializeComponent();
}
Please let me know what the reason behind? Thanks a lot!