{"action":"closed","issue":{"url":"https://api.github.com/repos/techyian/MMALSharp/issues/39","repository_url":"https://api.github.com/repos/techyian/MMALSharp","labels_url":"https://api.github.com/repos/techyian/MMALSharp/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/techyian/MMALSharp/issues/39/comments","events_url":"https://api.github.com/repos/techyian/MMALSharp/issues/39/events","html_url":"https://github.com/techyian/MMALSharp/issues/39","id":311745091,"number":39,"title":"\"Type could not be marshaled\" Error","user":{"login":"ianByrne","id":1918098,"avatar_url":"https://avatars2.githubusercontent.com/u/1918098?v=4","gravatar_id":"","url":"https://api.github.com/users/ianByrne","html_url":"https://github.com/ianByrne","followers_url":"https://api.github.com/users/ianByrne/followers","following_url":"https://api.github.com/users/ianByrne/following{/other_user}","gists_url":"https://api.github.com/users/ianByrne/gists{/gist_id}","starred_url":"https://api.github.com/users/ianByrne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianByrne/subscriptions","organizations_url":"https://api.github.com/users/ianByrne/orgs","repos_url":"https://api.github.com/users/ianByrne/repos","events_url":"https://api.github.com/users/ianByrne/events{/privacy}","received_events_url":"https://api.github.com/users/ianByrne/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-05T19:47:11Z","updated_at":"2018-04-05T19:59:48Z","closed_at":"2018-04-05T19:59:48Z","author_association":"NONE","body":"I'm getting this error on a Raspberry Pi 3B+ running Raspbian:\r\n\r\n> Type could not be marshaled because the length of an embedded array instance does not match the declared length in the layout.\r\n\r\nMy .Net Core app is pretty much [the example from the Wiki](https://github.com/techyian/MMALSharp/wiki/Examples-0.3) (although it seems the `MMALEncoding` values are different?):\r\n\r\n```csharp\r\nMMALCamera cam = MMALCamera.Instance;\r\n\r\nAsyncContext.Run(async () =>\r\n{\r\n    using (var imgCaptureHandler = new ImageStreamCaptureHandler(\"/home/pi/images/\", \"jpg\"))\r\n    {\r\n        await cam.TakePicture(imgCaptureHandler, MMALEncoding.MMAL_ENCODING_JPEG, MMALEncoding.MMAL_ENCODING_I420);\r\n    }\r\n});\r\n\r\ncam.Cleanup();\r\n```\r\n\r\nStack trace:\r\n\r\n> at System.Runtime.InteropServices.Marshal.StructureToPtr(Object structure, IntPtr ptr, Boolean fDeleteOld)\r\n> at MMALSharp.Components.MMALImageEncoder.AddExifTag(ExifTag exifTag)\r\n> at MMALSharp.Components.MMALImageEncoder.<AddExifTags>b__24_0(ExifTag c)\r\n> at System.Collections.Generic.List`1.ForEach(Action`1 action)\r\n> at MMALSharp.Components.MMALImageEncoder.AddExifTags(ExifTag[] exifTags)\r\n> at MMALSharp.Components.MMALImageEncoder.ConfigureOutputPort(Int32 outputPort, MMALEncoding encodingType, MMALEncoding pixelFormat, Int32 quality, Int32 bitrate)\r\n> at MMALSharp.MMALCamera.<TakePicture>d__25.MoveNext()\r\n> --- End of stack trace from previous location where exception was thrown ---\r\n> at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n> at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n> at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n> at PiCameraProject.Program.<>c__DisplayClass3_0.<<Main>b__0>d.MoveNext() in C:\\Projects\\PiCameraProject\\PiCameraProject\\Program.cs:line 42\r\n> --- End of stack trace from previous location where exception was thrown ---\r\n> at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n> at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n> at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n> at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)\r\n> at Nito.AsyncEx.AsyncContext.<>c__DisplayClass15_0.<Run>b__0(Task t)\r\n> at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()\r\n> at System.Threading.Tasks.Task.<>c.<.cctor>b__276_1(Object obj)\r\n> at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n> at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)\r\n> --- End of stack trace from previous location where exception was thrown ---\r\n> at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n> at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n> at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n> at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)\r\n> at Nito.AsyncEx.AsyncContext.Run(Func`1 action)\r\n> at PiCameraProject.Program.Main(String[] args) in C:\\Projects\\PiCameraProject\\PiCameraProject\\Program.cs:line 36"}}
{"actor":{"display_login":"ianByrne"}}