Page 3 of 9
Some warnings and error
Posted: Sat Sep 23, 2017 2:33 pm
by wriedmann
hi Horst,
In .NET errorhandlers are a very important thing. Please look here in the forums for samples. Unfortunately I'm ouf of town so I cannot help further until Sunday evening.
Wolfgang
Some warnings and error
Posted: Sat Sep 23, 2017 4:47 pm
by robert
Horst,
Debugging CGI apps can be a challenge, indeed.
However not impossible:
Add a call to System.Diagnostics.Debugger.Break() in your code.
This will bring up a dialog from your app where you can open or attach a debugger.
From then on you will be able to follow the program execution.
Robert
Some warnings and error
Posted: Tue Sep 26, 2017 2:53 pm
by Horst
Now i am confused. When i use the debugger i can step trough Start (). When i start the CGI App from the prompt its making the Workdir() correctly. And writes the second fwriteline.
When its starts over the IIS-Browser appears a errormessage in the browser.
Unbehandelte Ausnahme: System.ArgumentException: Illegales Zeichen im Pfad.
bei System.Security.Permissions.FileIOPermission.CheckIllegalCharacters(String[] str, Boolean onlyCheckExtras)
bei System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
bei System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
bei System.Reflection.RuntimeModule.get_FullyQualifiedName()
bei VulcanRTFuncs.Functions.WorkDir()
bei Logout.Exe.Functions.Start()
pHandle := FOpen("c:swissbaseCGI_Error.log", FO_READWRITE)
FSeek(pHandle, 0, FS_END)
FWriteLine(pHandle, "Start Horst-"+"-"+chr(13)+chr(10))
FClose(pHandle)
--> cMessage := Workdir ()
pHandle := FOpen("c:swissbaseCGI_Error.log", FO_READWRITE)
FSeek(pHandle, 0, FS_END)
FWriteLine(pHandle, "Start Horst2-"+cMessage+"-"+chr(13)+chr(10))
FClose(pHandle)
Any hint ?
And is it possible to have a Line Number ?
Horst
Some warnings and error
Posted: Tue Sep 26, 2017 3:28 pm
by wriedmann
Hi Horst,
to have line numbers you need to have compiled for debug - therefore I deliver all my X# applications with debug enabled.
The error seems to be in the WorkDir() function, and I don't know why. Maybe it is not defined when the CGI is called from the IIS. Currently I cannot give you a replacement for this function as I'm under pressure right now.
But you should surround your code with try/catch blocks, and write an error log. Otherwise you will have unhandled errors.
Please look here for an explanation:
https://www.xsharp.eu/forum/public-vo-vn/310-suggestions-for-conversion-vo-programs-using-vo-gui-classes?start=10
Wolfgang
Some warnings and error
Posted: Tue Sep 26, 2017 3:50 pm
by Horst
Hi Wolfgang
i found this and its a workaround for Workdir () , i found that code in Ivo's Juno. But its hard now to change all Workdir's
o is thre a possibiliy to overwrite Workdir () with this Function ?
Function _hkGetBinRoot()
LOCAL DIM abDir[256] as BYTE
LOCAL hInst AS PTR
LOCAL nPos AS DWORD
LOCAL cPath AS STRING
hInst := _GetInst()
GetModuleFileName( hInst, @abDir[1], 256 )
cPath := Psz2String( @abDir[1] )
nPos := RAt("", cPath)
IF nPos != 0
cPath := SubStr(cPath, 1, nPos)
ENDIF
RETURN cPath
Some warnings and error
Posted: Tue Sep 26, 2017 3:54 pm
by robert
Horst,
WorkDir is a function in the VulcanRuntime.
With ILSpy or Reflector you can see that the code (in C#) looks like this:
Code: Select all
public static string WorkDir()
{
string text = Path.GetDirectoryName(Assembly.GetCallingAssembly().ManifestModule.FullyQualifiedName);
if (text[text.Length - 1] == Path.DirectorySeparatorChar ^ true)
{
text += Path.DirectorySeparatorChar.ToString();
}
return text;
}
In this case it calls the RuntimeModule.FullyQualifiedName property (from the System.DLL)
Inside this property the path is retrieved and it asks the system for permission to Discover the path. Inside the FileIOPermission class (again inside System.DLL) the error occurs.
Line numbers for these assemblies will only be available if you download their symbols (PDB files) from the Ms Website. You can do this inside Visual Studio.
You can also download the source to this inside Visual Studio.
From what I have read on several spots on the web this seems to be a security issue.
It seems that if you setup your DefaultAppPool to use Network Services then the problem should be gone.
Robert
Some warnings and error
Posted: Tue Sep 26, 2017 4:02 pm
by Horst
mmm i dont find the switch for the linenumber.
Some warnings and error
Posted: Tue Sep 26, 2017 4:44 pm
by Frank Maraite
Horst,
set the /debug compiler switch. Then the compiler generates an additional .pdb file. This file includes the line numbers for the debugger.
Frank
Some warnings and error
Posted: Tue Sep 26, 2017 5:19 pm
by FFF
Horst,
write e.g. WorkDir_HK() which call's Ivos code, in Xide a CTRL-Shift-R to replace all WorkDir with WorkDir_HK in all files. Or do i miss some problem?
Karl
Some warnings and error
Posted: Wed Sep 27, 2017 2:44 am
by wriedmann
Hi Horst,
I forgot: to see linenumbers in the error messages, you need to copy also the PDB files together with the DLLs and the EXE.
Wolfgang