xsharp.eu • compiler exception
Page 1 of 1

compiler exception

Posted: Wed May 02, 2018 8:05 am
by SHirsch
Hi Robert,

while testing AssemblyResolve handling I got a crash of the compiler.
Attached a screenshot of exception message and sample (viaef) for repoducing the crash.

Regards,
Stefan

compiler exception

Posted: Wed May 02, 2018 2:39 pm
by Chris
Hi Stefan,

Thanks, I see the issue, it's because of the line

Code: Select all

PRIVATE STATIC o := <VOID>{ AppDomain.CurrentDomain:AssemblyResolve += AssemblyResolver } AS OBJECT
(I have simplified it to make it more forum-readable)

Don't think this is supposed to compile, as the expression inside the {} does not return anything. Was this just a test of yours, or just a smart way to do the event subscribing? Normlly, I think you should be doing that in a static constructor instead:

Code: Select all

STATIC CONSTRUCTOR()
  AppDomain.CurrentDomain:AssemblyResolve += AssemblyResolver
RETURN
Also better rename your Functions class to something else, like "Funcs", because the compiler already implicitly creates a class named "Functions", as a container for FUNCTIONs/PROCEDUREs/GLOBALs defined in the code.

Chris

compiler exception

Posted: Wed May 02, 2018 5:47 pm
by SHirsch
Hi Chris,
The problem I had is solved.
My sample was just to reproduce a compiler crash. I think no app should crash without proper message (in this case a compile error).

Regards,
Stefan

compiler exception

Posted: Wed May 02, 2018 7:13 pm
by Chris
Ah ok, did not realize! Absolutely agreed about no crashing of course! Just some more info, this is actually a assertion failed message, it is shown only in the debug version of the compiler (the public one, FOX builds are release builds).

Chris