Commit graph

155 commits

Author SHA1 Message Date
Ignacio Etcheverry 85d8c42763 Mono/C#: Fix crash on exported games that don't use C# 2019-11-29 01:35:46 +01:00
Ignacio Etcheverry 2b67924a0b Mono/C#: Initial exporter support for AOT compilation 2019-11-15 03:22:18 +01:00
Ignacio Etcheverry de7c2ad21b Mono/C#: WebAssembly support 2019-11-13 21:41:11 +01:00
qarmin 17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
iwek7 617797c47c Adds skip-breakpoints feature 2019-09-03 20:49:09 +02:00
toasteater e2121c97ae Make VarArg methods return types show up as Variant in API json
VarArg methods have the return type Object in the API json for GDNative. This
can cause undefined behavior in some language bindings due to lack of
documentation on VarArg methods' behavior.

This changes the MethodInfo of:

- CSharpScript::_new
- GDScript::_new
- PluginScript::_new
2019-08-26 16:36:51 +00:00
Ignacio Etcheverry c55ce204b3 Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'modules/mono'
And 'CRASH_*_MSG' as well.

Also make error messages puntuation and quotation more consistent.
2019-08-09 12:13:21 +02:00
qarmin e0b5b21863 Add some code changes/fixes proposed by Coverity and Clang Tidy 2019-08-07 12:54:30 +02:00
Ignacio Etcheverry 513cc78f85 Mono: Add option to keep running after unhandled exceptions
By default, an unhandled exception will cause the application to be terminated; but the project setting `mono/unhandled_exception_policy` was added to change this behaviour.
The editor is hard-coded to never terminate because of unhandled exceptions, as that would make writing editor plugins a painful task, and we cannot kill the editor because of a mistake in a thirdparty plugin.
2019-07-24 23:19:15 +02:00
Ignacio Etcheverry e59ac40712 Mono: Better handling of missing/outdated API assemblies
Remove the old API assembly invalidation system. It's pretty simple since now the editor has a hard dependency on the API assemblies and SCons takes care of prebuilding them.
If we fail to load a project's API assembly because it was either missing or outdated, we just copy the prebuilt assemblies to the project and try again. We also do this when creating the solution and before building, just in case the user removed them from the disk after they were loaded.
This way the API assemblies will be always loaded successfully. If they are not, it's a bug.

Also fixed:

