0
Fixed

Bolt 2.0.0a5 C# Compilation : error CS0411

Jeremy TAN 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 2

Hi Lazlo,
I tried to Compile my code after the negate bug fix, but I had this Error:

Assets\Ludiq.Generated\Transient\AotStubs.cs(459,15): error CS0411: The type arguments for method 'JsonHelper.FromJson(string)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

here the code in AotStubs.cs:

``` // JsonHelper.FromJson
[UnityEngine.Scripting.PreserveAttribute()]
public static void JsonHelper_FromJson()
{
string arg0 = default(string);

JsonHelper.FromJson(arg0);

Ludiq.StaticFunctionInvoker optimized = new Ludiq.StaticFunctionInvoker(default(System.Reflection.MethodInfo));

optimized.Invoke(null, arg0);
optimized.Invoke(default(object[]));
}```

Here is a C# script I get from internet, but I have the same error for :

'Component.GetComponent()'

 ```// UnityEngine.Component.GetComponent
[UnityEngine.Scripting.PreserveAttribute()]
public static void UnityEngine_Component_GetComponent_0()
{
UnityEngine.Component target = default(UnityEngine.Component);

target.GetComponent();

Ludiq.InstanceFunctionInvoker optimized = new Ludiq.InstanceFunctionInvoker(default(System.Reflection.MethodInfo));

optimized.Invoke(default(UnityEngine.Component));
optimized.Invoke(default(object[]));
}```

```// UnityEngine.Component.GetComponent
[UnityEngine.Scripting.PreserveAttribute()]
public static void UnityEngine_Component_GetComponent_1()
{
UnityEngine.Component target = default(UnityEngine.Component);

target.GetComponent();

Ludiq.InstanceFunctionInvoker optimized = new Ludiq.InstanceFunctionInvoker(default(System.Reflection.MethodInfo));

optimized.Invoke(default(UnityEngine.Component));
optimized.Invoke(default(object[]));
}```

and 'JsonUtility.FromJson(string)'

``` // UnityEngine.JsonUtility.FromJson
[UnityEngine.Scripting.PreserveAttribute()]
public static void UnityEngine_JsonUtility_FromJson()
{
string arg0 = default(string);

UnityEngine.JsonUtility.FromJson(arg0);

Ludiq.StaticFunctionInvoker optimized = new Ludiq.StaticFunctionInvoker(default(System.Reflection.MethodInfo));

optimized.Invoke(null, arg0);
optimized.Invoke(default(object[]));
}```

Hope there is enough data to help

Bolt Version:
2.0.0a5
Unity Version:
2018.3.12f1
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Bolt 2
Working on Fix

Hi Jeremy, thanks for the report.

It seems like the AOT stubs generator forgets to add the generic method type arguments. It seems like an easy enough fix. In the mean time, you can delete the stubs script if you don't need to test on an AOT platform.

Fixed

This is no longer an issue in Alpha 6, as AOT stubs got removed altogether in favor of generated C# scripts.