Logic(_cast... crashes VO & DBCreate question

This forum is meant for questions and discussions about the X# language and tools
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Logic(_cast... crashes VO & DBCreate question

Post by ic2 »

I just found that I have had this problem before:

https://www.xsharp.eu/forum/private-pro ... -not-found

At that time I solved it by Enabling implicit lookup. This was, for whatever reason, off now.
EDIT: I mean: DISABLING implicit lookup. But this does not work now obviously.

However, when I switch it on I get another undocumented error:


Error XS0263 Partial declarations of 'DotNetLibForVO.Attentions' must not specify different base classes DotNetLibForVO

There it says:
Partial Class Attentions Inherit Window

No idea what's wrong here....


I have to make it Partial, because when I remove Partial I get the error:

Error XS0260 Missing partial modifier on declaration of type 'Attentions'; another partial declaration of this type exists

I've done a global search, not found a different partial class Attentions anywhere, so I can only guess that it's the WPF XAML:

<Window x:Class="DotNetLibForVO.Attentions"

but that is how it should be.

Chris, does this Enable implicit Lookup in conjunction with the DBCreate error ring a bell which helps me to get this working?

Dick
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Logic(_cast... crashes VO & DBCreate question

Post by Chris »

Hi Dick,

The option "Enable implicit Lookup" is not relevant to this problem, it only has to do with compile time, while the error you are getting is a runtime problem. By reading the other thread you mentioned, I assume you had fixed the problem by copying all the necessary vulcan dlls to your app folder, as you mentioned in the last post. Please also read Robert's suggestion in that thread.

The problem that you are now getting when you have enabled the "Enable implicit Lookup", is because there's now a name conflict between 2 classes named "Window". There's the class Window defined in the VOGUI classes and another in the WPF classes and the compiler thinks you want to use the VOGUI one, while indeed, as you suspected, there's also a hidden (blame MS for that!! :) - you can find it in the Obj folder, with a name filename.g.prg) file that uses the WPF class. A fix for this is to specify the full class name you want to use, in order to avoid ambiguity:

Partial Class Attentions Inherit System.Windows.Window
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Logic(_cast... crashes VO & DBCreate question

Post by ic2 »

Hello Chris,
Some more info.

I remembered that I created a stand alone test application for this Excel impot too. After making the changes I also had to make in the DLL (because of later X# versions) I can now tell the following:

1 By including XSharp.Core, XSharp.RT,XSharp.VORDDClasses and XSharp.VoSystemClasses, DBCreate works.
2 By including instead of the X# DLL's the VulcanRT,VulcanRTFuncs, VulcanVORDDClasses and VulcanVoSystemClasses, DBCreate I get the 1015 error on DBCreate.

So apparently something changed with a later X# version as DBCreate (eventually) worked with the Vulcan DLL's and now it doesn't.

I am however very reluctant to use the X# DLL's at all because of quite a few problems we had with DBF operations which disappeared when we went back to the Vulcan DLL's. Also because of recent issues like the 0->2 seconds lock issue and Horst's lock error; this I can obviously not use for client environments.

So if all this info would help you recognize something which solves it using the Vulcan DLL's I prefer to keep using these. However, you should not spend much time on it; it is obviously working not using the Vulcan DLL's. In that case I need to check what the program is doing with the DBF's and check all operations intensively to see if the earlier problems are all solved and what happens with these lock problems.

Dick
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Logic(_cast... crashes VO & DBCreate question

Post by Chris »

Hi Dick,

In the first message that you posted, you included an error message which was mentioning the vulcan runtime. If this was a recent screenshot, with the current version of your app, then the XSharp runtime dlls have absolutely nothing to do with it.

But maybe this is not the exe that you are actually using after all? Maybe you are using a different one, which is compiled against the X# runtime instead? If you want, please send me the exe/dll files that you are using and I will tell you what runtime they use.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Logic(_cast... crashes VO & DBCreate question

Post by robert »

Dick,

On top of everything that was said already. If your VO code contains _CAST you should really ask yourself what you are doing:
lResult:=Logic(_cast,ofd:ShowDialog())
_CAST tells the compiler "trust me, I know what I am doing". And that is exactly what the VO compiler will do.
I have seen many occasions of exceptions (5333 errors) and quite often they were occurring in code that contains _CASTS that were not correct.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Logic(_cast... crashes VO & DBCreate question

Post by ic2 »

Hello Robert,
robert wrote:Dick,

On top of everything that was said already. If your VO code contains _CAST you should really ask yourself what you are doing:
lResult:=Logic(_cast,ofd:ShowDialog())
I was trying to find out where I got this from, as I am sure I haven't invented that solution myself. Maybe from this reply https://www.xsharp.eu/forum/private-pro ... byte#14181 but I am not sure where I got this from.

Dick
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Logic(_cast... crashes VO & DBCreate question

Post by ic2 »

Hello Chris,
Chris wrote:Hi Dick,

In the first message that you posted, you included an error message which was mentioning the vulcan runtime. If this was a recent screenshot, with the current version of your app, then the XSharp runtime dlls have absolutely nothing to do with it.
To summarize:

DBCreate used to work during about the last year, with the mentioned Vulcan DLL's included in my project (and no X# DLL's). Now it does not anymore, changes since are a newer X# version (I now use 2.7a) and probably newer DLL's over time. I would say that the Vulcan DLL's are unchanged. So I wonder what else could cause DBCreate to stop working using the Vulcan DLL's?

Using the X# DLL's it works. But as written I prefer not to use these as there have been (and still are) issues with DBF .

Dick
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Logic(_cast... crashes VO & DBCreate question

Post by Chris »

Hi Dick,
ic2 wrote: I was trying to find out where I got this from, as I am sure I haven't invented that solution myself. Maybe from this reply https://www.xsharp.eu/forum/private-pro ... byte#14181 but I am not sure where I got this from.
Most probably you got this code from the VOGUI SDK, it is full of Logic(_cast,...) expressions. That does not mean that because the SDK has them it is also a good practice, on the contrary it is very sloppy, same as with so many other areas in the VO runtime.

But still, in the SDK, those expressions are usually used to convert things like INT to LOGIC, which even though is bad practice and potentially dangerous doing it this way, at least it works in those specific cases. But in your sample, there is a cast from a nullable type to a logic, those are different things. When the nullable type contains a TRUE or FALSE value, then the cast (it's a conversion actually in .Net) will work. If it does not contain a TRUE or FALSE value though, then the code will throw a runtime exception. For this reason, instead of using a cast, you should be using the code I posted with HasValue etc.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Logic(_cast... crashes VO & DBCreate question

Post by Chris »

Hi Dick,
ic2 wrote: To summarize:

DBCreate used to work during about the last year, with the mentioned Vulcan DLL's included in my project (and no X# DLL's). Now it does not anymore, changes since are a newer X# version (I now use 2.7a) and probably newer DLL's over time. I would say that the Vulcan DLL's are unchanged. So I wonder what else could cause DBCreate to stop working using the Vulcan DLL's?

Using the X# DLL's it works. But as written I prefer not to use these as there have been (and still are) issues with DBF .
Most probably, this means that your app does not use the vulcan dlls as you expect, but it uses the X# dlls instead. Maybe this happened accidentally, maybe you temporarily switched to the X# runtime for testing and then forgot to add back references to the vulcan runtime, or forgot to rebuild everything, or something along those lines. But can't be totally sure about what has happened, please send me your files and I will tell you for sure what's going on.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Logic(_cast... crashes VO & DBCreate question

Post by FFF »

ic2 wrote:I prefer not to use these as there have been (and still are) issues with DBF .
Second time mentioning these "issues". As you don't seem to see them with VN-Dlls, it can't be related to MS misbehaviour... -So, have you raised them on github? Would love to see this, as i use them and prefer not to tap into some trap...
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Post Reply