-
Notifications
You must be signed in to change notification settings - Fork 520
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
paket.exe uses GetCustomAttributes and loads dependencies, could it use GetCustomAttributesData? #1289
Comments
trying to make it work, but the change breaks some integration tests. so need to dig deeper |
update build to workaround fsprojects/Paket#1289
seems GetCustomAttributesData does not work together with ReflectionOnlyLoadFrom. |
I'm not sure, probably. However it would definitely be better to avoid reflection-based loading altogether. BTW the same underlying issue as #645 I worked around the problem by making sure FSharp.Core is CopyLocal=true when building the library fsprojects/FSharp.Control.AsyncSeq#41 |
yep we only want to have attributes. this is a never ending story. |
see aaed3a4 we could also use "ReflectionOnlyLoadFrom GetCustomAttributes" instead of "LoadFrom GetCustomAttributesData". Not sure what makes more sense. |
anyways I hope the latest version works |
There is a lightweight assembly reader that fits in a single F# file here: https://github.com/fsharp/FSharp.Data/blob/master/src/CommonProviderImplementation/AssemblyReader.fs It doesn't read IL but does read enough data to decode custom attributes, e.g. the decode routine is called here: https://github.com/fsharp/FSharp.Data/blob/0ea9937903d260 We could extract that to a separate repo and use paket single-file-include. |
"lightweight" in the sense it doesn't depend on reflection and doesn't add a DLL |
sounds great. I guess I will just try to paket include it from there. no need to create a new repo |
it seems to compile if I paket include the reader (see #1293) |
This to create an ILModuleReader: and this to decode attribute data: |
I tried in https://github.com/fsprojects/Paket/pull/1293/files#diff-74c1bcac29cb19f058c1e6032cc1ce19R130, but the elements property is always an empty array. Is there something wrong in my code? |
You'll want the custom attributes on the assembly manifest contained within the IL module |
that seems to work. thanks |
this is now available in 2.36.0-alpha001 release. @dsyme @sergey-tihon please give it a try. |
Cool! 👍 to move |
cool. released in 2.36 I wonder if we could use the same approach for FSharp.Formatting. Does this AssemblyReader allow to retrieve XMLDocs for all methods? //cc @tpetricek |
@forki - No, it doesn't read XML, just the binary. Also it doesn't resolve references (e.g. to find out facts about a referenced type), which is normally needed. |
Ah that's a pity, but thanks.
|
Interesting to know, Why we do not use Mono.Cecil? |
For F# Formatting? We want to get F# specific info like modules and functions... |
I'm getting a failure in a
paket pack
when a dependencies of the DLLs being packed is missing in the target directory. The callstack is below, but the basic problem is that paket is using GetCustomAttributes on the assembly being packed. I think it would be better if it used ReflectionOnlyLoadFrom and GetCustomAttributesData, or Mono.Cecil, or some other way of looking at the custom attributes that doesn't involve loading types and dependencies.The text was updated successfully, but these errors were encountered: