Windows Store app local folder data lost when running WACK? - windows-store-apps

My first Windows Store App is almost ready to be uploaded. It passed the Windows App Certification Kit test on my machine. However if I "build packages to upload to Windows Store", it fails the test due to "Crashes and hangs". I found out that the WACK deletes my package folder before running the test, and because the app needs to load data from there upon start, it will probably not find it and thus hangs.
My questions are:
What happens to the files in my Local folder (i.e. C:\Users\...\AppData\Local\Packages\packageName\LocalState) when the app is packaged?
If I need to read and write data from files upon app start, where should I keep these files?
Thank you a lot for your time!
I am using Visual Studio 2013 Update 2, WACK 3.4.
Here is some code that runs when my app starts, I try to deserialize an existing file in the Local folder:
StorageFolder localFolder = ApplicationData.Current.LocalFolder;
StorageFolder demoFolder = await localFolder.CreateFolderAsync("Demos", CreationCollisionOption.OpenIfExists);
StorageFolder gameRecordFolder = await demoFolder.CreateFolderAsync("GameRecords", CreationCollisionOption.OpenIfExists);
string filename = gameRecName+".xaml";
StorageFile gameFile = await gameRecordFolder.GetFileAsync(filename);
GameRecord g;
using (Stream fileStream = await gameFile.OpenStreamForReadAsync())
{
XmlSerializer serializer = new XmlSerializer(typeof(GameRecord));
g = (GameRecord)serializer.Deserialize(fileStream);
}

Related

Install multiple vs code extensions in CICD

My unit test launch looks like this. As you can see I have exploited CLI options to install a VSIX my CICD has already produced, and then also tried to install ms-vscode-remote.remote-ssh because I want to re-run the tests on a remote workspace.
import * as path from 'path';
import * as fs from 'fs';
import { runTests } from '#vscode/test-electron';
async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
// The path to the extension test runner script
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, './suite/index');
const vsixName = fs.readdirSync(extensionDevelopmentPath)
.filter(p => path.extname(p) === ".vsix")
.sort((a, b) => a < b ? 1 : a > b ? -1 : 0)[0];
const launchArgsLocal = [
path.resolve(__dirname, '../../src/test/test-docs'),
"--install-extension",
vsixName,
"--install-extension",
"ms-vscode-remote.remote-ssh"
];
const SSH_HOST = process.argv[2];
const SSH_WORKSPACE = process.argv[3];
const launchArgsRemote = [
"--folder-uri",
`vscode-remote://ssh-remote+testuser#${SSH_HOST}${SSH_WORKSPACE}`
];
// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs: launchArgsLocal });
await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs: launchArgsRemote });
} catch (err) {
console.error(err);
console.error('Failed to run tests');
process.exit(1);
}
}
main();
runTests downloads and installs VS Code, and passes through the parameters I supply. For the local file system all the tests pass, so the extension from the VSIX is definitely installed.
But ms-vscode-remote.remote-ssh doesn't seem to be installed - I get this error:
Cannot get canonical URI because no extension is installed to resolve ssh-remote
and then the tests fail because there's no open workspace.
This may be related to the fact that CLI installation of multiple extensions repeats the --install-extension switch. I suspect the switch name is used as a hash key.
What to do? Well, I'm not committed to any particular course of action, just platform independence. If I knew how to do a platform independent headless CLI installation of VS Code:latest in a GitHub Action, that would certainly do the trick. I could then directly use the CLI to install the extensions before the tests, and pass the installation path. Which would also require a unified way to get the path for vs code.
Update 2022-07-20
Having figured out how to do a platform independent headless CLI installation of VS Code:latest in a GitHub Action followed by installation of the required extensions I face new problems.
The test framework options include a path to an existing installation of VS Code. According to the interface documentation, supplying this should cause the test to use the existing installation instead of installing VS Code; this is why I thought the above installation would solve my problems.
However, the option seems to be ignored.
My latest iteration uses an extension dependency on remote-ssh to install it. There's a new problem: how to get the correct version of my extension onto the remote host. By default the remote host uses the marketplace version, which obviously won't be the version we're trying to test.
I would first try with only one --install-extension option, just to check if any extension is installed.
I would also check if the same set of commands works locally (install VSCode and its remote SSH extension)
Testing it locally (with only one extension) also allows to check if that extension has any dependencies (like Remote SSH - Editing)

