Test App / QApplication / AccessViolationException
Hecatron opened this issue · 15 comments
Hi,
I've recently created a couple of test apps over here
https://github.com/grbd/QtSharp.TestApps
just to see if I could create a basic form, or load in a ui file.
As you've mentioned I've stuck with VS2013 and avoided VS2015, and so far I've been using the the CppSharp dll's from the QtSharp repo (Also the apps are already set to x86)
It looks as if some functions work, but others generate AccessViolationException errors.
Showing a form or loading a ui file seems to be out of the question for the moment
One thing I did notice is in relation to the QApplication class, for argv it seems to take a char** parameter which I think means it's unmanaged / unwrapped. I was able to get around this with some marsheling in C# although this rules out the use of VB for now, and it means you have to use unsafe code blocks.
Also it looks like QApplication is missing the exec function, which is one of the core ones needed to run a QT App.
I realise these are probably Cppsharp related problems, but I just thought to mention them for info.
The last thing I'm going to try is rebuilding the latest CppSharp to see if that makes any difference.
Thank you for the effort to create those samples, they are definitely going to help progress.
- As soon as I am able to, I am going to check loading *.ui-s and fix the errors;
- We do not handle char** as well as we could in C++#, it's a missing feature. One of my end goals is definitely to remove any pointers from the generated API. It just needs more work to cover all cases. Before this summer it was even worse but thanks to @genuinelucifer we now have ref parameters instead of pointers;
- QApplication.Exec() is there, it's just static. The pattern to use in Qt is QApplication app(argc, argv); ... return QApplication::exec();
- I am afraid it won't help because I already use the latest C++#. It needs debugging.
I will get back to you when I have more time. Then we might think about merging your samples into the Qt# repo.
Thanks for the info on QApplication
I've added a load of comments to the test app, so I'll leave it for now
That's interesting, it looks like the last couple of commits to Cppsharp now allow for the creating of widgets, Creating a basic widget now works (the BasicFormTest function). Good job it's the first time I've seen something working / on screen.
Loading a ui still fails at QtWidgets.QWidget CreateWidget, but I think it's getting further than before
I've been using the latest QT so far, 5.5.0 I might try and see what happens with older versions
This is strange indeed, the binaries in the Qt# repo are from the current master (a78a650). How did you obtain your copies?
The last version of CppSharp I tried is the latest from git mono/CppSharp@563ef56
It looks like there's been a couple of changes over last night
Right, I've just seen them. However, they are totally unrelated to the described problem. Oh, well, I guess working without knowing why is better than not working without knowing why.
Thanks for the latest release, I've just tried compiling against the latest cppsharp / qtsharp.
There's definitley less errors than before.
So far I've noticed the following
- For QFormBuilder / QUiLoader -> during load of ui from file
this now seems to drop out at a common point of QtCore.OnEvent, so we seem to be getting further - If a QTextEdit is added to the dialog window
then when the form closes an error is triggered - If a QFormLayout is added to the dialog window
then an error will trigger within QtWidget.HasHeightForWidth
@grbd thank you for testing. I am aware of problems 1. and 3, in fact, I am working on them right now. 2. is new for me, thank you for reporting.
@grbd I have decided to focus on the first problem for now. You are welcome to track its progress at https://gitlab.com/ddobrev/QtSharp/issues/22 .
cool thanks for the link
@grbd the third problem, the one with QFormLayout, has been fixed at my second alpha: https://github.com/ddobrev/QtSharp/releases/tag/0.0.2 .
@grbd please also try problem 2 (the QTextEdit) and let me know because I could not reproduce it, it may have been fixed.
I'll give both of them a go and let you know
thanks for looking into it
Problem 1 has been fixed at 4ce77c0. Since I've been unable to reproduce problem 2 and haven't received any additional information about it, I consider it complete which makes this whole issue resolved.
@grbd if you still encounter any of the 3 problems, please reopen.
@grbd the fix has been included in the 0.0.3 release - https://github.com/ddobrev/QtSharp/releases/tag/0.0.3.