Possibly error message when starting program with missing included DLL

Have some feedback and input to share?
Don't be shy and drop us a note. We want to hear from you and strive to make our site better and more user friendly for our guests and members a like.
User avatar
ArneOrtlinghaus
Posts: 412
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Possibly error message when starting program with missing included DLL

Post by ArneOrtlinghaus »

Robert,
thank you for the information. Nice to know how much the compiler does. In older times every type had to be exact what was requested in the original function and now the compiler makes all the transformations/castings that are necessary.
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Possibly error message when starting program with missing included DLL

Post by robert »

Arne,
ArneOrtlinghaus wrote:Robert,
thank you for the information. Nice to know how much the compiler does. In older times every type had to be exact what was requested in the original function and now the compiler makes all the transformations/castings that are necessary.
Although I really would want to take the credit for this, that would be too much honour.
All this stuff is done by the guys at Microsoft.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3754
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Possibly error message when starting program with missing included DLL

Post by wriedmann »

Hi Robert,

I have tried this, but it does not even compiles:

Code: Select all

error XS0234: The type or namespace name 'exe' does not exist in the namespace 'ProdPlan' (are you missing an assembly reference?)	15,2	Start.prg	ProdPlan
My Application is called ProdPlan.exe, and uses the namespace ProdPlan.
I have now tried to do that in a small sample, but have the same behavior:
StartupExceptionTester.zip
(2.37 KiB) Downloaded 107 times
The code is the following:

Code: Select all

try

ProdPlan.exe.Functions.Start()

catch oEx as Exception
.....
Where is my error, please?
Thank you very much!
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Possibly error message when starting program with missing included DLL

Post by robert »

Wolfgang,

This app is for the Core dialect. The namespace rules are different in the core dialect. The class is now simply named "Functions".

So you need to call Functions.Start()

But since you have an argument in Start() for the commandline arguments, you also need this argument in the Start() method and you need to pass that argument along.

And then, after you fix the missing parameters in your call to OutPut() <g> everything will work.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3754
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Possibly error message when starting program with missing included DLL

Post by wriedmann »

Hi Robert,
it works now with this code:

Code: Select all

Functions.Start()
For anyone interested please see the attached sample:
StartupExceptionTester.zip
(2.38 KiB) Downloaded 105 times
I have tried to inherit the startup window from a class in an external DLL and the copied the exe without the DLL to a random folder, and effectively I can see the correct error (and it is written to the disk).
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3754
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Possibly error message when starting program with missing included DLL

Post by wriedmann »

Hi Robert,

yes, after fixing the error with the Start() call I have seen (and fixed) also the errors in my Output call.
It works now:

Code: Select all

An unhandled exception has occurred
===================================
Exception: Die Datei oder Assembly "rdm.WinFormsLib, Version=1.0.0.1, Culture=neutral, PublicKeyToken=37b41ccb897b15ad" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
Callstack:
   bei Functions.Start()
   bei XStartupCode.Start() in C:XSharpXIDEProjectsPublicProjectsApplicationsStartupExceptionTesterPrgStart.prg:Zeile 18.

===================================
Press any to close the application
Thank you very much!

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3754
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Possibly error message when starting program with missing included DLL

Post by wriedmann »

Hi Robert,
another thing: I have now implemented that in my production planning software, and on compile I receive the following warning:

Code: Select all

warning XS0436: The type 'Functions' in '' conflicts with the imported type 'Functions' in 'ProdPlanGUILib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in ''.	15,2	Start.prg	ProdPlan
This application uses another lib that uses the same namespace.
Is the only solution to change the namespace of the library?
Thank you very much!
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3754
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Possibly error message when starting program with missing included DLL

Post by wriedmann »

Hi Robert,
another thing: when using a namespace, the compiler option must include it:

Code: Select all

 -main:ProdPlan.XStartupCode
Wolfgang
P.S. maybe I will include that and a link to this discussion on the wiki....
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3754
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Re: Possibly error message when starting program with missing included DLL

Post by wriedmann »

Hi Robert,
I'm back to this topic for a migrated application, and unfortunately I have some problems with it.

What is the default namespace for a migrated application that does not has any namespace indication with it?

On the line

Code: Select all

Functions.Start()
in my StartupCode class I see the error

Code: Select all

error XS0117: 'XSharp.RDD.Functions' does not contain a definition for 'Start'	16,2	Start.prg	DictEdit.XStartupCode:Start
that may be connected to the default namespace.

Removing the "Functions." part fixed that for me.

But adding

Code: Select all

-main:DictEdit.XStartupCode
to the compiler options gave me

Code: Select all

error XS1555: Could not find 'DictEdit.XStartupCode' specified for Start function
So I think this is also namespace related.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Possibly error message when starting program with missing included DLL

Post by robert »

Wolfgang,

When you migrate a VO app with the name DictEdit, then the generated Assembly name by the Exporter is DictEdit.EXE and the Default Namespace is also DictEdit

Please note that this default namespace is only used with:
- when you enable the option "Prefix classes with Default Namespace". In that case, the class Foo becomes DictEdit.Foo
- when you create files inside Visual Studio. A new class "Class1" will be generated as DictEdit.Class1.
When the new class file is in a folder "Test" then VS generates code for the class as DictEdit.Test.Class1.

The functions class in a migrated application is derived from the assembly name and not from the default namespace.

When the assembly name is DictEdit.Exe, then the name of the functions class is DictEdit.Exe.Functions
When the assembly name is DictEdit.Dll, then the name of the functions class is DictEdit.Functions

The compiler automatically adds a using DictEdit.Exe.Functions inside each of the programs in your app (assuming DictEdit.Exe is your assembly name).
So there is no need to prefix the code with Functions. If you do want to prefix then I would recommend to use the full name: DictEdit.Exe.Functions.Start()


Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply