편집 : 모노 (these instructions을 사용하여 소스에서 컴파일해야 함)를 버전 3.2.7로 업데이트했습니다. 용량 오버로드 인수에 대해 불평하는 오류가 더 이상 발생하지 않습니다. 이제 아래 오류가 발생합니다. 이전에는 mono verison 2.1을 사용할 때 작은 텍스트 파일을 테스트로 메모리 매핑 파일로 열 수있었습니다. 모노의 새 버전을 사용하면 내가 열려고하는 파일/과부하 인수가 공급되거나 제외되는 경우에도 이와 동일한 오류가 발생합니다. 빠른 구글 검색은 아무것도 돌려주지 않았으므로 나는 당신에게 돌아갔습니다, stackoverflow. 어떻게해야합니까?C#/Mono - 메모리 매핑 된 파일의 문제
Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for Mono.Unix.Native.Syscall ---> System.EntryPointNotFoundException: Mono_Posix_Syscall_get_at_fdcwd at (wrapper managed-to-native) Mono.Unix.Native.Syscall:get_at_fdcwd() at Mono.Unix.Native.Syscall..cctor() [0x00000] in <filename unknown>:0 --- End of inner exception stack trace --- at System.IO.MemoryMappedFiles.MemoryMapImpl.Open (System.String path, FileMode mode, Int64 capacity, MemoryMappedFileAccess access) [0x00000] in <filename unknown>:0 at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile (System.String path, FileMode mode, System.String mapName, Int64 capacity, MemoryMappedFileAccess access) [0x00000] in <filename unknown>:0 at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile (System.String path) [0x00000] in <filename unknown>:0 at ConsoleApplication1.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for Mono.Unix.Native.Syscall ---> System.EntryPointNotFoundException: Mono_Posix_Syscall_get_at_fdcwd at (wrapper managed-to-native) Mono.Unix.Native.Syscall:get_at_fdcwd() at Mono.Unix.Native.Syscall..cctor() [0x00000] in <filename unknown>:0 --- End of inner exception stack trace --- at System.IO.MemoryMappedFiles.MemoryMapImpl.Open (System.String path, FileMode mode, Int64 capacity, MemoryMappedFileAccess access) [0x00000] in <filename unknown>:0 at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile (System.String path, FileMode mode, System.String mapName, Int64 capacity, MemoryMappedFileAccess access) [0x00000] in <filename unknown>:0 at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile (System.String path) [0x00000] in <filename unknown>:0 at ConsoleApplication1.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
나는 beaglebone에 제어 GPIO 핀을 포함하는 프로젝트를 진행하고있다. 나는 C# (일부 익숙하지 않은 언어)으로 일부 파이썬 코드를 이식하려고 시도하고 있으며 파이썬에서했던 것처럼 파일을 메모리 맵핑 된/dev/mem에있는 보드의 레지스터를 열려고하는 문제에 부딪혔다. . 나는 .NET Framework 4.0.30319로 Visual Studio 2010에서 코드를 작성하고 있으며 컴파일러 버전 2.10.8.1의 모노를 사용하여 우분투에서 실행하고 있습니다. 다음과 같은 오류가 발생
는long offset = 0x4804c000;
long length = 0xfff;
using (var mm0 = MemoryMappedFile.CreateFromFile(@"/dev/mem", FileMode.Open,
"gpio1", capacity))
{
using (var accessor = mm0.CreateViewAccessor(offset, length))
{
do stuff
}
}
:
Unhandled Exception: System.ArgumentException: capacity at System.IO.MemoryMappedFiles.MemoryMapImpl.Open (System.String path, FileMode mode, Int64 capacity, MemoryMappedFileAccess access) [0x00000] in <filename unknown>:0 at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile (System.String path, FileMode mode, System.String mapName, Int64 capacity, MemoryMappedFileAccess access) [0x00000] in <filename unknown>:0 at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile (System.String path, FileMode mode, System.String mapName, Int64 capacity) [0x00000] in <filename unknown>:0 at ConsoleApplication1.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: capacity at System.IO.MemoryMappedFiles.MemoryMapImpl.Open (System.String path, FileMode mode, Int64 capacity, MemoryMappedFileAccess access) [0x00000] in <filename unknown>:0 at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile (System.String path, FileMode mode, System.String mapName, Int64 capacity, MemoryMappedFileAccess access) [0x00000] in <filename unknown>:0 at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile (System.String path, FileMode mode, System.String mapName, Int64 capacity) [0x00000] in <filename unknown>:0 at ConsoleApplication1.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
내가 지정하고뿐만 아니라 메모리 맵의 용량을 지정하지 시도한 다음과 같이
다운 제거 코드는 몇 메가 바이트에서 보드의 사용 가능한 전체 RAM에 이르는 용량에 대한 다양한 가치가 있습니다. 누구든지 여기에서 어디로 가야할지에 대한 조언을 갖고 있습니까?
용량 매개 변수를 사용하지 않는 CreateFromFile 메서드를 사용하면 같은 오류가 발생합니까? – Dirk
예. 흥미롭게도 (그렇지 않습니까?) 나는 다른/훨씬 더 작은 파일을 문제없이 열 수 있었기 때문에/dev/mem에 대해 뭔가있을 수 있다고 생각합니다. – user3288736
방금 Mono를 3.2.8으로 업그레이드하여 프로그램이 더 잘 작동하는지 확인했습니다. 불행히도 System.TypeInitializationException도 발생합니다 : Mono.Unix.Native.Syscall ---> System .EntryPointNotFoundException : Mono_Posix_Syscall_get_at_fdcwd' 오류가 발생하지만 'MessageBox.Show()'를 호출하면 발생합니다. – drew010