-
-
Notifications
You must be signed in to change notification settings - Fork 643
Sharing violation on assembly after calling AssemblyDefinition.ReadAssembly
#291
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
Comments
Please see the changelog for the 0.10 update which document breaking changes and how to handle them. Your code which looks like: var assembly = AssemblyDefinition.ReadAssembly (mono_android);
// Strip out [Register] attributes
foreach (TypeDefinition type in assembly.MainModule.Types)
ProcessType (type);
assembly.Write (mono_android); Needs to be updated to read: using (var assembly = AssemblyDefinition.ReadAssembly (mono_android, new ReaderParameters { ReadWrite = true }))
{
// Strip out [Register] attributes
foreach (TypeDefinition type in assembly.MainModule.Types)
ProcessType (type);
assembly.Write ();
} |
lewurm
added a commit
to lewurm/xamarin-android
that referenced
this issue
Sep 21, 2016
… assembly see jbevain/cecil#291 this fixes one of the `Sharing violation` issues, probably also #44529
lewurm
added a commit
to lewurm/xamarin-android
that referenced
this issue
Sep 21, 2016
… assembly see jbevain/cecil#291 this fixes one of the `Sharing violation` issues, probably also #44529
lewurm
added a commit
to lewurm/xamarin-android
that referenced
this issue
Sep 22, 2016
… assembly see jbevain/cecil#291 this fixes one of the `Sharing violation` issues, probably also #44529
lewurm
added a commit
to lewurm/xamarin-android
that referenced
this issue
Sep 22, 2016
… assembly see jbevain/cecil#291 this fixes one of the `Sharing violation` issues, probably also #44529
lewurm
added a commit
to lewurm/xamarin-android
that referenced
this issue
Sep 22, 2016
… assembly see jbevain/cecil#291 this fixes one of the `Sharing violation` issues, probably also #44529
akoeplinger
pushed a commit
to akoeplinger/cecil
that referenced
this issue
Apr 13, 2025
…406.1 (jbevain#291) [main] Update dependencies from dotnet/arcade
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With bumping Cecil to a more recent version (from a version from 2013 or something), we run into a problem on xamarin-android, where we get
The problem starts here: https://github.com/xamarin/xamarin-android/blob/59ec488b4005a09fc0e5f330f217e78c3fa14724/src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs#L27 (we call
AssemblyDefinition.ReadAssembly ()
). Afterwards we do some other file operations on that same assembly. I see that the process still has a filedescriptor on the assembly in question open and thus fails with the error above. I looked a bit into the code, and I think https://github.com/mono/cecil/blob/505b07d6974d8405a63124139733c6fdc0e67bc7/Mono.Cecil.PE/ImageReader.cs#L29 needs to callDisposable ()
for itsStream
member eventually. Here is a test case that highlights the problem:The text was updated successfully, but these errors were encountered: