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
Can not use protobuf-net with ILRepack #1115
Comments
The only weird thing about that type is that there's a type-forward in place, and honestly: I can't think of a valid reason for there to be one. I've dropped it here - I can't guarantee that it'll help, but it does seem a likely cause. However, this sounds like a bug/glitch in ILRepack |
@mgravell thank you. Removing of forwarded type was the first thing I tried because these types can be found using dotPeek. But it didn't help. I created the similar bug in ILRepack repository gluck/il-repack#329 with the link to https://github.com/protobuf-net/protobuf-net/blob/main/src/protobuf-net.Core/Internal/DynamicallyAccessedMembersAttribute.cs I'll put comment here after the replying of ILRepack developers. Thank you. |
I made additional investigation. Firstly, I think ILRepack Developer will never reply to me :-) So, I downloaded ILRepack and found issue. The System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes can not be resolved because it's try to find it in System.Runtime. I think it's because of assemblies' order that it uses, but it's very hard to me to understand all in details in short time period. Maybe because of Scope that is System.Runtime, but real place of this type is Protobuf-net. Next, I've returned to Protobuf with new knowledge and make very quick and brutal fix that is quite enough for me at the moment. https://github.com/dimsa/protobuf-net/pull/1/files#diff-9e0c91d2aae978a7434c2f7d495b55dc790ae75230a0a142baa47cfbc1f89018 (Sorry, at the first time I made PR to your repository, but I really didn't want it) So, the issue was in Namespace that was used. I renamed attribute only to be sure that it will not be exported from System.Diagnostics.CodeAnalysis. Then I removed all .NET except of net6 to be sure that tests work fine. To summarize... I don't think that it is a bug of protobuf-net, but not sure if it's the bug of ILRepack. To fix this, it's possible to move DynamicallyAccessedMembersAttribute to another namespace (That was easier to me because your code and project structure much clearer to me than ILRepack). But the best solution is an update of ILRepack if it's possible. FYI: @timotei @gluck P.S. Hope my little investigation will help someone |
There will be no point in moving namespace - you might as well just nuke it
from orbit at that point. It is matched by the tooling based on the
namespace-qualified name, so if you change the namespace: no more
attribute. However, it should be directed correctly in the IL to the
appropriate assembly, in either case. Weird.
…On Tue, 12 Dec 2023, 17:59 Dmitriy Sorokin, ***@***.***> wrote:
I made additional investigation. Firstly, I think ILRepack Developer will
never reply to me :-) So, I downloaded ILRepack and found issue. The
System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes can not be
resolved because it's try to find it in System.Runtime. I think it's
because of assemblies' order that it uses, but it's very hard to me to
understand all in details in short time period. Maybe because of Scope that
is System.Runtime, but real place of this type is Protobuf-net.
default.png (view on web)
<https://github.com/protobuf-net/protobuf-net/assets/6938205/378443be-b410-4767-8158-0bab1e039b64>
Next, I've returned to Protobuf with new knowledge and make very quick and
brutal fix that is quite enough for me at the moment.
https://github.com/dimsa/protobuf-net/pull/1/files#diff-9e0c91d2aae978a7434c2f7d495b55dc790ae75230a0a142baa47cfbc1f89018
(Sorry, at the first time I made PR to your repository, but I really didn't
want it)
So, the issue was in Namespace that was used. I renamed attribute only to
be sure that it will not be exported from System.Diagnostics.CodeAnalysis.
Then I removed all .NET except of net6 to be sure that tests work fine.
To summarize... I don't think that it is a bug of protobuf-net, but not
sure if it's the bug of ILRepack. To fix this, it's possible to move
DynamicallyAccessedMembersAttribute to another namespace (That was easier
to me because your code and project structure much clearer to me than
ILRepack).
But the best solution is an update of ILRepack if it's possible. FYI:
@timotei <https://github.com/timotei> @gluck <https://github.com/gluck>
P.S. Hope my little investigation will help someone
—
Reply to this email directly, view it on GitHub
<#1115 (comment)>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEHMARXPSJ55SNZLNNI2TYJCLPLBFKMF2HI4TJMJ2XIZLTSOBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDUOJ2WLJDOMFWWLLTXMF2GG2C7MFRXI2LWNF2HTAVFOZQWY5LFUVUXG43VMWSG4YLNMWVXI2DSMVQWIX3UPFYGLLDTOVRGUZLDORPXI6LQMWWES43TOVSUG33NNVSW45FGORXXA2LDOOJIFJDUPFYGLKTSMVYG643JORXXE6NFOZQWY5LFVAZDAOBXHA4DAMUCUR2HS4DFUVUXG43VMWSXMYLMOVS2UMRQGM3DSMJZGI2TRJ3UOJUWOZ3FOKTGG4TFMF2GK>
.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
|
I try to merge libraries into one file using ILRepack
ILRepack.exe /union /out:repack.dll"ProbufRepack.dll" "System.Collections.Immutable.dll" "protobuf-net.Core.dll" "protobuf-net.dll"
And get the following error:
Please find attached simple project to reproduce it. ILRepack and all libraries can be found in bin/Release/net6.0 Protobuf and ILRepack have last versions.
ProbufRepack.zip
I also tried to download sources of Probuf-net.Core, I've found this types, but was not able to change this behavior.
The text was updated successfully, but these errors were encountered: