Compiler Warnings supported by now?
-
19. června 2012 8:14
Hi all, the document 'released-interactive-scripting-spec.pdf' names an 'Options' property for the ScriptEngine class which shall allow setting options for compilations, warnings and others. Unfortunately this property is not included in the ScriptEngine class.
Is it currently somehow possible to tell the compiler that it should serve warnings as well as errors?
Kind regards,
Tobias
Všechny reakce
-
22. června 2012 15:41Vlastník
Most warnings should be implemented for language features that are implemented, but definitely not all of them. You should be able to call GetDiagnostics() on the Compilation that the ScriptEngine produces to get both warnings and errors.
-- Kevin Pilch-Bisson kevinpi@microsoft.com
-
23. června 2012 6:02
In this case maybe the warning mechanism is different from that in the current Visual Studio? Because things like unused variables or referenced namespaces that are not required are not propagated through the diagnostics of the compilation. I will try to look a little bit deeper here and provoke some other kind of warnings to see what it results in. I'll let you know what the results are...
Kind regards,
Tobias
-
24. června 2012 20:39Vlastník
There are some warnings that are different for scripts than for normal code. That's because things like script variables actually get lifted to be fields of the Script class. Also, it doesn't make sense to report all warnings, for example you might add a using in one submission in order to consume it later. It would be annoying to have warnings reported at each step like that.
To check the state of the implementation of warnings, you might try creating normal Compilation objects and looking at the diagnostics instead of script ones.
-- Kevin Pilch-Bisson kevinpi@microsoft.com
- Upravený Pilchie (Kevin Pilch-Bisson)Owner 24. června 2012 20:40
- Označen jako odpověď Tobi_B 25. června 2012 7:12