Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C# godot 4.4 beta 1]System.MissingMethodException”(“Method not found: 'Boolean Godot.FileAccess.StoreBuffer(Byte[])' #101829

Closed
bestvcboy opened this issue Jan 20, 2025 · 2 comments

Comments

@bestvcboy
Copy link

bestvcboy commented Jan 20, 2025

Tested versions

引发了异常: GoPowerup 中的“System.MissingMethodException”(“Method not found: 'Boolean Godot.FileAccess.StoreBuffer(Byte[])'.”)

引发了异常: GoPowerup 中的“System.MissingMethodException”(“Method not found: 'Boolean Godot.FileAccess.StoreBuffer(Byte[])'.”)

System information

WINDOWS 11

Issue description

no

Steps to reproduce

no

Minimal reproduction project (MRP)

void OnRequestCompleted(long result, long responseCode, string[] headers, byte[] body, TaskCompletionSource<string> tcs)
{
    GD.Print("OnRequestCompleted" + localFileName);
    if (responseCode == 200)
    {
        try
        {
            //var filePath = $"user://{localFileName}";

            using var file = Godot.FileAccess.Open(localFileName, Godot.FileAccess.ModeFlags.Write);
            {
                if (FileDownloader.IsStopDownloadResource == true)
                {
                    GD.PrintErr("Download is canceled By OnRequestCompleted");
                    FileDownloader.IsStopDownloadResource = false;
                    if (downloadTaskCompletionSource.Task.IsCompleted == false)
                        downloadTaskCompletionSource.TrySetResult("Download is canceled");
                    return;
                }
              
                file.StoreBuffer(body);
                file.Close();
                if (tcs.Task.IsCompleted == false)
                    tcs.SetResult(localFileName);
            }
        }
        catch (Exception ex)
        {
            if (tcs.Task.IsCompleted == false)
                tcs.SetException(ex);
        }
    }
    else
    {
        if (tcs.Task.IsCompleted == false)
            tcs.SetException(new Exception($"Failed to download the file. HTTP Response Code: {responseCode}"));
    }

    // Cleanup
    httpRequest.QueueFree();
    httpRequest = null;
}
@raulsntos
Copy link
Member

The System.MissingMethodException exception usually happens when Godot breaks compatibility. In this case, the method Godot.FileAccess.StoreBuffer was changed in #78289 (4.4-dev6).

This means that your project or one of its dependencies were built against an older/newer version of the Godot bindings (the GodotSharp package). Make sure your C# project and all its dependencies are built against the same version of the Godot bindings, and that this version matches the version of the Godot editor you are using (presumably 4.4 beta 1).

You didn't provide a minimal reproduction project, only a code snippet that references undefined variables. This is not enough because, as explained above, the issue is not with the code you are using.

@bestvcboy
Copy link
Author

Thank you, it was my version that got it wrong. sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants