Windows App Certification Kit - Security Features error - c#

I am working on a UWP app and I have come across a strange issue with windows app certification kit (WACK).
The app itself runs fine but when I test the app through the WACK it always fails the certification saying that /SomePackagePath/sni.dll failed AppContainerCheck. Also, the supported APIs test shows a long list of unsupported APIs that my app doesn't use but WACK thinks it does. I have no idea why does it do that.
I have created numerous packages and tried to fix code-behind where I thought things could be wrong but to no avail. I tried to search the error on internet and I found out that my app should enable the .Net native tool chain and I checked the project settings and it is already enabled.
The WACK also says something about some linker options that should be set but I have no idea how to set those linker options in VS 2017. I am using the latest VS 2017 with all updates. Any suggestions on what to do? Any help will be greatly appreciated.
I can provide further information if anyone needs it.

The WACK report has said clearly. The "sni.dll" called some APIs which are not supported in UWP. If the "sni.dll" was made by you, I suggested that you'd better check its source code. You could check .NET for UWP apps document to see if this dll calls some unsupported APIs. If this DLL isn't made by you, you could first remove it from your project and create a package to see if it will be able to pass the WACK. Then, you will know if this issue was due to this DLL.
Beside, you could debug your code to see if you will get some exception when enable the "Compile with .NET Native Tool chain" and "Optimize code".

I managed to find the culprit and it was related to Jint nuget package. Apparently it uses some APIs which are not allowed in the UWP system and that also sni.dll is part of this.

Related

Setting up my WPF solution and the "Project doesn't know how to run the profile" error

I've created a solution in VS2022 using the WPF application template (not the one that says (.net framework)) and when trying to run it I get the error popping up:
"The project doesn't know how to run the profile with name 'wpftestproject' and comment 'Project'."
See the image below, it's not an output window error but an actual pop-up window.
I'm on Windows 10 pro and trying to get this template solution to run (it should pop up a MainWindow).
I have no idea what could be the source of this issue and I'm not finding anything online.
One thing I noticed is that under application properties the "Target framework" is default to .NET6.0 and not .NET CORE 3.0 for some reason. Though changing this isn't fixing it.
I've also tried having a look over my VS installation, it doesn't seem to me that anything is missing but maybe someone else knows something:
Normally you need to install correctly, .Net desktop development and universal windows platform development.(Try to reinstall .Net desktop development)
And install the packages you need in individual components.
If reinstalling these does not help you, I suggest you choose update->repair

How can my C# Windows Runtime Component install the WebView2 Runtime?

Pretty simple question. I know how to find out if it's been installed. But, if it hasn't....how do I install it? All of the documentation appears to be geared towards C++ where you can just run Shell commands. I also found something where you can use a FullTrustProcessLauncher but you have to modify the package manifest to get permission and, since this is a component, I can't do that.

Couldn't find the required information in the lock file. Make sure you have .NETCore,Version=v5.0/win10-anycpu mentioned in your targets

I'm working on a Windows 10 universal app. The aim was to have a JS front end connecting to a C# library for the heavy lifting. Though when I add the reference and trey to compile I get the following error
Couldn't find the required information in the lock file. Make sure you
have .NETCore,Version=v5.0/win10-anycpu mentioned in your targets.
I've looked around and in a few cases the solution has been to update Visual Studio and the NuGet packages which I have done.
Any suggestions would be great,
Thanks
Just change build configuration to x86 or ARM and it should work.
Any CPU is not supported by UWP projects, because they are built using .NET Native. You can read more about it here.

Crash on Windows Store App launch on certain PCs(Bing Maps)

When I test my App on other PC(not the one with which I'm developing), it crashes on startup. I've observed that crash occurs only with PCs without Visual Studio installed on it.
I'm using Bing Maps SDK in my app, so the problem is probably related to this: discussion of the problem -> see Q&A section.
I've tried compiling in Release, but the problem persists. Is there any workaround, or we should just stand here, waiting to MS to release new version of SDK?
UPD: Seems like VS don't leave Bing Map SDK binaries in Dependencies folder of App package. How one force VS to include binaries in build?
UPD2: Problem solved - it wasn't Bing Maps fault, but an error in my code. Never blame other before you're 100% sure about yourself ;)

Register COM Interop Dlls with WISE

The application I'm talking about consists of vb6 (80%) and c#, .Net Framework 4.0 (20%).
All new components are created with c#. With Microsoft Interop Forms Toolkit 2.1 we create the COM UserControls that we later embed in vb6. For Forms we use normal classes to create and open in vb6 (COM Visible project).
To create the setup we use wise.
Locally everything works fine - The problems only occur when we install the application on a non-developer machine with the wise created setup.
We added a class to open a c# Form to an existing interop toolkit project. It works fine on the developer machine and also when we make a new installation on a pc(non-dev-machine). The new class is just used to open the form.
But when we update our application to a newer version, that class is not working anymore. We have to uninstall the old version and install the new version to make it work again.
Anyone had a similar problems before?
I'm grateful for any advice
This seems like it is an issue with Windows Installer and the sequencing during the upgrade. Does your application allow side by side installs (e.g. Version 1 and Version 2 can be installed at the same time) or does your installer upgrade earlier versions to the latest version? You might try logging the installation and reviewing the log file to see exactly what is happening during the install / upgrade process.
You can log an msi installation by invoking Msiexec from a command line.
This may provide greater insight and help focus your efforts to debugging the problem.
Edit
From what you've described it seems that on fresh installation the install works as expected. When you upgrade earlier versions it would seem that the COM Interop components are not registered properly. This could be an indication that the sequence of events is a little off with regards to when the components are copied to the machine and registered vs. when the existing product is removed. While not exactly identical, see this SO Question and answer for more details. Also, have a look at the RemoveExistingProducts action in Windows Installer for more information.
I would log an installation that you know works without issue (e.g. on a "clean" machine) and then log an installation that you know will fail (e.g. an upgrade) and then compare the two log files using a tool to see if the output is identical. If not, that gives you a clue as to where to look. If they are identical it might be time to engage with the vendor and see if they can assist with determining what's causing the issue.

Categories

Resources