Was macht MethodImplOptions.Synchronized?Was macht MethodImplOptions.Synchronized?
Ist der Code unter
[MethodImpl(MethodImplOptions.Synchronized)]
public void Method()
{
MethodImpl();
}
entspricht
public void Method()
{
lock(this)
{
MethodImpl();
}
}
die zum Beispiel Methoden und Eigenschaften wahr ist, aber für statische diejenigen, sperrt sie von der Art, die [geht gegen Best-Practice ] (http://michaelprimeaux.com/blog/2008/01/09/methodimploptions-dot-synchronized/) und hat tatsächlich einen bekannten [Fehler auf x64-Systemen] (https://connect.microsoft.com/VisualStudio/feedback/details/423280/methodimpl-methodimploptions-synchronisierte-intermittierend-throws-synchronizationlockexception-when-used-on-statisch-method-on-x64) th at causes Objektsynchronisationsausnahmen werden ausgelöst. – Shaun