Closed Michael-Kelley closed 1 year ago
I had a similar issue today when compiling with ILC
, but it seems to be related to strings
. I also couldn't display the content and title correctly when I tried MessageBoxW
.
I later removed the --dehydrate
argument and the string output worked.
Or add the prop <IlcDehydrate>false</IlcDehydrate>
to your project.
Hope this useful to you.😄
That did the trick. Thanks! I assume dehydration affects the memory layout of the string and that this is what is causing it to fail with dehydration enabled?
I assume dehydration affects the memory layout of the string and that this is what is causing it to fail with dehydration enabled?
Because the dehydrated data is only supported at runtime.
When "Dehydrate" is enabled (which is enabled by default in .NET 8 Aot), the runtime data structures are dehydrate encoded and later dehydrate decoded in Bootstrap/main.cpp (and this StartupCodeHelpers.cs -> RehydrateData).
If you remove the runtime of your app, it will not be able to decode the dehydrated data at startup...
See more:
When "Dehydrate" is disabled, the raw data can be found in the pointed address.
But if "Dehydrate" is enabled, you won't be able to find the raw data at the pointer address.
But it will exist in another place.
Only when "runtime" is left in the program will the dehydrated data be decoded at startup to the pointer address it originally pointed to. 🤔
I want to use the preview version of NativeAot in order to make use of the new
UnmanagedEntryPointsAssembly
MSBuild property, but this results in no console output when invokingWriteConsoleW
.Reproduction steps:
no-runtime
project file:dotnet publish -r win-x64 -c Debug
in a command prompt.no-runtime.exe
file from the publish directory.Expected result: Console should display
Hello world!
.Observed result: Console displays no text and no errors.