we have an old legacy app which uses Java version 1.6 update 45 (jdk-6u45-windows-i586.exe) and Jacob.dll 1.8 (jacob_18.zip), and which cannot be updated :(
Everything was working fine till the latest Windows 10 1809 Update. Since then the comobject behavior seems to have changed and causes an error as well as that the word document cannot be saved anymore. I also tried 19H1 but got the same error.
I could reproduce the issue in java with following code, of course you have to import the Jacob.dll:
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Variant;
import com.jacob.com.Dispatch;
ActiveXComponent oWord = new ActiveXComponent("Word.Application");
oWord.setProperty("Visible", new Variant(true));
Dispatch documents = oWord.getProperty("Documents").toDispatch();
String str_file = "C:/temp/test.rtf";
Dispatch doc = Dispatch.invoke(documents, "Open", Dispatch.Method,
new Object[]{str_file},
new int[1]).toDispatch();
The error I get is:
Exception in thread "main" com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: Open
Description: An unknown COM error has occured.
at com.jacob.com.Dispatch.invokev(Native Method)
at com.jacob.com.Dispatch.invokev(Dispatch.java:384)
at com.jacob.com.Dispatch.invoke(Dispatch.java:267)
at Main.main(Main.java:21)
When I click on the Dispatch errors I only get that it is not a valid line number in com.jacob.com.Dispatch
I know it is not the best day not updating the legacy app itself, but what can I say, it is as it is.
Any ideas what might have changed in Windows >= 1809 or how it can be solved without touching the app?
Thanks
Stephan
Edit:
Dispatch oDocument = Dispatch.call(documents, "Open", str_file).toDispatch(); leads to the same error
I should mention that Word opens, but I am not able to save the file and that the return value is an error
OK, the error is the same which is covered in this post:
Exception from Word.ApplicationClass.Activedocument all of a sudden
So it seems to be a bug in >=1809 and for the moment the only fix is to change/play with the regional settings
Related
I am evaluating pywinauto library to be able to automate win desktop applications and so far it looks very promising. For evaluation I am using simple BookDB2 app which I used many times before (e.g.: by testComplete or UFT evaluations). Unlike other objects in this app - which I am able to find and work with, pywinauto for some reason cannot see its ListView object.
When used:
from pywinauto.application import Application
app = Application(backend='uia').start(r"C:\Program Files (x86)\BookDB2\BookDB2.exe")
app.top_window().print_control_identifiers()
python prints all found objects to log, however ListView object is missing. I also tried to find it directly using its properties (with help of AutoIt spy tool), but was unsuccessful. Normally I would think that this ListView is customized (non-standard) - because that could be good explanation why it is not recognized. But I know that UFT and testComplete did not have a slightest problem to recognize&work with it. What am I missing?
Update:
I tried SWAPY - which is kind of pywinauto support tool capable of object spying and generating simple code.
I found out that SWAPY actually can see this ListView object and it generated for me click operation:
from pywinauto.application import Application
app = Application().Start(cmd_line=u'"C:\\Program Files (x86)\\BookDB2\\BookDB2.exe" ')
thunderrtformdc = app[u'BookDB Main Menu']
thunderrtformdc.Wait('ready')
listviewwndclass = thunderrtformdc[u'3']
listviewwndclass.Click()
app.Kill_()
When executed in PyCharm - this error appeared:
raise MatchError(items = name_control_map.keys(), tofind = search_text)
pywinauto.findbestmatch.MatchError: Could not find '3' in 'dict_keys(['ThunderRT6Frame', 'FiltersThunderRT6Frame', 'Filters', 'ApplyButton', 'Button', 'Apply', 'ClearButton', 'Button0', 'Button1', 'Button2', 'Clear', 'Add BookEdit', 'Edit', 'Add BookEdit0', 'Add BookEdit1', 'Add BookEdit2', 'Edit0', 'Edit1', 'Edit2', 'ComboBox', 'ApplyComboBox', 'ComboBox0', 'ComboBox1', 'ComboBox2', 'Add BookComboBox', 'Button3', 'Copies', 'CopiesButton', 'Button4', 'Add Book', 'Add BookButton', 'BooksListView', 'ListView', 'BooksHeader', 'Header', 'Button5', 'BorrowersButton', 'Borrowers', 'Button6', 'CategoriesButton', 'Categories', 'Button7', 'Publishers', 'PublishersButton', 'Authors', 'Button8', 'AuthorsButton', 'Button9', 'BooksButton', 'Books'])'
So it seems to me that SWAPY sees something which pywinauto cannot.
Ok... so it was all my mistake. This is correct:
app = Application().start(r"C:\Program Files (x86)\BookDB2\BookDB2.exe")
for some reason I forgot backend='uia' in code when starting the app, probably copy&paste error. Still not sure why other objects were visible and this (ListView) wasn't but at least my problem is solved.
I'm trying to test some different queries in an F# script file against my Azure CosmosDb, but I'm getting an error regarding a missing DLL when I try to execute a query itself.
I'm loading the Documents.Client.dll:
#r "../packages/Microsoft.Azure.DocumentDB/lib/net45/Microsoft.Azure.Documents.Client.dll"
open Microsoft.Azure.Documents
open Microsoft.Azure.Documents.Client
open Microsoft.Azure.Documents.Linq
But when I execute a query:
Seq.toList <| query {
//some query that I copy & pasted from a working file
}
I get this error:
System.AggregateException: One or more errors occurred. ---> System.DllNotFoundException: Unable to load DLL 'Microsoft.Azure.Documents.ServiceInterop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Microsoft.Azure.Documents.ServiceInteropWrapper.CreateServiceProvider(String configJsonString, IntPtr& serviceProvider)
at Microsoft.Azure.Documents.Query.QueryPartitionProvider.Initialize()
at Microsoft.Azure.Documents.Query.QueryPartitionProvider.GetPartitionedQueryExecutionInfoInternal(SqlQuerySpec querySpec, PartitionKeyDefinition partitionKeyDefinition, Boolean requireFormattableOrderByQuery, Boolean isContinuationExpected)
at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextBase.<GetPartitionedQueryExecutionInfoAsync>d__0.MoveNext()
(there is more in the stack trace - this is just the top of it).
I can't find the ServiceInterop dll anywhere - it's not referenced in any projects or in my packages folder, and it's not a nuget reference. I'm not sure what I could be missing to only get this error in F# Interactive.
Update
Following the advice in the comments from #tomislav-markovski, I changed the version of Microsoft.Azure.DocumentDB to 1.13.2. This does create the ServiceInterop dll in the package folder, but now running my query in F# interactive gives this output:
--> Referenced 'c:\VSTS\MyApplication\../packages/Microsoft.Azure.DocumentDB/lib/net45/Microsoft.Azure.Documents.Client.dll' (file may be locked by F# Interactive process)
Script.fsx(5,1): error FS0229: Error opening binary file 'c:\VSTS\MyApplication\../packages/Microsoft.Azure.DocumentDb/runtimes/win7-x64/native/Microsoft.Azure.Documents.ServiceInterop.dll': c:\VSTS\MyApplication\../packages/Micro
soft.Azure.DocumentDb/runtimes/win7-x64/native/Microsoft.Azure.Documents.ServiceInterop.dll: bad cli header, rva 0
Script.fsx(5,1): error FS3160: Problem reading assembly 'c:\VSTS\MyApplication\../packages/Microsoft.Azure.DocumentDb/runtimes/win7-x64/native/Microsoft.Azure.Documents.ServiceInterop.dll': Exception of type 'Microsoft.FSharp.Compiler.ErrorLogger+
StopProcessingExn' was thrown.
The "File may be locked" error seems like it's important, but I closed & reopened VSCode to make sure that instance of F# Interactive wasn't holding on to anything. I am referencing the Service Interop file:
#r "../packages/Microsoft.Azure.DocumentDb/runtimes/win7-x64/native/Microsoft.Azure.Documents.ServiceInterop.dll"
If I remove this, the above errors go away... and I go back to the query itself crashing because of the missing DLL.
Update 2
I've tried a few additional things:
Absolute instead of relative pathing to the Client.dll. This results in the "missing service interop dll" error.
Absolute instead of relative pathing to the 'ServiceInterop.dll'. This results in the "error opening binary file" error.
Using #I to load the DLL with easier pathing:
#I "../packages/Microsoft.Azure.DocumentDB/lib/net45/"
#r "Microsoft.Azure.Documents.Client.dll"
Results in the same "missing ServiceInterop.dll" error.
Simplifying the query:
Seq.toList <| query {
for t in client.CreateDocumentQuery( documentCollectionUri()) do
select t
}
This resulted in the same "missing ServiceInterop.dll" error.
5. Using FeedOptions with "Enable Cross Partiiton Query" on:
let feedOptions = FeedOptions()
feedOptions.EnableCrossPartitionQuery <- true
feedOptions.MaxItemCount <- 3 |> System.Nullable
Seq.toList <| query {
for t in client.CreateDocumentQuery( documentCollectionUri(), feedOptions ) do
select t
}
As you can see, I also tried setting the max item count. Both of these gave the same "missing ServiceInterop.dll" error.
The closest thing to a solution for this that I was able to find was to add the location of the ServiceInterop.dll to the Path environment variable for the duration of the FSI session, something like so:
open System
open System.IO
// get existing contents of path env var
let path = Environment.GetEnvironmentVariable("Path")
// get location where nuget puts the service interop dll
let serviceInteropDir = #C:\User\<USERNAME>\.nuget\packages\microsoft.azure.documentdb.core\1.9.1\runtimes\win\native"
// add service interop location to the end of the path
let newPath = path + ";" + serviceInteropDir
// update the path env var with the new path
Environment.SetEnvironmentVariable("Path", newPath)
NOTE: Notice I am using version 1.9.1 of the DocumentDB.Core package. There seems to be a strong naming problem with the 1.10.0 version of the DocumentDB.Core package, so avoid that version until a fix is released or a workaround is found.
My UWP app is crashing in Release mode and works fine in Debug mode but I can't put my finger on what the issue is but I know it's related to a combination of raising an event from System.Threading.Timer and MVVMLight.
I created an new dummy application and use the same code (ZXing.net.mobile where I used 2 portable libraries and I used my own user control which is a simplified version of theirs - I'm using events instead of <Action>). This works fine and I'm currently trying to put more steps into it i.e. include mvvmlight and navigation but so far, I can't reproduce the problem in this dummy app.
The error I'm getting is:
Unhandled exception at 0x58C1AF0B (mrt100_app.dll) in Company.MyApp.App.exe:
0xC0000602: A fail fast exception occurred. Exception handlers will not be
invoked and the process will be terminated immediately.
Followed by:
Unhandled exception at 0x0107D201 (SharedLibrary.dll) in
Company.MyApp.App.exe: 0x00001007.
When looking at the Threads window, one of the worker thread has the following information if that's of help.
Not Flagged > 4012 0 Worker Thread <No Name>
System.Private.Interop.dll!System.Runtime.InteropServices.
ExceptionHelpers.ReportUnhandledError Normal
[External Code]
System.Private.Interop.dll!System.Runtime.InteropServices.ExceptionHelpers.
ReportUnhandledError(System.Exception e) Line 885
System.Private.Interop.dll!Internal.Interop.InteropCallbacks.ReportUnhandledError
(System.Exception ex) Line 17
System.Private.WinRTInterop.CoreLib.dll!Internal.WinRT.Interop.WinRTCallbacks.
ReportUnhandledError(System.Exception ex) Line 274
System.Private.CoreLib.dll!System.RuntimeExceptionHelpers.ReportUnhandledException
(System.Exception exception) Line 152
System.Private.Threading.dll!System.Threading.Tasks.AwaitTaskContinuation.
ThrowAsyncIfNecessary(System.Exception exc) Line 784
System.Private.Threading.dll!System.Threading.WinRTSynchronizationContext.Invoker.
InvokeCore() Line 182
System.Private.Threading.dll!System.Threading.WinRTSynchronizationContext.Invoker.
Invoke(object thisObj) Line 162
System.Private.CoreLib.dll!System.Action<System.__Canon>.
InvokeOpenStaticThunk(System.__Canon obj)
System.Private.WinRTInterop.CoreLib.dll!Internal.WinRT.Interop.WinRTCallbacks.PostToCoreDispatcher.AnonymousMethod__0() Line 266
MyCompany.MyApp.App.exe
MyCompany.MyApp.App.ViewModels.ValidateHandler.Invoke(string pin)
MyCompany.MyApp.App.McgInterop.dll!McgInterop.ReverseComSharedStubs
.Proc_(object __this, System.IntPtr __methodPtr) Line 6163
MyCompany.MyApp.App.McgInterop.dll!Windows.UI.Core.DispatchedHandler__Impl.Vtbl.Invoke__STUB(System.IntPtr pComThis) Line 45147
[External Code]
Within my QR Code UserControl, it's using a System.Threading.Timer and it raises an event when a QR Code is found:
timerPreview = new Timer(async (state) =>
{
....
// Check if a result was found
if (result != null && !string.IsNullOrEmpty(result.Text))
{
Debug.WriteLine("Barcode Found: " + result.Text);
if (!this.ContinuousScanning)
{
delay = Timeout.Infinite;
await StopScanningAsync();
}
else
{
delay = this.ScanningOptions.DelayBetweenContinuousScans;
}
OnBarcodeFound(result.Text);
}
timerPreview.Change(delay, Timeout.Infinite);
}, null,
this.ScanningOptions.InitialDelayBeforeAnalyzingFrames,
Timeout.Infinite);
In the page that host the QRCode UserControl, I've got the following code:
private async void ScannerControl_BarcodeFound(string barcodeValue)
{
var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher;
await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
Debug.WriteLine(barcodeValue);
GetViewModel.BarcodeFound(barcodeValue);
});
}
As you can see, I'm passing the QrCode value to my ViewModel and from there, I sent a message and then re-direct to another page:
public void BarcodeFound(string barcodeData)
{
Messenger.Default.Send<string>(barcodeData, MessengerTokens.QrCodeFound);
this.NavigationFacade.NavigateToMyOtherPage();
}
I could keep going and provide additional code, but as I add additional breakpoints I can see that the code and passing the correct value and going to the correct location but eventually it throws this error. If I add additional error handlers or dispatcher code, it eventually works and goes to the next page as expected but when I click on a button in my CommandBar, it then takes a while and it eventually throws the same error, so by adding these additional bits of code, I feel I'm just pushing down the problem further down the line.
Anyone got any suggestions on how I get around this problem. I wish I could share the full app but definitely can't. So I know it will be hard to provide a solution, but if anyone has suggestions I'd appreciate them.
As I said, I think the issue is a result of a combination of threading and mvvmlight but it's driving me nuts that my test app so far is working exactly as expected, so I'm pretty sure it's not Zxing or my UserControl.
Any help, suggestions would be greatly appreciated or if you need me to provide additional info, please let me know what and I'll try to provide it.
Thanks.
Well, this was a painstaking exercise and a huge waste of my time!
It was down to a few things!!
I was using a different DataService in Releasemode which wasn't implemented. By implemented, I mean all my functions were returning the NotImplementedException or null values.
When passing my model to my ViewModel, I did not check if it was null, thus causing unhandled exceptions.
I had a chain of mvvmlight events (Messenger.Default.Send<>) being triggered and none were checking for error or null values.
While all of these were caused by poor validation from my part, these errors are extremely poorly reported in Release mode! if from the get go, I had received a NullReferenceException or any kind of exceptions, it would have put me in the right direction immediately, but throwing errors such as the one I've had were totally useless but it didn't but lesson learned!!
All I can say is that if this problem ever happens to you, don't waste your time rewriting code or trying to find workarounds. First work your way through your workflow/chain of events and hopefully, you'll eventually catch the culprit.
Hope this helps.
Sadly we were facing a similar issue, ours was involved with setting the qualifier values for changing localization on the fly in the app but came up with mystery fail fast/SharedLibrary native errors. Upgrading the Microsoft.NETCore.UniversalWindowPlatform package from 6.0.4 to 6.0.7 seems to have resolved the issue.
Only thought of this because another place I was researching this error involved someone solving a SharedLibrary problem by upgrading their NETCore package, that case was an earlier one (5.x), but figured it was worth a shot.
I now went to put this code check SO into another app and I am getting an error on the line:
if ((self = originalImp(self, _cmd, cf))) {
The build error is:
"Too many arguments to function call, expected 0, have 3"
I am using Xcode 6.2 compiling for iOS 7.1
Thanks
K
You can Disable the check in the Project Build Settings by setting 'Enable strict checking of objc_msgSend Calls' to No.
Has worked for me in similar situations. Filter the Build Settings on the keyword 'strict' to find it easily.
My project has a requirement that it needs to check the password complexity before create the new account.
My code looks like:
NET_API_STATUS status;
NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG inputArg = {0};
NET_VALIDATE_OUTPUT_ARG* pOutputArg = NULL;
inputArg.ClearPassword = NewPass;
inputArg.PasswordMatch = TRUE;
status = NetValidatePasswordPolicy(DC, NULL, NetValidatePasswordChange,
&inputArg, (void**)&pOutputArg);
printf("status: %d, validationStatus: %d\n", status, pOutputArg->ValidationStatus);
NetValidatePasswordPolicyFree((void**)&pOutputArg);
I am working on windows XP.When I try to run, it prompt waring saying:
The procedure entry point NetValidPasswordPolicyFree could not be located in the dynamic link library NETAPI32.dll
From the MSDN it said the API is only valid in 2003 server and 2008 server.
Does it mean it can not work on XP?
Or can i find any other APIs to do the same thing as NetValidPasswordPolicy?
I googled a lot for this issue and found someone had asked similar question but it went unanswered :(. So, here I am trying my luck.
Even I tried to analyze 'NETAPI32.dll' in Reflector.exe, but while opening the .dll file it error out: Object reference not set to an instance of an object.
I am stuck badly and could not able to find any way. Any help will be appreciated :)
Issue has been solved :).
NetValidPasswordPolicy API from 'NETAPI32.dll' has requirements that it is not 'client' supported. Because of this requirement I am getting the warning: Entry point not found.
I tried my project on Windows 2003 server and it worked.
And my second question about 'Reflector.exe' is also invalid because 'NETAPI32.dll' is not .Net dll so Reflector wont recognize it.