UnauthorizedAccessException when using QTObjectModelLib.dll - c#

I follow an example from SO answer how to run QTP script from C#. However during Application object creation I get UnauthorizedAccessException. Any clues what might be wrong? Here is a screenshot of the exception and the source code.

If you're on Windows 7 or Vista, have a go at starting your development area as Administrator, chances are you're getting an Access Violation.

Quoting the OP of the original post you refer to:
This code did work. However, for QTP version 10.0, I had to change
using QTObjectModelLib; to using QuickTest;.
Might help if you are also using version 10.0.

Related

WinUI 3 calling ApplicationData.Current() throws System.TypeInitializationException

I am trying to convert a windows desktop application from WinUI 2 to WinUI 3. However, I am having a problem with the Windows.Storage.ApplicationData class. When I call ApplicationData.Current (so I can access a file in the app's local data store or to get a local setting) a System.TypeInitializationException exception is thrown.
The following screenshot shows the problem:
System.TypeInitializationException
(This is a default application that I created in Visual Studio 2022 using the project template "Blank App, Packaged (WinUI 3 in Desktop)", the only change I made was to add the line to get the current ApplicationData object in the App class's OnLaunched() method:
var appData = Windows.Storage.ApplicationData.Current;)
Any idea what I am doing wrong here? I think maybe there is a trust or cababilities issue, or I should use other methods to get the app's local data folder or settings for a WinUI 3 desktop application.
I encountered the same problem recently. No matter where I made the call in my WinUI 3 application, whenever I invoked a call to the ApplicationData API, I would always encounter the same exact exception (System.TypeInitializationException with an inner COMException). I failed to find an answer in the API documentation, particularly where one would hope to find such an answer. (If it's there, it's buried or perhaps easily overlooked by someone who is not as familiar with .NET programming, such as myself.) The following line of code always threw an exception for me:
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
The solution that worked for me was something I learned from a response to an issue on the WindowsAppSDK GitHub repository. To quote the information I found most relevant to the issue I was having:
A client that is not running in an App Container must open ApplicationData using this API: https://learn.microsoft.com/en-us/uwp/api/Windows.Management.Core.ApplicationDataManager?view=winrt-22000, while a client that is running in an App Container must open ApplicationData using this API instead: https://learn.microsoft.com/en-us/uwp/api/windows.storage.applicationdata?view=winrt-22000
Basically, I learned that I needed to open ApplicationData using the ApplicationDataManager class. As noted from the GitHub link, the solution I found was to replace the offending line of code with the following:
var localSettings = ApplicationDataManager.CreateForPackageFamily(Package.Current.Id.FamilyName).LocalSettings;
From there I can save and load app settings as usual, which is suitably explained here:
localSettings.Values["test setting"] = "a device specific setting";
String localValue = localSettings.Values["test setting"] as string;
Hopefully this helps anyone who finds themselves facing the same issue.
Scratch that, the problem only happens if in the debugger I put a breakpoint on the "ApplicationData.Current" line. Very weird. I think I am having the same problem as here:
Getting values of ApplicationData.Current.LocalSettings in static context

NReco.PdfGenerator.WkHtmlToPdfException: exit code: -1073741521

I working on a pdf generator with NRec PdfGenerator and it works fine at the start when I working with local, once I package up and deploy to server it fail and show the error message
Cannot generate PDF: (exit code: -1073741521) ---> NReco.PdfGenerator.WkHtmlToPdfException: (exit code: -1073741521)
I not sure whats causing it and I believe is not related to the code itself, and I could find any related post or article that about the exit code shown.
Is there anyway to fix this error?
Any advice to this will be appreciated. Thanks.
As Vitaliy Fedorchenko commented, the problem, in the compatible operating systems, can be solved by installing the missing required Universal C runtime libs ( https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows ).

Error Calling a JAVA web service after Windows Update KB3147458

Some weeks ago, our team installed an application that calls a webservice (https://palena.sii.cl/DTEWS/CrSeed.jws?wsdl) on a Windows 10 Machine. Weeks later, the windows update installed a critical security update (KB3147458) and the application stop working as intended. This is the error:
The first thing i did. It was to check the enconding of the XML sended by the application. Unfortunately, the file was using UTF-8 without BOM and from that moment i couldn't figure out whats the cause of the error. This is the output file:
Im writting because i need your help to figure out whats the problem. If you want to reproduce it, add the WSDL (https://palena.sii.cl/DTEWS/CrSeed.jws?wsdl) as a WebReference and call the getSeed method, using an updated Windows 10.
Thank you in advance.
I have the same problem... Until now I only found two possible solutions:
Uninstall the KB3147458 and try again.
Update you application to Framework 4.6.
There is a SSLStream break... More Info here: https://connect.microsoft.com/VisualStudio/feedback/details/2590316/windows-10-update-kb3147458-changes-behavior-of-sslstream-read-beginread-endread

Driver Installed - Still cannot use OleDB reader

I have code in a Provider-Hosted App for SharePoint which calls the OleDBDataReader class in order to parse a .xslx file. In my development environment, the following exception appeared until I installed this driver.
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. I have moved to pre-production, and the error has popped up again even though the admins of the IIS box are swearing back and forth that the driver is installed. They've sent me a screenshot of the install, and it looks like it's the same version I have. They refuse to uninstall and reinstall it since another application is apparently relying on it at the moment. Is there anything else that I can do on my end other than rewrite the code to look at some way of parsing the .xslx file using its stream instead?
I have read through many of the other topics about this, and I can't seem to find anyone doing something differently.
This thread seems to be about a similar error(granted it's for Access database), but the solution may be able to help with your problem:
In that thread the OP also installed the drivers you've linked ,that also failed so s/he installed these drivers:
http://www.microsoft.com/download/en/confirmation.aspx?id=23734
which worked apparently , try that.
I did a quick search on MSDN and the alternative download for your issue is the Office System Driver: Data Connectivity Components
The solution was for the engineering team to complete "repair" on the installation from add/remove programs.. This took forever to have them try, but it worked!

What's the default file path in WinRT/WP 8.1?

Hello fellow programmers.
I recently made a mistake while using the SQLite-NET package for Windows Phone 8.1. When opening a new SQLiteConnection, I would give as parameter to its constructor the string "data.db", without being actually aware of what was going on under the hood. Later on, I noticed that the file wouldn't be deleted, even if I uninstalled the application (since I would have in my app the same entries that I had before uninstalling it); I assume that I should be using the local folder for application data instead.
However, here is the real question: what the hell is the folder where the data.db file was created? I tried to figure it out with the following piece of code:
var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///data.db"));
System.Diagnostics.Debug.WriteLine(file.Path);
and what I got as output of the WriteLine method was the path
C:\Data\SharedData\PhoneTools\AppxLayouts\f7529f24-ba24-4fdb-8353-cff9214180a0VS.Debug_ARM.Valbrand\data.db,
which only got me even more confused. I couldn't find any satisfactory info on this, and I would REALLY like to further my understanding of what happened here.
Thanks in advance!
The path you are looking at is the install directory of your app. You have a Silverlight 8.1 app, so the path is slightly different than a Silverlight 8.0 app, but the articles here and here will help you get a rough understanding.
The recommended usage of this directory is to take the resources that you want backed up out of it on first run and move them to the app data container, so they can be backed up by the system.
C:\Data\SharedData\PhoneTools\AppxLayouts\f7529f24-ba24-4fdb-8353-cff9214180a0VS.Debug_ARM.Valbrand\data.db
This is the path on your phone/emulator.
And This is not the location where you can find in your PC.

Categories