compiler exception

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
SHirsch
Posts: 281
Joined: Tue Jan 30, 2018 8:23 am

compiler exception

Post 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
Attachments
CompilerCrash.zip
(1.47 KiB) Downloaded 27 times
XS_CompilerCrash.PNG
XS_CompilerCrash.PNG (25.75 KiB) Viewed 185 times
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

compiler exception

Post 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
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
SHirsch
Posts: 281
Joined: Tue Jan 30, 2018 8:23 am

compiler exception

Post 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
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

compiler exception

Post 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
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Post Reply