Skip to content

Porting to .NET 10? #2

@adelinn

Description

@adelinn

Hello and thanks for the interesting work that's been put into making writing Windows Kernel-mode drivers possible in C#.

I want to make it possible for this to support .NET 10 and I was wondering what would be required for that.

Currently if I try to publish the package to get the sys driver I get the following errors and the .sys fie is not created.
This is what I run:

  1. dotnet build -c Release inside the WDK.NET folder
  2. dotnet publish -c Release -r win-x64 inside the WDK.NET.SampleDriver folder

I made sure to update the target framework to net10.0 from net7.0 and to fix the path to ntoskrnl.lib in SampleDriver.csproj.

SampleDriver net10.0 win-x64 failed with 55 error(s) (6,3s) → bin\Release\net10.0\win-x64\SampleDriver.dll
    bootstrapper.obj : error LNK2001: unresolved external symbol GetRuntimeException
    bootstrapper.obj : error LNK2001: unresolved external symbol RuntimeFailFast
    bootstrapper.obj : error LNK2001: unresolved external symbol AppendExceptionStackFrame
    bootstrapper.obj : error LNK2001: unresolved external symbol GetSystemArrayEEType
    bootstrapper.obj : error LNK2001: unresolved external symbol OnFirstChanceException
    bootstrapper.obj : error LNK2001: unresolved external symbol OnUnhandledException
    bootstrapper.obj : error LNK2001: unresolved external symbol ThreadEntryPoint
    bootstrapper.obj : error LNK2019: unresolved external symbol InitializeModules referenced in function wmain
    Runtime.WorkstationGC.lib(WriteBarriers.asm.obj) : error LNK2001: unresolved external symbol RhExceptionHandling_FailedAllocation
    Runtime.WorkstationGC.lib(CachedInterfaceDispatchAot.asm.obj) : error LNK2001: unresolved external symbol RhExceptionHandling_FailedAllocation
    Runtime.WorkstationGC.lib(GcProbe.asm.obj) : error LNK2001: unresolved external symbol RhExceptionHandling_FailedAllocation
    Runtime.WorkstationGC.lib(StubDispatch.asm.obj) : error LNK2001: unresolved external symbol RhExceptionHandling_FailedAllocation
    Runtime.WorkstationGC.lib(UniversalTransition.asm.obj) : error LNK2001: unresolved external symbol RhExceptionHandling_FailedAllocation
    Runtime.WorkstationGC.lib(ExceptionHandling.asm.obj) : error LNK2001: unresolved external symbol RhExceptionHandling_FailedAllocation
    Runtime.WorkstationGC.lib(WriteBarriers.asm.obj) : error LNK2001: unresolved external symbol RhThrowHwEx
    Runtime.WorkstationGC.lib(CachedInterfaceDispatchAot.asm.obj) : error LNK2001: unresolved external symbol RhThrowHwEx
    Runtime.WorkstationGC.lib(GcProbe.asm.obj) : error LNK2001: unresolved external symbol RhThrowHwEx
    Runtime.WorkstationGC.lib(StubDispatch.asm.obj) : error LNK2001: unresolved external symbol RhThrowHwEx
    Runtime.WorkstationGC.lib(UniversalTransition.asm.obj) : error LNK2001: unresolved external symbol RhThrowHwEx
    Runtime.WorkstationGC.lib(ExceptionHandling.asm.obj) : error LNK2001: unresolved external symbol RhThrowHwEx
    Runtime.WorkstationGC.lib(WriteBarriers.asm.obj) : error LNK2019: unresolved external symbol RhThrowEx referenced in function RhpCheckedAssignRefEDX
    Runtime.WorkstationGC.lib(CachedInterfaceDispatchAot.asm.obj) : error LNK2001: unresolved external symbol RhThrowEx
    Runtime.WorkstationGC.lib(GcProbe.asm.obj) : error LNK2001: unresolved external symbol RhThrowEx
    Runtime.WorkstationGC.lib(StubDispatch.asm.obj) : error LNK2001: unresolved external symbol RhThrowEx
    Runtime.WorkstationGC.lib(UniversalTransition.asm.obj) : error LNK2001: unresolved external symbol RhThrowEx
    Runtime.WorkstationGC.lib(ExceptionHandling.asm.obj) : error LNK2001: unresolved external symbol RhThrowEx
    Runtime.WorkstationGC.lib(WriteBarriers.asm.obj) : error LNK2019: unresolved external symbol RhRethrow referenced in function RhpCheckedAssignRefEDX
    Runtime.WorkstationGC.lib(CachedInterfaceDispatchAot.asm.obj) : error LNK2001: unresolved external symbol RhRethrow
    Runtime.WorkstationGC.lib(GcProbe.asm.obj) : error LNK2001: unresolved external symbol RhRethrow
    Runtime.WorkstationGC.lib(StubDispatch.asm.obj) : error LNK2001: unresolved external symbol RhRethrow
    Runtime.WorkstationGC.lib(UniversalTransition.asm.obj) : error LNK2001: unresolved external symbol RhRethrow
    Runtime.WorkstationGC.lib(ExceptionHandling.asm.obj) : error LNK2001: unresolved external symbol RhRethrow
    Runtime.WorkstationGC.lib(MiscHelpers.cpp.obj) : error LNK2019: unresolved external symbol RhpCalculateStackTraceWorker referenced in function RhpGetCurrentThreadStackTrace
    Runtime.WorkstationGC.lib(FinalizerHelpers.cpp.obj) : error LNK2019: unresolved external symbol ProcessFinalizers referenced in function "unsigned int __cdecl FinalizerStart(void *)" (?FinalizerStart@@YAIPEAX@Z)
    Runtime.WorkstationGC.lib(CachedInterfaceDispatchAot.asm.obj) : error LNK2019: unresolved external symbol RhpCidResolve referenced in function RhpInterfaceDispatchSlow
    LIBCMT.lib(tlsdyn.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
    LIBCMT.lib(new_scalar_nothrow.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
    LIBCMT.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_initialize referenced in function __scrt_initialize_crt
    LIBCMT.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_uninitialize referenced in function __scrt_initialize_crt
    LIBCMT.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_uninitialize_critical referenced in function __scrt_dllmain_uninitialize_critical
    LIBCMT.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_thread_attach referenced in function __scrt_dllmain_crt_thread_attach
    LIBCMT.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_thread_detach referenced in function __scrt_dllmain_crt_thread_attach
    LIBCMT.lib(utility.obj) : error LNK2019: unresolved external symbol _is_c_termination_complete referenced in function __scrt_dllmain_uninitialize_c
    LIBCMT.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_initialize referenced in function __scrt_initialize_crt
    LIBCMT.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_uninitialize referenced in function __scrt_uninitialize_crt
    LIBCMT.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_uninitialize_critical referenced in function __scrt_dllmain_uninitialize_critical
    LIBCMT.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_thread_attach referenced in function __scrt_dllmain_crt_thread_attach
    LIBCMT.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_thread_detach referenced in function __scrt_dllmain_crt_thread_detach
    LIBCMT.lib(utility_desktop.obj) : error LNK2019: unresolved external symbol __current_exception referenced in function __scrt_unhandled_exception_filter
    LIBCMT.lib(utility_desktop.obj) : error LNK2019: unresolved external symbol __current_exception_context referenced in function __scrt_unhandled_exception_filter
    LIBCMT.lib(throw_bad_alloc.obj) : error LNK2019: unresolved external symbol __std_exception_copy referenced in function "public: __cdecl std::bad_alloc::bad_alloc(class std::bad_alloc const &)" (??0bad_alloc@std@@QEAA@AEBV01@@Z)
    LIBCMT.lib(throw_bad_alloc.obj) : error LNK2019: unresolved external symbol __std_exception_destroy referenced in function "public: virtual __cdecl std::bad_alloc::~bad_alloc(void)" (??1bad_alloc@std@@UEAA@XZ)
    LIBCMT.lib(throw_bad_alloc.obj) : error LNK2019: unresolved external symbol _CxxThrowException referenced in function "void __cdecl __scrt_throw_std_bad_alloc(void)" (?__scrt_throw_std_bad_alloc@@YAXXZ)
    bin\Release\net10.0\win-x64\publish\SampleDriver.sys : fatal error LNK1120: 32 unresolved externals
    C:\Users\<redacted>\.nuget\packages\microsoft.dotnet.ilcompiler\10.0.4\build\Microsoft.NETCore.Native.targets(396,5): error MSB3073: The command ""C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64\link.exe" @"obj\Release\net10.0\win-x64\native\link.rsp"" exited with code 1120.

Build failed with 55 error(s) in 8,1s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions