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

OpenInputAsync causes an AccessViolationException on Raspberry Pi 3b+ & .net Core 2.1 #63

Open
Alix1723 opened this issue May 2, 2020 · 3 comments

Comments

@Alix1723
Copy link

Alix1723 commented May 2, 2020

Here's my code:

var access = MidiAccessManager.Default;

            foreach(IMidiPortDetails portdetails in access.Inputs)
            {
                Console.WriteLine($"Input: {portdetails.Name} / ID: {portdetails.Id}");
            }

            Console.WriteLine("Reading events...");
            var input = access.OpenInputAsync(access.Inputs.First(indevice => indevice.Name.Contains("nano")).Id).Result;
            input.MessageReceived += (object sender, MidiReceivedEventArgs e)
               =>
            { Console.WriteLine($"event has: {e.Length}"); }; 

            Console.ReadKey();
            input.CloseAsync();

(Where "nano" is a "nanoKEY 2" keyboard)

Running this ends up with:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

The same project seems to work fine on Windows 10/x64:
image

@ahopper
Copy link
Contributor

ahopper commented Jan 31, 2022

I'm seeing the same error on rpi4 with .net6.0 on 32 bit raspbian, on 64 bit it works fine.

@ahopper
Copy link
Contributor

ahopper commented Jan 31, 2022

The stack trace is
Fatal error. Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
at System.Threading.Tasks.Task.ExecuteEntryUnsafe(System.Threading.Thread)
at System.Threading.Tasks.Task.ExecuteFromThreadPool(System.Threading.Thread)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)Aborted

@brentmaxwell
Copy link

I'm seeing this as well on an RPi4 running 32 bit Raspberry OS 12 (bookworm) running .NET 8. Works fine under WSL on my PC.

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

No branches or pull requests

3 participants