-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FST 1003 discussion] #229
Comments
The proposal has a layout and probing rules for the compiler which incorporates, arch, execution platform and fsharp version, and ... weirdly not the target platform. I assume and I may have overlooked it, that you expect a TP to be able to create for all future target platforms. My concern is that having the probing logic inside the compiler is just more of that helpful resolution which invariably bites us when we try to extend it. The actual resolution sounds an awful lot like what nuget and paket already do. It seems like it would be preferable to ensure that nuget and paket understand how to run select compiler extensions such as F# TypeProviders and Roslyn Analyzers. And we should ensure that FSI and FCS have good mechanisms for finding that out. Actually, I think they probably will be fine anyway if we have the means to make a TP reference a -r:. Anyway ... I am going to get a discussion going with the nuget team and sdk team to see if we can figure something out, so that Compiler Extensions are treated as first class items within the dotnet ecco-system. Kevin |
The target platform is selected via the primary reference ( This means it would be incorrect to add a target qualification: - we are specifically encouraging people to make TPDTCs that can cross-target, just as the F# compiler itself can cross-target.
I think it's great to have a discussion about compiler extensions in general. There are also similarities with MSBuild extensions. That said, my starting position is that we should not be gating on additions to nuget and paket here, despite the superficial similarities to other load-a-dynamic-extension problems. Neither NuGet nor Paket provide a "load-a-package-dynamcially" operation today, so we are gating on something that doesn't yet exist. This is covered in the Drawbacks and Alternatives sections of the RFC, but here are the basic reasons:
The RFC and PR navigate these issues and give us something we can deliver. It’s a tricky area, but IMHO that’s because .NET lacks a very fundamental dynamic operation (LoadPackage, giving us only LoadAssembly). |
Can we make design-time assembly resolution logic a part of Right now we have similar situation with NuGet dependencies of design-time assembly. If we do not want to pack all dlls inside TP package and restore them from NuGet we need to register AppDomain.CurrentDomain.add_AssemblyResolve(fun source args ->
SwaggerProvider.Internal.Configuration.resolveReferencedAssembly args.Name) See here for full resolution logic. Seems this code in the future should be also adjusted to take into account the design-time runtime that hosts TP. Can we unify dependency resolution logic between
|
That would not be the most reliable solution,
The build tool and compiler is responsible for assembly resolution leaving it to each type provider author would yield no end of grief. Much of the F# resolution issue of the past was due to TPs resolving assemblies the build knew nothing about.
Kevin
From: Sergey Tihon [mailto:[email protected]]
Sent: Friday, November 17, 2017 9:13 PM
To: fsharp/fslang-design <[email protected]>
Cc: Kevin Ransom <[email protected]>; Comment <[email protected]>
Subject: Re: [fsharp/fslang-design] [FST 1003 discussion] (#229)
Can we make design-time assembly resolution logic a part of TypeProvider.SDK instead of part of the compiler? Seems like logic may change in the future, so it is likely to allow TP authors fix/adjust resolution strategy.
Right now we have similar situation with NuGet dependencies of design-time assembly. If we do not want to pack all dlls inside TP package and restore them from NuGet we need to register AssemblyResolve handler on AppDomain and inject resolution strategy for 3rd party dependencies. (at least SwaggerProvider<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffsprojects%2FSwaggerProvider%2Fblob%2Fmaster%2Fsrc%2FSwaggerProvider.DesignTime%2FSwaggerProvider.fs%23L17-L18&data=02%7C01%7CKevin.Ransom%40microsoft.com%7C8367c3887c254bb5588508d52e42fd8a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636465787630731988&sdata=TB9Lhs%2BrsdOwC2%2BOEpGdhncYn6%2B0yRFCwrvBAnafblA%3D&reserved=0> and RProvider do so)
AppDomain.CurrentDomain.add_AssemblyResolve(fun source args ->
SwaggerProvider.Internal.Configuration.resolveReferencedAssembly args.Name)
See here<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffsprojects%2FSwaggerProvider%2Fblob%2Fmaster%2Fsrc%2FSwaggerProvider.DesignTime%2FConfiguration.fs%23L70&data=02%7C01%7CKevin.Ransom%40microsoft.com%7C8367c3887c254bb5588508d52e42fd8a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636465787630731988&sdata=j5tdbLEVCnWK3gemzuVO%2FtTy1NEaBDfsnrSAvTONQ68%3D&reserved=0> for full resolution logic. Seems this code in the future should be also adjusted to take into account the design-time runtime that hosts TP.
Can we unify dependency resolution logic between TP.DesignTime assembly and NuGet dependencies?
* Include resolution strategy in a new file inside SDK.
* TP authors add new file in their project and register AssemblyResolve handler in TP.dll
* Compiler/host process ask AppDomain.CurrentDomain to resolve TP.DesignTime.dll
* We can fix/patch assembly resolution logic and time and ship new version with TP.
* The compiler should know that resolution strategy may be pluggable - we can control it using new param in TypeProviderAssembly
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffsharp%2Ffslang-design%2Fissues%2F229%23issuecomment-345419207&data=02%7C01%7CKevin.Ransom%40microsoft.com%7C8367c3887c254bb5588508d52e42fd8a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636465787630731988&sdata=fYLmDuhyLViaeWSE%2FLzXbqqnYpwAKmxrHtNFzHo96XE%3D&reserved=0>, or mute the thread<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAE76Fm4WISJR2RbdTIQeCwLYgwEocIXsks5s3mdGgaJpZM4QWcSH&data=02%7C01%7CKevin.Ransom%40microsoft.com%7C8367c3887c254bb5588508d52e42fd8a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636465787630731988&sdata=u7XV3O3Z0IF6Dr99ccweVXnm%2FoNEQjBcw8xSZRUUROo%3D&reserved=0>.
|
Closing old discussion, as this is implemented and shipped |
Discussion thread for https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1003-loading-type-provider-design-time-components.md
The text was updated successfully, but these errors were encountered: