nanoframework / Home

:house: The landing page for .NET nanoFramework repositories.
https://www.nanoframework.net
MIT License
861 stars 78 forks source link

MDP: Generated marshalling code fails to compile #601

Closed thopiekar closed 4 years ago

thopiekar commented 4 years ago

Details about Problem

nanoFramework area: Visual Studio extension (MDP)

VS version: 16.5.4

VS extension version: 2019.1.8.11

Target: STM32 F411RE (issue should be platform-independent)

Firmware image version: [master] (v1.0.3 is the latest release today)

Device capabilities output: None

Description

The generated code by MDP leads to datatype errors. The problem can likely be solved manually, but the idea of the original workflow should keep users away from the marshalling code and should only require to inject code into the marked sections.

Detailed repro steps so we can see the same problem

  1. Generate native stub code with VS

  2. Add interop to cmake-variants.json

  3. Start rebuild

  4. Get the errors below

...

Other suggested things

Nothing special, but the .cs-code below:

using System;
using System.Runtime.CompilerServices;

namespace NF.awesome
{
    public static class LIB
    {
        #region Stubs

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern int NativeInitalize();

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern int NativeDeinitalize();

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern int NativeRunWorker();

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern int NativeWpaStationConnect(string param0, byte param1, string param2, byte param3);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern int NativeDhcpRequest();

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketIsReady();

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketCreate(UInt16 param0, byte param1, byte u8Flags);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketBind(byte param0, UInt16 param1, byte param2, byte param3);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketListen(byte param0, byte param1);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketAccept(byte param0, UInt16 param1, byte param2, byte param3);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketConnect(byte param0, UInt16 param1, byte param2, byte param3);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketSend(byte param0, byte[] param1, UInt16 param2, UInt16 param3);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketSendto(byte param0, byte[] param1, UInt16 param2, UInt16 param3, UInt16 param4, byte param5, byte param6);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketRecv(byte param0, byte[] param1, UInt16 param2, UInt32 param3);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketRecvfrom(byte param0, byte[] param1, UInt16 param2, UInt32 param3);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketClose(byte param0);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketGethostbyname(byte param0);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketSslSetSockOpt(byte param0, byte param1, Int32 param2, UInt16 param3);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketSetsockopt(byte param0, byte param1, byte param2, UInt32 param3, UInt16 param4);

        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern byte NativeSocketGetsockopt(byte param0, byte param1, byte param2, Int32 param3, byte param4);

        #endregion Stubs
    }
}

Expected behaviour

The generated code doesn't fail to compile. Normally, it should cause no conflicts since it doesn't have any custom code after generation and should compile itself while it does nothing.

Screenshot / Logs

Logs say more than words..

[main] Building folder: nf-interpreter 
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/nanoFramework/nf-interpreter/build --config RelWithDebInfo --target all -- -j 14
[build] [1/2  50% :: 0.353] Building CXX object targets-community/CMSIS-OS/ChibiOS/ST_NUCLEO64_F411RE_NF/CMakeFiles/nanoCLR.elf.dir/C_/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp.obj
[build] FAILED: targets-community/CMSIS-OS/ChibiOS/ST_NUCLEO64_F411RE_NF/CMakeFiles/nanoCLR.elf.dir/C_/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp.obj 
[build] C:\nf-toolchain\gcc-arm-none-eabi\9-2019-q4-major\win32\bin\arm-none-eabi-g++.exe  -DCORTEX_USE_FPU=TRUE -DNANOCLR_ENABLE_SOURCELEVELDEBUGGING  -DPLATFORM_ARM -DHAL_USE_COMMUNITY -DTRACE_MASK=0 -DWP_IMPLEMENTS_CRC32 -Itargets-community/CMSIS-OS/ChibiOS/ST_NUCLEO64_F411RE_NF -I../targets-community/CMSIS-OS/ChibiOS/ST_NUCLEO64_F411RE_NF -I../targets-community/CMSIS-OS/ChibiOS/ST_NUCLEO64_F411RE_NF/common -I../src/CLR/Core -I../src/CLR/Include -I../src/HAL/Include -I../src/PAL/Include -IChibiOS_Source/os/common/portability/GCC -IChibiOS_Source/os/common/startup/ARMCMx/compilers/GCC -IChibiOS_Source/os/common/startup/ARMCMx/devices/STM32F4xx -IChibiOS_Source/os/common/ext/ARM/CMSIS/Core/Include -IChibiOS_Source/os/common/ext/ST/STM32F4xx -IChibiOS_Source/os/hal/ports/STM32/LLD/ADCv2 -IChibiOS_Source/os/hal/ports/STM32/LLD/CANv1 -IChibiOS_Source/os/hal/ports/STM32/LLD/CRYPv1 -IChibiOS_Source/os/hal/ports/STM32/LLD/DACv1 -IChibiOS_Source/os/hal/ports/STM32/LLD/DMAv2 -IChibiOS_Source/os/hal/ports/STM32/LLD/EXTIv1 -IChibiOS_Source/os/hal/ports/STM32/LLD/GPIOv2 -IChibiOS_Source/os/hal/ports/STM32/LLD/I2Cv1 -IChibiOS_Source/os/hal/ports/STM32/LLD/MACv1 -IChibiOS_Source/os/hal/ports/STM32/LLD/OTGv1 -IChibiOS_Source/os/hal/ports/STM32/LLD/QUADSPIv1 -IChibiOS_Source/os/hal/ports/STM32/LLD/RNGv1 -IChibiOS_Source/os/hal/ports/STM32/LLD/RTCv2 -IChibiOS_Source/os/hal/ports/STM32/LLD/SDIOv1 -IChibiOS_Source/os/hal/ports/STM32/LLD/SPIv1 -IChibiOS_Source/os/hal/ports/STM32/LLD/TIMv1 -IChibiOS_Source/os/hal/ports/STM32/LLD/USARTv1 -IChibiOS_Source/os/hal/ports/STM32/LLD/xWDGv1 -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/ports/STM32/LLD/FLASHv2 -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/ports/STM32/LLD/CRCv1 -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/ports/STM32/LLD/RNGv1 -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/ports/STM32/LLD/FSMCv1 -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/ports/STM32/LLD/ONEWIREv1 -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/ports/STM32/LLD/QSPIv1 -IChibiOS_Source/os -IChibiOS_Source/os/license -IChibiOS_Source/os/hal/ports/common/ARMCMx -IChibiOS_Source/os/hal/include -IChibiOS_Source/os/hal/boards/ST_NUCLEO64_F411RE_NF -IChibiOS_Source/os/hal/osal/rt -IChibiOS_Source/os/oslib/include -IChibiOS_Source/os/rt/include -IChibiOS_Source/os/hal/ports/STM32/STM32F4xx -IChibiOS_Source/os/common/ports/ARMCMx -IChibiOS_Source/os/common/ports/ARMCMx/compilers/GCC -IChibiOS_Source/os/common/abstractions/cmsis_os -IChibiOS_Source/os/common/ext/CMSIS/include -IChibiOS_Source/os/common/ext/CMSIS/ST/STM32F4xx -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/include/dummy_includes -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/boards/ST_NUCLEO64_F411RE_NF -I../targets-community/CMSIS-OS/ChibiOS/nf-overlay/os/hal/boards/ST_NUCLEO64_F411RE_NF -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/common/ext/CMSIS/TI/STM32F4xx -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/common/startup/ARMCMx/devices/STM32F4xx -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/include -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/include/stm32_flash -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/include/stm32_crc -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/include/stm32_rng -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/include/stm32_fsmc -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/include/stm32_onewire -I../targets/CMSIS-OS/ChibiOS/nf-overlay/os/hal/include/stm32_qspi -Itargets/CMSIS-OS/common/Include -I../targets/CMSIS-OS/ChibiOS/Include -Itargets-community/CMSIS-OS/ChibiOS/ST_NUCLEO64_F411RE_NF/nanoCLR -I../targets-community/CMSIS-OS/ChibiOS/ST_NUCLEO64_F411RE_NF/nanoCLR -I../targets/CMSIS-OS/nanoCLR -I../targets/CMSIS-OS/ChibiOS/nanoCLR -Itargets/CMSIS-OS/ChibiOS/nanoCLR -I../src/CLR/Runtime.Native -I../src/CLR/CorLib -I../src/CLR/Startup -I../src/CLR/Diagnostics -I../src/CLR/Debugger -I../src/CLR/Helpers/TinyPrintf -I../src/CLR/Helpers/Base64 -I../src/nanoFramework.Runtime.Native -I../src/CLR/Messaging -I../src/CLR/WireProtocol -I../src/nanoFramework.System.Collections -I../src/nanoFramework.System.Text -I../src/nanoFramework.Runtime.Events -I../src/CLR/System.Math -I../targets/CMSIS-OS/ChibiOS/nanoCLR/Windows.Devices.Gpio -I../src/Windows.Devices.Gpio -I../targets/CMSIS-OS/ChibiOS/nanoCLR/Windows.Devices.I2c -I../src/Windows.Devices.I2c -I../targets/CMSIS-OS/ChibiOS/nanoCLR/Windows.Devices.Pwm -I../src/Windows.Devices.Pwm -I../targets/CMSIS-OS/ChibiOS/nanoCLR/Windows.Devices.SerialCommunication -I../src/Windows.Devices.SerialCommunication -I../targets/CMSIS-OS/ChibiOS/nanoCLR/Windows.Devices.Spi -I../src/Windows.Devices.Spi -IC:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop -IC:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/driver -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mabi=aapcs -nostdlib -Wall -Wextra -Werror -fshort-wchar -fno-builtin -fno-common -mno-long-calls -fno-exceptions -fcheck-new -Os -femit-class-debug-always -g3 -ggdb -std=c++11 -MD -MT targets-community/CMSIS-OS/ChibiOS/ST_NUCLEO64_F411RE_NF/CMakeFiles/nanoCLR.elf.dir/C_/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp.obj -MF targets-community\CMSIS-OS\ChibiOS\ST_NUCLEO64_F411RE_NF\CMakeFiles\nanoCLR.elf.dir\C_\nanoFramework\my-awesome-solution\my-awesome-project\Stubs\my-awesome-interop\my_awesome_project_NF_awesome_LIB_mshl.cpp.obj.d -o targets-community/CMSIS-OS/ChibiOS/ST_NUCLEO64_F411RE_NF/CMakeFiles/nanoCLR.elf.dir/C_/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp.obj -c C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp
[build] In file included from ../src/HAL/Include/nanoHAL_Types.h:9,
[build]                  from ../src/CLR/Include/nanoCLR_PlatformDef.h:217,
[build]                  from ../src/CLR/Include/nanoCLR_Interop.h:9,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project.h:12,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:9:
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp: In static member function 'static HRESULT Library_my_awesome_project_NF_awesome_LIB::NativeWincSocketRecv___STATIC__U1__U1__SZARRAY_U1__U2__U4(CLR_RT_StackFrame&)':
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:282:66: error: cannot bind non-const lvalue reference of type 'unsigned int&' to an rvalue of type 'unsigned int'
[build]   282 |         NANOCLR_CHECK_HRESULT( Interop_Marshal_UINT32( stack, 3, param3 ) );
[build]       |                                                                  ^~~~~~
[build] ../src/CLR/Include/nf_errors_exceptions.h:32:35: note: in definition of macro 'FAILED'
[build]    32 | #define FAILED(Status) ((HRESULT)(Status)<0)
[build]       |                                   ^~~~~~
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:282:9: note: in expansion of macro 'NANOCLR_CHECK_HRESULT'
[build]   282 |         NANOCLR_CHECK_HRESULT( Interop_Marshal_UINT32( stack, 3, param3 ) );
[build]       |         ^~~~~~~~~~~~~~~~~~~~~
[build] In file included from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project.h:12,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:9:
[build] ../src/CLR/Include/nanoCLR_Interop.h:138:109: note:   initializing argument 3 of 'HRESULT Interop_Marshal_UINT32(const CLR_RT_StackFrame&, unsigned int, unsigned int&)'
[build]   138 | HRESULT Interop_Marshal_UINT32( const CLR_RT_StackFrame &stackFrame, unsigned int paramIndex, unsigned int &param );
[build]       |                                                                                               ~~~~~~~~~~~~~~^~~~~
[build] In file included from ../src/HAL/Include/nanoHAL_Types.h:9,
[build]                  from ../src/CLR/Include/nanoCLR_PlatformDef.h:217,
[build]                  from ../src/CLR/Include/nanoCLR_Interop.h:9,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project.h:12,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:9:
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp: In static member function 'static HRESULT Library_my_awesome_project_NF_awesome_LIB::NativeWincSocketRecvfrom___STATIC__U1__U1__SZARRAY_U1__U2__U4(CLR_RT_StackFrame&)':
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:306:66: error: cannot bind non-const lvalue reference of type 'unsigned int&' to an rvalue of type 'unsigned int'
[build]   306 |         NANOCLR_CHECK_HRESULT( Interop_Marshal_UINT32( stack, 3, param3 ) );
[build]       |                                                                  ^~~~~~
[build] ../src/CLR/Include/nf_errors_exceptions.h:32:35: note: in definition of macro 'FAILED'
[build]    32 | #define FAILED(Status) ((HRESULT)(Status)<0)
[build]       |                                   ^~~~~~
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:306:9: note: in expansion of macro 'NANOCLR_CHECK_HRESULT'
[build]   306 |         NANOCLR_CHECK_HRESULT( Interop_Marshal_UINT32( stack, 3, param3 ) );
[build]       |         ^~~~~~~~~~~~~~~~~~~~~
[build] In file included from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project.h:12,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:9:
[build] ../src/CLR/Include/nanoCLR_Interop.h:138:109: note:   initializing argument 3 of 'HRESULT Interop_Marshal_UINT32(const CLR_RT_StackFrame&, unsigned int, unsigned int&)'
[build]   138 | HRESULT Interop_Marshal_UINT32( const CLR_RT_StackFrame &stackFrame, unsigned int paramIndex, unsigned int &param );
[build]       |                                                                                               ~~~~~~~~~~~~~~^~~~~
[build] In file included from ../src/HAL/Include/nanoHAL_Types.h:9,
[build]                  from ../src/CLR/Include/nanoCLR_PlatformDef.h:217,
[build]                  from ../src/CLR/Include/nanoCLR_Interop.h:9,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project.h:12,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:9:
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp: In static member function 'static HRESULT Library_my_awesome_project_NF_awesome_LIB::NativeWincSocketSslSetSockOpt___STATIC__U1__U1__U1__I4__U2(CLR_RT_StackFrame&)':
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:357:65: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
[build]   357 |         NANOCLR_CHECK_HRESULT( Interop_Marshal_INT32( stack, 2, param2 ) );
[build]       |                                                                 ^~~~~~
[build] ../src/CLR/Include/nf_errors_exceptions.h:32:35: note: in definition of macro 'FAILED'
[build]    32 | #define FAILED(Status) ((HRESULT)(Status)<0)
[build]       |                                   ^~~~~~
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:357:9: note: in expansion of macro 'NANOCLR_CHECK_HRESULT'
[build]   357 |         NANOCLR_CHECK_HRESULT( Interop_Marshal_INT32( stack, 2, param2 ) );
[build]       |         ^~~~~~~~~~~~~~~~~~~~~
[build] In file included from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project.h:12,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:9:
[build] ../src/CLR/Include/nanoCLR_Interop.h:143:108: note:   initializing argument 3 of 'HRESULT Interop_Marshal_INT32(const CLR_RT_StackFrame&, unsigned int, int&)'
[build]   143 | HRESULT Interop_Marshal_INT32 ( const CLR_RT_StackFrame &stackFrame, unsigned int paramIndex, signed int  &param );
[build]       |                                                                                               ~~~~~~~~~~~~~^~~~~
[build] In file included from ../src/HAL/Include/nanoHAL_Types.h:9,
[build]                  from ../src/CLR/Include/nanoCLR_PlatformDef.h:217,
[build]                  from ../src/CLR/Include/nanoCLR_Interop.h:9,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project.h:12,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:9:
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp: In static member function 'static HRESULT Library_my_awesome_project_NF_awesome_LIB::NativeWincSocketSetsockopt___STATIC__U1__U1__U1__U1__U4__U2(CLR_RT_StackFrame&)':
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:384:66: error: cannot bind non-const lvalue reference of type 'unsigned int&' to an rvalue of type 'unsigned int'
[build]   384 |         NANOCLR_CHECK_HRESULT( Interop_Marshal_UINT32( stack, 3, param3 ) );
[build]       |                                                                  ^~~~~~
[build] ../src/CLR/Include/nf_errors_exceptions.h:32:35: note: in definition of macro 'FAILED'
[build]    32 | #define FAILED(Status) ((HRESULT)(Status)<0)
[build]       |                                   ^~~~~~
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:384:9: note: in expansion of macro 'NANOCLR_CHECK_HRESULT'
[build]   384 |         NANOCLR_CHECK_HRESULT( Interop_Marshal_UINT32( stack, 3, param3 ) );
[build]       |         ^~~~~~~~~~~~~~~~~~~~~
[build] In file included from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project.h:12,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:9:
[build] ../src/CLR/Include/nanoCLR_Interop.h:138:109: note:   initializing argument 3 of 'HRESULT Interop_Marshal_UINT32(const CLR_RT_StackFrame&, unsigned int, unsigned int&)'
[build]   138 | HRESULT Interop_Marshal_UINT32( const CLR_RT_StackFrame &stackFrame, unsigned int paramIndex, unsigned int &param );
[build]       |                                                                                               ~~~~~~~~~~~~~~^~~~~
[build] In file included from ../src/HAL/Include/nanoHAL_Types.h:9,
[build]                  from ../src/CLR/Include/nanoCLR_PlatformDef.h:217,
[build]                  from ../src/CLR/Include/nanoCLR_Interop.h:9,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project.h:12,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:9:
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp: In static member function 'static HRESULT Library_my_awesome_project_NF_awesome_LIB::NativeWincSocketGetsockopt___STATIC__U1__U1__U1__U1__I4__U1(CLR_RT_StackFrame&)':
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:411:65: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
[build]   411 |         NANOCLR_CHECK_HRESULT( Interop_Marshal_INT32( stack, 3, param3 ) );
[build]       |                                                                 ^~~~~~
[build] ../src/CLR/Include/nf_errors_exceptions.h:32:35: note: in definition of macro 'FAILED'
[build]    32 | #define FAILED(Status) ((HRESULT)(Status)<0)
[build]       |                                   ^~~~~~
[build] C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:411:9: note: in expansion of macro 'NANOCLR_CHECK_HRESULT'
[build]   411 |         NANOCLR_CHECK_HRESULT( Interop_Marshal_INT32( stack, 3, param3 ) );
[build]       |         ^~~~~~~~~~~~~~~~~~~~~
[build] In file included from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project.h:12,
[build]                  from C:/nanoFramework/my-awesome-solution/my-awesome-project/Stubs/my-awesome-interop/my_awesome_project_NF_awesome_LIB_mshl.cpp:9:
[build] ../src/CLR/Include/nanoCLR_Interop.h:143:108: note:   initializing argument 3 of 'HRESULT Interop_Marshal_INT32(const CLR_RT_StackFrame&, unsigned int, int&)'
[build]   143 | HRESULT Interop_Marshal_INT32 ( const CLR_RT_StackFrame &stackFrame, unsigned int paramIndex, signed int  &param );
[build]       |                                                                                               ~~~~~~~~~~~~~^~~~~
[build] ninja: build stopped: subcommand failed.
[build] Build finished with exit code 1

Additional context

Nope, not really.

thopiekar commented 4 years ago

Something I see in common with all errors is that they come from 32bit variables. Doesn't matter whether signed or unsigned. All the smaller datatypes like bytes or *Int16 are working.

I just can't see the reason still but investigating..