!bxVOQwsVoHhZcmNDGw:nixos.org

Nix + dotnet

126 Members
24 Servers

Load older messages


SenderMessageTime
13 Dec 2024
@gggkiller:matrix.orgGGG
In reply to @6pak:matrix.org
the runtime only looks at the .deps.json file to discover the library paths, which dotnet sdk populates from nuget info
That's good to know, I'll look into it and try to add that logic into the command
22:08:50
@gggkiller:matrix.orgGGGAlso, while running it in a dry run against avalonia, I ran into something rather unpleasant 22:11:45
@gggkiller:matrix.orgGGGThere's `.dll` and `.dylib` imports in it as well, so it won't be as plug'n'play as `autoPatchelfHook`, I had to add quite a few thing to the ignores list like `*.dll`, `kernel32`, `user32` and more22:13:17
@gggkiller:matrix.orgGGGIt might be worth adding an option to exclude certain files on top of ignoring certain imports22:13:51
14 Dec 2024
@6pak:matrix.org6pak corehost parses the json every launch so it would probably be fine? 01:34:55
@6pak:matrix.org6pak I meant that the runtime doesn't look at the runtimes/{rid}/native path, it's the nuget client that checks it in the packages and converts it into metadata that the .net sdk then puts into the final .deps.json 01:37:31
@6pak:matrix.org6pakbut build time nuget packages requiring native libs themselves is a valid point01:38:40
@6pak:matrix.org6pakwouldn't it make more sense to run (auto)patchcil as part of nuget overrides though?01:38:57
@6pak:matrix.org6pak yeahh thats fair 01:41:31
@6pak:matrix.org6pak it would be nice if people annotated those with SupportedOSPlatformAttribute, but they probably don't 01:41:54
@gggkiller:matrix.orgGGG
In reply to @6pak:matrix.org
corehost parses the json every launch so it would probably be fine?
I mean, it probably wouldn't be much overhead, I'm probably just overthinking it, but since it's already done, I wouldn't just throw it away myself
01:43:21
@gggkiller:matrix.orgGGG
In reply to @6pak:matrix.org
I meant that the runtime doesn't look at the runtimes/{rid}/native path, it's the nuget client that checks it in the packages and converts it into metadata that the .net sdk then puts into the final .deps.json
Oh, I see, that's indeed a big issue, I'll have to remove those lines from the logic since it's nuget only
01:44:19
@6pak:matrix.org6pakit just so happens that it's the same path in the output usually01:44:49
@6pak:matrix.org6pakbut in theory the .deps.json could specify any path01:44:58
@gggkiller:matrix.orgGGG
In reply to @6pak:matrix.org
wouldn't it make more sense to run (auto)patchcil as part of nuget overrides though?
Well, thinking about it, I don't think the tools in a nuget package use the native libraries in the runtime dir, they're probably packaged as a normal command line tool
01:46:27
@gggkiller:matrix.orgGGGOr there would be something in the `.deps.json` file pointing at it, so we shouldn't need any other special logic other than handling that file.01:47:03
@gggkiller:matrix.orgGGG
In reply to @6pak:matrix.org
it would be nice if people annotated those with SupportedOSPlatformAttribute, but they probably don't
They'd probably only annotate the methods that call those pinvoke shims instead of the shims themselves, so worst case it'd need some blackbox control flow analysis which would most likely fail due to reflection, so I don't think it's possible
01:48:11
@gggkiller:matrix.orgGGGBest that can be done is exclude some extensions based on the target RID most likely01:48:26
@gggkiller:matrix.orgGGGLike, if it's `linux-x64` we know it won't be needing any `.dll`s nor `.dylib`s01:49:05
@6pak:matrix.org6pakyou don't need to include the extension in dllimport library name though01:49:28
@gggkiller:matrix.orgGGGTrue, but a few do, so we could save some headache by excluding those beforehand 01:49:55
@gggkiller:matrix.orgGGGI saw a dllimport with kernel32.dll in avalonia, so if we auto excluded those it'd already save the need to manually specify the exclude globs based on the target platform on the nix side01:50:55
@gggkiller:matrix.orgGGGIt was all fine and dandy when I was only targeting the Avalonia.X11 assembly, but once I targeted the whole directory avalonia-ilspy outputs then it became a huge mess01:53:22
@6pak:matrix.org6pak actually, can .deps.json take absolute paths for managed dlls? 01:56:43
@gggkiller:matrix.orgGGGI'm not sure, I never even looked into what's in it properly 01:57:04
@gggkiller:matrix.orgGGGThis is my first time actually caring about them01:57:18
@6pak:matrix.org6pakwouldn't it mean we can easily share .net deps?01:57:45
@6pak:matrix.org6pakinstead of duplicating the dlls in every .net app in nix store01:57:54
@gggkiller:matrix.orgGGGMaybe, that's an interesting idea01:58:02
@gggkiller:matrix.orgGGGThough instead of that we could just symlink them there if we can't 01:58:15

Show newer messages


Back to Room ListRoom Version: 9