Add ability to update the friend assembly set of an assembly with Reflection Emit - #47784
Conversation
…lection Emit - Add routine/lock for updating friend assemblies - Unify all assembly handling custom attribute updates in the runtime - This adjusts the handling of the DebuggableAttribute, which in the past would have worked even if it was applied to anything via the CustomAttributeBuilder apis
| } | ||
| } | ||
|
|
||
| // Debuggable attribute processing |
|
|
||
| if (FAILED(hr)) | ||
| { | ||
| // See if the metadata engine gave us any error information. |
There was a problem hiding this comment.
Does the metadata engine ever set IErrorInfo?
(I know that this code was there even before your change.)
There was a problem hiding this comment.
I'll check. As you say, this code is old and has relics of a bygone era in it..
There was a problem hiding this comment.
Nope. IErrorInfo isn't set by anything in metadata. I'll get rid of this stuff.
|
|
||
| void CacheFriendAssemblyInfo(); | ||
| #ifndef DACCESS_COMPILE | ||
| ReleaseHolder<FriendAssemblyDescriptor> GetFriendAssemblyInfo(bool *pfNoFriendAssemblies); |
There was a problem hiding this comment.
Are the copy constructors, etc. on ReleaseHolder setup correctly to make it safe to use as return value?
There was a problem hiding this comment.
(We typically stay away from returning Holder types.)
There was a problem hiding this comment.
At some point the ReleaseHolder type I'm using was updated to have the appropriate move constructor to make this work safely. I've verified that with the new test case, the type is freed at the appropriate moment, and not earler, or later. In some work I've done where I could use tools like unique_ptr, I have found the pattern of allowing such returns to be a nice upgrade to readability.
| { | ||
| pFriendAssemblies = NO_FRIEND_ASSEMBLIES_MARKER; | ||
| m_pFriendAssemblyDescriptor = pFriendAssemblies.Extract(); | ||
| pFriendAssemblies.SuppressRelease(); |
There was a problem hiding this comment.
Extract includes SuppressRelease. This should not be needed.
| } | ||
| } | ||
|
|
||
| void QCALLTYPE COMDynamicWrite::DefineCustomAttribute(QCall::ModuleHandle pModule, INT32 token, INT32 conTok, LPCBYTE pBlob, INT32 cbBlob, BOOL toDisk) |
There was a problem hiding this comment.
toDisk argument is always false and can be deleted too.
There was a problem hiding this comment.
GetOnDiskEmitter and related code can be deleted too
There was a problem hiding this comment.
Good point... all that code is gone now too.
| } // void Assembly::CacheFriendAssemblyInfo() | ||
| } | ||
|
|
||
| ReleaseHolder<FriendAssemblyDescriptor> Assembly::GetFriendAssemblyInfo(bool *pfNoFriendAssemblies) |
There was a problem hiding this comment.
pfNoFriendAssemblies is not used in the method at all.
Fixes the runtime level changes needed to address issues #43685 and #30917