首页 > 解决方案 > 温文尔雅的“Hello World!” 程序不适用于 Visual Studio for Mac

问题描述

我在尝试执行“Hello World!”时遇到运行时错误。来自 Suave 网页的程序:

打开 Suave.Web 打开 Suave.Successful

[<EntryPoint>]
let main argv =
    startWebServer defaultConfig (OK "Hello, Suave!")
    0

出现此错误:

$YoLo:.cctor 在'/Users/[myUserName]/Library/Mobile Documents/com~apple~CloudDocs/Projects/SuaveRestApi/SuaveRestApi/bin/Debug/Suave.pdb'。可能是格式错误的 PDB 文件。堆栈跟踪:

在 <0xffffffff> at (wrapper managed-to-native) object.__icall_wrapper_mono_generic_class_init (intptr) [0x00007] in <699ddfd029d348d1a69fb1f9fc28d7cb>:0 at YoLo/UTF8.get_utf8 () [0x00000] in /Users/ademar/Projects/release/suave /src/Suave/Utils/YoLo.fs:447 在 Suave.Successful.OK (string) [0x00000] 在 /Users/ademar/Projects/release/suave/src/Suave/Combinators.fs:136 在 App.main ( string[]) [0x00000] in /Users/[myUserName]/Library/Mobile Documents/com~apple~CloudDocs/Projects/SuaveRestApi/SuaveRestApi/App.fs:6 at (wrapper runtime-invoke) .runtime_invoke_int_object (object,intptr ,intptr,intptr) [0x00057] in <5c0abea33afd9276a7450383a3be0a5c>:0 本地指令指针 (0x7fff71ccc23e) 周围的内存:0x7fff71ccc22e ff ff c3 90 90 90 b8 48 01 00 02 49 89 ........H 0..5 。我....0x7fff71ccc23e 73 08 48 89 c7 e9 6f a1 ff ff c3 55 48 89 e5 41 sH..o....呃..A 0x7fff71ccc24e 57 41 56 41 55 41 54 53 48 81 ec 88 00 00 00 9 WAVAUATSH ... ...我 0x7fff71ccc25e 89 f4 48 8d 05 01 c3 cb 32 48 8b 00 48 8d 9d 60 ..H.....2H..H..`

本机堆栈跟踪:

0 mono 0x000000010ba29842 mono_dump_native_crash_info + 898 1 mono
0x000000010b9cd303 mono_handle_native_crash + 195 2
libsystem_platform.dylib 0x00007fff71d77b3d _sigtramp + 29 3 mono 0x000000010bcdf008 simple_lower_case_mapping_higharea_table0 + 20296 4
libsystem_c.dylib 0x00007fff71c351c9 abort + 127 5 mono 0x000000010bbf9c5f mono_log_write_logfile + 351 6 mono
0x000000010bc15dac monoeg_g_log + 204 7 mono
0x000000010bac9e68 mono_ppdb_get_seq_points + 1112 8 单声道
0x000000010b93492f mono_method_to_ir + 1151 9 单声道
0x000000010b91ade7 mini_method_compile + 3479 10 mono
0x000000010b91e32c mono_jit_compile_method_inner + 76 11 mono
0x000000010b921cc9 mono_jit_compile_method_with_opt + 2665 12 mono
0x000000010b925d8e mono_jit_runtime_invoke + 526 13 mono
0x000000010bb241d4 do_runtime_invoke + 84 14 mono
0x000000010bb201a8 mono_runtime_class_init_full + 872 15 mono
0x000000010b97a69c mono_generic_class_init + 28 16 ???
0x000000010beb7e2c 0x0 + 4494949932 17 单声道
0x000000010b9261d3 mono_jit_runtime_invoke + 1619 18 单声道
0x000000010bb241d4 do_runtime_invoke + 84 19 单声道0x06000_main 单声道执行单声道
0x0060000_010bb27
0x000000010b98d19d mono_jit_exec + 349 21 mono
0x000000010b99037f mono_main + 11615 22 mono
0x000000010b915078 main + 264 23 libdyld.dylib
0x00007fff71b8ced9 start + 1 Pkilling 0x70000ed57000 from 0x1115795c0 Pkilling 0x70000eb54000 from 0x1115795c0 Entering thread summarizer pause from 0x1115795c0 Finished thread summarizer pause from 0x1115795c0.

等待转储线程恢复

来自 gdb 的调试信息:

(lldb) 命令源 -s 0 '/tmp/mono-gdb-commands.UoI26p' 在 '/tmp/mono-gdb-commands.UoI26p' 中执行命令。(lldb) 进程附加 --pid 1457 进程 1457 停止 * 线程 #1,名称 = 'tid_307',队列 = 'com.apple.main-thread',停止原因 = 信号 SIGSTOP 帧 #0:0x00007fff71ccb2d2 libsystem_kernel.dylib __wait4 + 10 libsystem_kernel.dylib__wait4: -> 0x7fff71ccb2d2 <+10>: jae 0x7fff71ccb2dc ; <+20> 0x7fff71ccb2d4 <+12>: movq %rax, %rdi 0x7fff71ccb2d7 <+15>: jmp 0x7fff71cc6381 ; cerror 0x7fff71ccb2dc <+20>: retq Target 0: (mono) 停止。

可执行模块设置为“/Library/Frameworks/Mono.framework/Versions/5.18.0/bin/mono”。架构设置为:x86_64h-apple-macosx。(lldb) 线程列表 进程 1457 停止 * 线程 #1: tid = 0xd6f5, 0x00007fff71ccb2d2 libsystem_kernel.dylib __wait4 + 10, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP thread #2: tid = 0xd6f6, 0x00007fff71cc97de libsystem_kernel.dylib__psynch_cvwait + 10, name = 'SGen worker' 线程 #3: tid = 0xd6f8, 0x00007fff71cc61b6 libsystem_kernel.dylib __recvfrom + 10,调试器代理 线程 #5:tid = 0xd700, 0x00007fff71cc7b6a libsystem_kernel.dylib __workq_kernreturn + 10 (lldb) 线程回溯所有 * 线程 #1,名称 = 'tid_307',队列 = 'com.apple.main-thread',停止原因 =信号 SIGSTOP * 帧 #0:0x00007fff71ccb2d2 libsystem_kernel.dylib mono_dump_native_crash_info at mini-posix.c:1079 [opt] 帧 #2:semaphore_wait_trap + 10, name = 'Finalizer'
thread #4: tid = 0xd6f9, 0x00007fff71cc93e6 libsystem_kernel.dylib

__workq_kernreturn + 10 thread #6: tid = 0xd701, 0x00007fff71cc7b6a libsystem_kernel.dylib__wait4 + 10 frame #1: 0x000000010ba299b6 monomono_dump_native_crash_info(signal="SIGABRT", ctx=0x00007ffee42eb0f0, info=<unavailable>) at mini-posix.c:1102 [opt] frame #3: 0x000000010b9cd303 monomono_handle_native_crash(signal="SIGABRT", ctx=0x00007ffee42eb0f0, info=0x00007ffee42eb088) at mini-exceptions.c:3197 [opt] frame #4: 0x00007fff71d77b3d libsystem_platform.dylib __pthread_kill _sigtramp + 29 frame #5: 0x00007fff71ccc23f libsystem_kernel.dylib+ 11 frame #6: 0x00007fff71d82c1c libsystem_pthread.dylib pthread_kill + 285 frame #7: 0x00007fff71c351c9 libsystem_c.dylibabort + 127 frame #8: 0x000000010bbf9c5f 单声道mono_log_write_logfile(log_domain=<unavailable>, level=<unavailable>, hdr=<unavailable>, message="Method idx 6984 is greater than number of rows (6984) in PPDB MethodDebugInformation table, for method <StartupCode$Suave>.$YoLo:.cctor in '/Users/[myUserName]/Library/Mobile Documents/com~apple~CloudDocs/Projects/SuaveRestApi/SuaveRestApi/bin/Debug/Suave.pdb'. Likely a malformed PDB file.") at mono-log-common.c:135 [opt] frame #9: 0x000000010bc15dac monomonoeg_g_log [内联] monoeg_g_logstr(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, msg=) 在 goutput.c:117 [opt] 帧 #10: monoeg_g_log [inlined] monoeg_g_logv_nofree(format=<unavailable>, args=<unavailable>) at goutput.c:128 [opt] frame #11: 0x000000010bc15d70 mono0x00000_010bc15d83 monoeg_g_log[, 内联] monoeg_g=g goutput.c:135 [opt] 帧 #12: 0x000000010bc15d70 单声道monoeg_g_log(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, format=<unavailable>) at goutput.c:144 [opt] frame #13: 0x000000010bac9e68 monomono_ppdb_get_seq_points(minfo=, source_file=, source_file_list=, source_files=, seq_points=0x00007ffee42eb730, n_seq_points=) 在 debug-mono-ppdb.c:427 [opt] 帧 #14: 0x000000010b93492f mono mono_method_to_ir(cfg=<unavailable>, method=<unavailable>, start_bblock=0x0000000000000000, end_bblock=0x0000000000000000, return_var=0x0000000000000000, inline_args=0x0000000000000000, inline_offset=<unavailable>, is_virtual_call=<unavailable>) at method-to-ir.c:6674 [opt] frame #15: 0x000000010b91ade7 monomini_method_34304(method=, domain=37 =0x00007fbc91f02f00, flags=JIT_FLAG_RUN_CCTORS, parts=0, aot_method_index=-1) at mini.c:3455 [opt] frame #16: 0x000000010b91e32c mono mono_jit_compile_method_inner(method=0x00007fbc94832ea8, target_domain=0x00007fbc91f02f00, opt=<unavailable>, error=0x00007ffee42ebd60) at mini.c:4043 [opt] frame #17: 0x000000010b921cc9 monomono_jit_compile_method_with_opt(method=0x00007fbc94832ea8, opt=, jit_only=1, error=0x00007ffee42ebd60) at mini -runtime.c:2411 [opt] 帧 #18: 0x000000010b925d8e 单声道mono_jit_runtime_invoke [inlined] mono_jit_compile_method_jit_only(method=<unavailable>, error=0x00007ffee42ebd60) at mini-runtime.c:2471 [opt] frame #19: 0x000000010b925d6e monomono_jit_runtime_invoke(method=, obj=, params=0x0000000000000000, exc=, error=0x00007ffee42ebd60) 在 mini-runtime.c:3011 [opt]000004 帧 #20: 0x0001单核细胞增多症do_runtime_invoke(method=0x00007fbc94832ea8, obj=0x0000000000000000, params=0x0000000000000000, exc=0x00007ffee42ebd08, error=0x00007ffee42ebd60) at object.c:2960 [opt] frame #21: 0x000000010bb201a8 monomono_runtime_class_init_full [内联] mono_runtime_try_invoke(method=, obj=, params=, error=0x00007ffee42ebd60) at object.c:3069 [opt] 帧 #22: 0x000000010bb20167 mono_runtime_class_init_full(vtable=0x00007fbc9402ee60, error=0x00007ffee42ebd60) at object.c:526 [opt] frame #23: 0x000000010b97a69c monomono_generic_class_init(vtable=) at jit-icalls.c:1511 [opt] frame #24: 0x000000010beb7e2c frame #25: 0x000000010b9261d3 mono mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=0x00007ffee42ec148, exc=0x00007fbc9402ee60, error=<unavailable>) at mini-runtime.c:3148 [opt] frame #26: 0x000000010bb241d4 monodo_runtime_invoke(method=0x00007fbc91f04798, obj=0x0000000000000000, params=0x00007ffee42ec148, exc=0x0000000000000000, error=0x00007ffee42ec180) at object.c:2960 [opt] frame #27: 0x000000010bb27cac mono do_exec_main_checked [inlined] mono_runtime_invoke_checked(method=<unavailable>, obj=<unavailable>, params=<unavailable>, error=0x00007ffee42ec180) at object.c:3128 [opt] frame #28: 0x000000010bb27c9d monodo_exec_main_checked(方法=0x00007fbc91f04798, args=, 错误=0x00007ffee42ec180) 在 object.c:4949 [opt] 帧 #29: 0x000000010b98d19d 单声道mono_jit_exec at driver.g.c:1236 [opt] frame #30: 0x000000010b98d18f monomono_jit_exec(domain=, assembly=, argc=1, argv=0x00007ffee42ec550) at driver.gc:1195 [opt] 帧 #31: 0x000000010b99037f mono mono_main [inlined] main_thread_handler at driver.g.c:1313 [opt] frame #32: 0x000000010b990348 monomono_main(argc=4, argv=) at driver.gc:2483 [opt] 帧#33: 0x000000010b915078 mono main [inlined] mono_main_with_options(argc=<unavailable>, argv=<unavailable>) at main.c:50 [opt] frame #34: 0x000000010b915064 monomain(argc=4, argv=) at main.c:405 [opt] 帧 #35: 0x00007fff71b8ced9 libdyld.dylibstart + 1 frame #36: 0x00007fff71b8ced9 libdyld.dylib开始 + 1 线程 #2,名称 = 'SGen worker' 帧 #0: 0x00007fff71cc97de libsystem_kernel .dylib __psynch_cvwait + 10 frame #1: 0x00007fff71d83593 libsystem_pthread.dylib_pthread_cond_wait + 724 帧 #2: 0x000000010bbf10eethread_func [inlined] mono_os_cond_wait(mutex=<unavailable>) at mono-os-mutex.h:173 [opt] frame #3: 0x000000010bbf10db mono单线程函数在 sgen-thread-pool.c:165 [opt] 帧 #4: 0x000000010bbf10cd 单声道thread_func(data=0x0000000000000000) at sgen-thread-pool.c:196 [opt] frame #5: 0x00007fff71d80305 libsystem_pthread.dylib_pthread_body + 126 帧 #6: 0x00007fff71d8326f libsystem_pthread.dylib_pthread_start + 70 frame #7: 0x00007fff71d7f415 libsystem_pthread.dylib线程启动 + #3 =“终结器”帧#0:0x00007fff71cc61b6 libsystem_kernel.dylibsemaphore_wait_trap + 10 frame #1: 0x000000010bb9e9aa monofinalizer_thread [inlined] mono_os_sem_wait(flags=MONO_SEM_FLAGS_ALERTABLE) 在 mono-os-semaphore.h:90 [opt] 帧 #2: 0x000000010bb9e99f mono finalizer_thread at mono-coop-semaphore.h:43 [opt] frame #3: 0x000000010bb9e985 monofinalizer_thread(unused=) at gc.c:918 [opt] 帧 #4: 0x000000010bb49e13 mono start_wrapper [inlined] start_wrapper_internal at threads.c:1151 [opt] frame #5: 0x000000010bb49d83 monostart_wrapper (数据= 0x00007FBC91F34850)在线程中:1211 [OPT]帧#6:0x00007FF71D80305 libsystem_pthread.dylib _pthread_body + 126 frame #7: 0x00007fff71d8326f libsystem_pthread.dylib_pthread_start_start + 70框架8:8:0x000071D71D71D71D71D71D71DLILENBARENGER +三thread_start + 13 thread #4, name = 'Debugger agent' frame #0: 0x00007fff71cc93e6 libsystem_kernel.dylibflom +三十架三十兰布socket_transport_recv(buf=2001-01-01 00:00:00 UTC, len=11) at debugger-agent.c:1108 [opt] frame #2: 0x000000010ba6f296 mono; 11) 在 debugger-agent.c:1518 [opt] 帧 #3: 0x000000010ba6f27c 单声道debugger_thread(arg=<unavailable>) at debugger-agent.c:9484 [opt] frame #4: 0x000000010bb49e13 monostart_wrapper [内联] start_wrapper_internal at threads.c:1151 [opt] 帧 #5: 0x000000010bb49d83 单声道start_wrapper(data=0x00007fbc91f389a0) at threads.c:1211 [opt] frame #6: 0x00007fff71d80305 libsystem_pthread.dylib_pthread_body + 126 frame #7: 0x00007fff71d8326f libsystem_pthread.dylib _pthread_start + 70 frame #8: 0x00007fff71d7f415 libsystem_pthread.dylibthread_start + 13 thread #5 frame #0: 0x00007fff71cc7b6a libsystem_kernel.dylib __workq_kernreturn + 10 frame #1: 0x00007fff71d7f630 libsystem_pthread.dylib_pthread_wqthread + 446 frame #2: 0x00007fff71d7f405 libsystem_pthread.dylib start_wqthread + 13 thread #6 frame #0: 0x00007fff71cc7b6a libsystem_kernel.dylib__workq_kernreturn + 10 frame #1: 0x00007fff71d7f630 libsystem_pthread.dylib _pthread_wqthread + 446 frame #2: 0x00007fff71d7f405 libsystem_pthread.dylibstart_wqthread + 13 (lldb) 分离

==================================================== =============== 执行本机代码时收到 SIGABRT。这通常表示单声道运行时或您使用的本机库之一中的致命错误

应用。

(lldb) 退出进程 1457 分离

标签: macosvisual-studiomonosuave

解决方案


Visual Studio for Mac 和 Suave 似乎存在问题。我在 Visual Studio Code 中做了同样的测试(也适用于 mac)并且工作正常。


推荐阅读