Angular 7 - Is there a way to load/import json files when angular app is offline?

I have an application that retrieves config information from a json file using "httpClient.get".
The problem comes in when I run the application offline, as in, I open the "index.html" file, the service fails with an error "Http failure response for ./assets/config.json: 0 Unknown Error".
Example code:
let testUrl = "./assets/test.json";
let test = await this.httpClient.get(testUrl).toPromise();
Is there a way to load/read files in Angular 7 when in offline mode?

PupeeteerSharp Does Not Work in ServiceFabric Stateless Service

I am developing web crawler which could render Javascript websites and so I decided to use PupeeteerSharp, a .NET port of popular Node.JS headless Chrome browser Pupeeteer API. I am running Service Fabric's local development cluster on Windows 10 development machine and have one stateless service in my solution.
I've created Data folder under Service project's PackageRoot folder and put .local-chromium folder contents there (contains chrome.exe executable) so it deploys as independent data package of service.
I've also placed this XML config line in ServiceManifest.xml file:
<DataPackage Name="Data" Version="1.0.0" />
So far it looks good and headless browser content is copied to SFCluster Data package directory properly.
Then in my Stateless Service code I try to call Pupeeteer chromium executable as follows:
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = true,
ExecutablePath = _chromiumPath // #$"{context.CodePackageActivationContext.GetDataPackageObject("Data").Path}\.local-chromium\Win64-706915\chrome-win\chrome.exe"
});
using (var page = (await browser.NewPageAsync()))
{
Response renderResponse;
try
{
renderResponse = await page.GoToAsync(webPage.AbsoluteUri, timeout);
if (renderResponse.Status != System.Net.HttpStatusCode.OK)
{
return new RenderResult(RenderStatus.OtherFailure);
}
// other code
}
catch (TimeoutException)
{
return new RenderResult(RenderStatus.Timeouted);
}
In this line: using (var page = (await browser.NewPageAsync())) my code (Thread) simply hangs without returning, in Debug console I see many thread exits, but no exception occurs. I was previously getting System.IO.FileNotFoundException when I was fixing some other errors regarding appropriate copying of chromium folder contents, but now these errors are gone so it seems that code find .exe but somehow cannot start headless mode of PupeeterSharp.
Does that mean that I cannot simply run external .exe chromium binary with Service Fabric's Native Application Model? Should I use Docker and Linux containers instead?

flash app working when run from flash builder 4.6.0, not working when .html file is run?

My problem after building the project in flash builder 4.7 with sdk version 4.0A is as follows:-
1) when i run build-release folder from within flash builder the request from app to server works (the request is initiated in click event).
2) when i run the .html file from projects build-release folder the request is not even initiated in browser network log.
I'm using flash builder 4.7 with sdk 4.0A installed and selected.
Since I'm new to actionscript and flash builder sdk, please a detailed answer will be heartly appreciated.
delete request not being sent from browser the code is like:-
public function sendDelete(params:Object):void{
var request:URLRequest = new URLRequest(url);
request.method = URLRequestMethod.POST;
request.contentType = "application/json";
request.requestHeaders = [new URLRequestHeader('X-HTTP-Method-Override', 'DELETE')];
request.data = JSON.stringify(params);
loader.load(request);
}
app when run/debug from flash builder the request get issued (seen in browsers network log), but when the app is build and run from build-release folder (i.e. running .html file) the request does not get issued (not seen in browsers network log). But if I remove the line " request.requestHeaders = [new URLRequestHeader('X-HTTP-Method-Override', 'DELETE')];" the request works even from build-release folder.

Flex 4.7 Accessing another Application Storage Directory

Is it possible to access another .air application storage directory? Because when I do the following:
private var _installerFile:File = new File("app-storage:/");
var appDir = new File()
appDir = _installerFile.resolvePath("../../..");
I just want to go up from my storage directoy into the App Data and then inside another App directory.
Thanks for the help,
David