- EditorDef was behaving like GlobalDef in GodotTools.
- NullReferenceException because we can't serialize System.WeakReference yet. Use Godot.WeakRef in the mean time.
2019-07-14 19:17:07 +02:00
Ignacio Etcheverry d3f48f88bb Fix EditorNavigationMeshGenerator registered in Core API
Also added an option to output a json file with all the ClassDB registered classes and its members. This can be used to compare the API of two different builds by a simple diff.
2019-07-09 23:33:29 +02:00
Ignacio Etcheverry 069af23bdb Mono: Fix build errors with tools=no 2019-07-08 18:07:20 +02:00
Ignacio Etcheverry dd22cc7527 C#: Fix some crashes during assemblies reloading 2019-07-08 18:07:20 +02:00
Ignacio Etcheverry 270af6fa08 Re-write mono module editor code in C#
Make the build system automatically build the C# Api assemblies to be shipped with the editor.
Make the editor, editor player and debug export templates use Api assemblies built with debug symbols.
Always run MSBuild to build the editor tools and Api assemblies when building Godot.
Several bugs fixed related to assembly hot reloading and restoring state.
Fix StringExtensions internal calls not being registered correctly, resulting in MissingMethodException.
2019-07-05 09:38:23 +02:00
Ignacio Etcheverry 9f1a8ce6a2 Mono: Android build and shared libraries fixes
Fix location of Mono's shared libraries.
Fix build failing if the directory 'platform/android/java/libs/{target}/{abi}' doesn't exist.
2019-07-03 17:48:12 +02:00
qarmin 3c154eb93b Remove unnecessary code and add some error explanations 2019-07-01 12:59:42 +02:00
qarmin 4e5310cc60 Some code changed with Clang-Tidy 2019-06-26 15:08:25 +02:00
Ignacio Etcheverry 04ebf294f3 C#: Implement ScriptInstance::to_string
Create a blacklist of methods that must not be generated. Includes: "to_string", "_to_string" and "_init".
2019-05-24 00:40:20 +02:00
Ignacio Etcheverry 5a4bf4f369 C#: Marshalling support for IEnumerable<> and IDictionary<,>
Also fixed the hint string of exported members.
2019-05-18 19:39:56 +02:00
Ignacio Etcheverry 470b80cc55 C#: Support resource type hint in exported arrays
- Elements of types like PackedScene will display with the special editor for such type.
2019-04-29 21:20:05 +02:00
Rémi Verschelde 554c0ea90b
Merge pull request #28423 from neikeq/dont-forget-to-think-a-name-for-this-branch
C#: Deprecate accessor methods and generate correct int and float types
2019-04-29 16:56:25 +02:00
Ignacio Etcheverry 791e1294c3 Mono: Lazily load scripts metadata file
- Only load the scripts metadata file when it's really needed. This way we avoid false errors, when there is no C# project,  about missing scripts metadata file.
2019-04-26 19:53:44 +02:00
Ignacio Etcheverry c20a3823a2 C# bindings generator cleanup
- Normal log messages are no longer warnings.
- BindingsGenerator is no longer a singleton.
- Added a log function.
2019-04-25 20:34:28 +02:00
Ignacio Roldán Etcheverry b7cf4c2050
Merge pull request #27950 from Nonnu42/contrib
Fixes #17233 allowing C# to override _GetPropertyList
2019-04-12 16:43:27 +02:00
Nuno Cardoso d011c8e109 Fixes #17233 allowing C# to override _GetPropertyList 2019-04-12 03:09:03 +01:00
Ignacio Etcheverry 480d4c6fba C#: Support type hints for exported Arrays
Added the code for Dictionary as well, but it's not yet supported by the Godot inspector.
2019-04-06 12:14:43 +02:00
Ignacio Etcheverry 187e6ae26d C#: Add marshalling support for IEnumerable and IDictionary
Added constructor that takes IEnumerable for Array and IEnumerable<T> for Array<T>.
Added constructor that takes IDictionary for Dictionary and IDictionary<TKey, TValue> for Dictionary<TKey, TValue>.
2019-04-06 12:14:37 +02:00
ForLoveOfCats 444242a080 Mono: Make missing default constructor error more foolproof 2019-04-04 16:56:02 -04:00
Ignacio Etcheverry 5e354162f1 C#: Update exports only in the editor 2019-03-13 16:26:47 +01:00
Ignacio Etcheverry a4825c2f8b Fix CSharpInstance::set not working with base classes 2019-03-08 00:12:19 +01:00
Rémi Verschelde 6ee3002237
Merge pull request #26773 from neikeq/issue-26628
Mono: Fix crash with exported field of custom Reference derived type
2019-03-07 22:54:03 +01:00
Ignacio Etcheverry c5f8b0960a Mono: Fix crash with exported field of custom Reference derived type 2019-03-07 22:38:31 +01:00
Ignacio Etcheverry 8e2e0795bb Mono: Partially implement some Godot debug api functions
Debug breaks sent with debug_break and debug_break_parse should display correctly in the Godot debugger now.
2019-03-07 21:02:57 +01:00
Ignacio Etcheverry 4c0b0a6bdd
Merge pull request #26765 from neikeq/issue-25959
Mono: Fix crash when re-using script binding after domain reloading
2019-03-07 20:50:37 +01:00
Ignacio Etcheverry e904f814c8 Mono: Fix crash when re-using script binding after domain reloading 2019-03-07 19:55:40 +01:00
Sebastian Hartte f8a6a6c8a2 Update scripts exports even when normal script instances are created to better support tool scripts with exported variables. 2019-03-07 18:52:43 +01:00
Ignacio Etcheverry 22b41ab2fe Mono: Fail on script instance creation if constructor was not found
Previously this would result in NULL dereferencing. Now we fail with an error.
2019-02-28 23:22:46 +01:00
marxin e5f665c718 Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions
like size() or length() should return an unsigned type.
2019-02-27 07:45:57 +01:00
marxin 8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
Ignacio Etcheverry 9df44c2d2c Use script instance binding for objects constructed from C#
Only possible if the object class is a "native type". If the object class is a user class (that derives a "native type") then a script is needed.
Since CSharpLanguage does cleanup of script instance bindings when finished, cases like #25621 will no longer cause problems.

Fixed ~Object() trying to free script instance bindings after the language has already been removed, which would result in a NULL dereference.
2019-02-09 00:32:18 +01:00
Ignacio Etcheverry 3233083f63 Mono: Lifetime fixes for CSharpInstance and instance binding data
Avoid CSharpInstance from accessing its state after self destructing (by deleting the Reference owner).
It's now safe to replace the script instance without leaking or crashing.

Also fixed godot_icall_Object_weakref return reference being freed before returning.
2019-02-03 06:47:25 +01:00
Ignacio Etcheverry d3c51a5dfb Mono: Cleanup 2019-02-03 05:38:40 +01:00
Ignacio Etcheverry bc8b61bb06 Mono: Fix hot reload build errors and cleanup 2019-01-22 18:33:36 +01:00
Ignacio Etcheverry 077e489773 Mono: Add assembly reloading to running games
Add environment variable to specify a custom --debugger-agent for mono.
2019-01-21 22:44:09 +01:00
Ignacio Etcheverry b48dd1bdaf C#: Fix crash due to missing gchandle ref null check 2019-01-17 23:15:20 +01:00
Rémi Verschelde 658296856c
Merge pull request #24877 from neikeq/issue-24280
Fix properties being lost when reloading placeholder GDScript instance
2019-01-10 18:02:57 +01:00
Ignacio Etcheverry ea85ff0dc2 Fix properties being lost when reloading placeholder GDScript instance
During reloading in `GDScriptLanguage::reload_all_scripts` a placeholder instance that must remain so is replaced with a new placeholder instance. The state is then restored by calling `ScriptInstance::set` for each property. This does not work if the script is missing the properties due to build/parse failing.
The fix for such cases is to call `placeholder_set_fallback` instead of `set` on the script instance.

I took this chance to move the `build_failed` flag from `PlaceHolderScriptInstance` to `Script`. That improves the code a lot. I also renamed it to `placeholder_fallback_enabled` which is a much better name (`build_failed` could lead to misunderstandings).
2019-01-10 01:58:50 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Ben Rog-Wilhelm b26487a2b4 Tweaks after feedback 2018-12-08 00:54:12 -08:00
Ben Rog-Wilhelm f13f2d512f Implement CSharpScript::get_script_method_list and related functionality. 2018-12-07 23:54:40 -08:00