Skip to content
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

Add stateful marshaller support to the CustomMarshallerAttributeAnalyzer #72888

Merged
merged 6 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CallerAllocConstructorMustHaveBufferSizeDescription" xml:space="preserve">
<data name="CallerAllocFromManagedMustHaveBufferSizeDescription" xml:space="preserve">
<value>When the 'Managed to Unmanaged with Caller-Allocated Buffer' shape is used by providing a 'FromManaged' method that takes a 'Span&lt;T&gt;' on the marshaller type, the type must provide a static 'BufferSize' property to provide the number of elements in the caller-allocated buffer.</value>
</data>
<data name="CallerAllocConstructorMustHaveBufferSizeMessage" xml:space="preserve">
<data name="CallerAllocFromManagedMustHaveBufferSizeMessage" xml:space="preserve">
<value>The marshaller type '{0}' must have a static read-only 'int' 'BufferSize' property to specify the size of the caller-allocated buffer because it has a FromManaged method that takes a caller-allocated 'Span&lt;{1}&gt;'</value>
</data>
<data name="StatelessLinearCollectionCallerAllocConstructorMustHaveBufferSizeDescription" xml:space="preserve">
<data name="StatelessLinearCollectionCallerAllocFromManagedMustHaveBufferSizeDescription" xml:space="preserve">
<value>When the 'Managed to Unmanaged with Caller-Allocated Buffer' shape is used by providing an 'AllocateContainerForUnmanagedElements' method that takes a 'Span&lt;T&gt;' on the marshaller type, the type must provide a static 'BufferSize' property to provide the number of elements in the caller-allocated buffer.</value>
</data>
<data name="StatelessLinearCollectionCallerAllocConstructorMustHaveBufferSizeMessage" xml:space="preserve">
<data name="StatelessLinearCollectionCallerAllocFromManagedMustHaveBufferSizeMessage" xml:space="preserve">
<value>The marshaller type '{0}' must have a static read-only 'int' 'BufferSize' property to specify the size of the caller-allocated buffer because it has an 'AllocateContainerForUnmanagedElements' method that takes a caller-allocated 'Span&lt;{1}&gt;'</value>
</data>
<data name="CannotForwardToDllImportDescription" xml:space="preserve">
Expand Down Expand Up @@ -379,7 +379,7 @@
<value>Overloading the 'FromUnmanaged' method is unuspported as some shapes are unable to distinguish between overloads.</value>
</data>
<data name="FromUnmanagedOverloadsNotSupportedMessage" xml:space="preserve">
<value>Overloading the 'FromUnmanaged' method is not supported in custom marshallers</value>
<value>The type '{0}' overloads the 'FromUnmanaged' method, which is not supported in custom marshallers</value>
</data>
<data name="ToUnmanagedFromManagedTypesMustMatchDescription" xml:space="preserve">
<value>The return type of 'ConvertToUnmanaged' and the parameter type of 'ConvertToManaged' must be the same.</value>
Expand Down Expand Up @@ -447,6 +447,12 @@
<data name="ElementTypesOfReturnTypesMustMatchMessage" xml:space="preserve">
<value>The element type of the span returned by '{0}' must be the same type as the element type of the span returned by '{1}'.</value>
</data>
<data name="ElementMarshallerCannotBeStatefulDescription" xml:space="preserve">
<value>A marshaller for an element scenario cannot be stateful.</value>
</data>
<data name="ElementMarshallerCannotBeStatefulMessage" xml:space="preserve">
<value>The specified marshaller type '{0}' is a stateful marshaller, but stateful marshallers are not allowed in the provided marshal mode '{1}'</value>
</data>
<data name="RequiresAllowUnsafeBlocksDescription" xml:space="preserve">
<value>LibraryImportAttribute requires unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</value>
</data>
Expand All @@ -456,4 +462,34 @@
<data name="RequiresAllowUnsafeBlocksTitle" xml:space="preserve">
<value>LibraryImportAttribute requires unsafe code.</value>
</data>
</root>
<data name="StatefulMarshallerRequiresFromManagedDescription" xml:space="preserve">
<value>A stateful marshaller that supports a managed-to-unmanaged marshal mode must provide a 'FromManaged' instance method that takes the managed value as a parameter and returns 'void'.</value>
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
</data>
<data name="StatefulMarshallerRequiresFromManagedMessage" xml:space="preserve">
<value>The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a one-parameter instance method named 'FromManaged' that takes a '{2}' as a parameter and returns 'void'</value>
</data>
<data name="StatefulMarshallerRequiresToUnmanagedDescription" xml:space="preserve">
<value>A stateful marshaller that supports a managed-to-unmanaged marshal mode must provide a 'ToUnmanaged' instance method that takes no parameters and returns the 'unmanaged' type.</value>
</data>
<data name="StatefulMarshallerRequiresToUnmanagedMessage" xml:space="preserve">
<value>The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a zero-parameter instance method named 'ToUnmanaged' returns the 'unmanaged' type for the marshaller</value>
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
</data>
<data name="StatefulMarshallerRequiresFromUnmanagedDescription" xml:space="preserve">
<value>A stateful marshaller that supports a unmanaged-to-managed marshal mode must provide a 'FromUnmanaged' instance method that takes the unmanaged value as a parameter and returns 'void'.</value>
</data>
<data name="StatefulMarshallerRequiresFromUnmanagedMessage" xml:space="preserve">
<value>The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a one-parameter instance method named 'FromUnmanaged' that takes the 'unmanaged' value as a parameter and returns 'void'</value>
</data>
<data name="StatefulMarshallerRequiresToManagedDescription" xml:space="preserve">
<value>A stateful marshaller that supports a unmanaged-to-managed marshal mode must provide a 'ToManaged' instance method that takes no parameters and returns the managed type.</value>
</data>
<data name="StatefulMarshallerRequiresToManagedMessage" xml:space="preserve">
<value>The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a zero-parameter instance method named 'ToManaged' returns '{2}'</value>
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
</data>
<data name="StatefulMarshallerRequiresFreeDescription" xml:space="preserve">
<value>A stateful marshaller must have a zero-parameter void-returning instance method named 'Free'.</value>
</data>
<data name="StatefulMarshallerRequiresFreeMessage" xml:space="preserve">
<value>The type '{0}' is a stateful marshaller and does not have a zero-parameter void-returning instance method named 'Free'</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<target state="translated">Přidat chybějící vlastní typu zařazovacích členů</target>
<note />
</trans-unit>
<trans-unit id="CallerAllocConstructorMustHaveBufferSizeDescription">
<trans-unit id="CallerAllocFromManagedMustHaveBufferSizeDescription">
<source>When the 'Managed to Unmanaged with Caller-Allocated Buffer' shape is used by providing a 'FromManaged' method that takes a 'Span&lt;T&gt;' on the marshaller type, the type must provide a static 'BufferSize' property to provide the number of elements in the caller-allocated buffer.</source>
<target state="new">When the 'Managed to Unmanaged with Caller-Allocated Buffer' shape is used by providing a 'FromManaged' method that takes a 'Span&lt;T&gt;' on the marshaller type, the type must provide a static 'BufferSize' property to provide the number of elements in the caller-allocated buffer.</target>
<note />
</trans-unit>
<trans-unit id="CallerAllocConstructorMustHaveBufferSizeMessage">
<trans-unit id="CallerAllocFromManagedMustHaveBufferSizeMessage">
<source>The marshaller type '{0}' must have a static read-only 'int' 'BufferSize' property to specify the size of the caller-allocated buffer because it has a FromManaged method that takes a caller-allocated 'Span&lt;{1}&gt;'</source>
<target state="new">The marshaller type '{0}' must have a static read-only 'int' 'BufferSize' property to specify the size of the caller-allocated buffer because it has a FromManaged method that takes a caller-allocated 'Span&lt;{1}&gt;'</target>
<note />
Expand Down Expand Up @@ -107,6 +107,16 @@
<target state="translated">Zařazovací typ nemá požadovaný tvar</target>
<note />
</trans-unit>
<trans-unit id="ElementMarshallerCannotBeStatefulDescription">
<source>A marshaller for an element scenario cannot be stateful.</source>
<target state="new">A marshaller for an element scenario cannot be stateful.</target>
<note />
</trans-unit>
<trans-unit id="ElementMarshallerCannotBeStatefulMessage">
<source>The specified marshaller type '{0}' is a stateful marshaller, but stateful marshallers are not allowed in the provided marshal mode '{1}'</source>
<target state="new">The specified marshaller type '{0}' is a stateful marshaller, but stateful marshallers are not allowed in the provided marshal mode '{1}'</target>
<note />
</trans-unit>
<trans-unit id="ElementTypesOfReturnTypesMustMatchDescription">
<source>The element type of the span returned by the first method must be the same type as the element type of the span returned by the second method.</source>
<target state="new">The element type of the span returned by the first method must be the same type as the element type of the span returned by the second method.</target>
Expand Down Expand Up @@ -153,8 +163,8 @@
<note />
</trans-unit>
<trans-unit id="FromUnmanagedOverloadsNotSupportedMessage">
<source>Overloading the 'FromUnmanaged' method is not supported in custom marshallers</source>
<target state="new">Overloading the 'FromUnmanaged' method is not supported in custom marshallers</target>
<source>The type '{0}' overloads the 'FromUnmanaged' method, which is not supported in custom marshallers</source>
<target state="new">The type '{0}' overloads the 'FromUnmanaged' method, which is not supported in custom marshallers</target>
<note />
</trans-unit>
<trans-unit id="GetPinnableReferenceReturnTypeBlittableDescription">
Expand Down Expand Up @@ -377,12 +387,62 @@
<target state="new">The return type of '{0}' must be the same type as the return type of '{1}'</target>
<note />
</trans-unit>
<trans-unit id="StatelessLinearCollectionCallerAllocConstructorMustHaveBufferSizeDescription">
<trans-unit id="StatefulMarshallerRequiresFreeDescription">
<source>A stateful marshaller must have a zero-parameter void-returning instance method named 'Free'.</source>
<target state="new">A stateful marshaller must have a zero-parameter void-returning instance method named 'Free'.</target>
<note />
</trans-unit>
<trans-unit id="StatefulMarshallerRequiresFreeMessage">
<source>The type '{0}' is a stateful marshaller and does not have a zero-parameter void-returning instance method named 'Free'</source>
<target state="new">The type '{0}' is a stateful marshaller and does not have a zero-parameter void-returning instance method named 'Free'</target>
<note />
</trans-unit>
<trans-unit id="StatefulMarshallerRequiresFromManagedDescription">
<source>A stateful marshaller that supports a managed-to-unmanaged marshal mode must provide a 'FromManaged' instance method that takes the managed value as a parameter and returns 'void'.</source>
<target state="new">A stateful marshaller that supports a managed-to-unmanaged marshal mode must provide a 'FromManaged' instance method that takes the managed value as a parameter and returns 'void'.</target>
<note />
</trans-unit>
<trans-unit id="StatefulMarshallerRequiresFromManagedMessage">
<source>The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a one-parameter instance method named 'FromManaged' that takes a '{2}' as a parameter and returns 'void'</source>
<target state="new">The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a one-parameter instance method named 'FromManaged' that takes a '{2}' as a parameter and returns 'void'</target>
<note />
</trans-unit>
<trans-unit id="StatefulMarshallerRequiresFromUnmanagedDescription">
<source>A stateful marshaller that supports a unmanaged-to-managed marshal mode must provide a 'FromUnmanaged' instance method that takes the unmanaged value as a parameter and returns 'void'.</source>
<target state="new">A stateful marshaller that supports a unmanaged-to-managed marshal mode must provide a 'FromUnmanaged' instance method that takes the unmanaged value as a parameter and returns 'void'.</target>
<note />
</trans-unit>
<trans-unit id="StatefulMarshallerRequiresFromUnmanagedMessage">
<source>The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a one-parameter instance method named 'FromUnmanaged' that takes the 'unmanaged' value as a parameter and returns 'void'</source>
<target state="new">The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a one-parameter instance method named 'FromUnmanaged' that takes the 'unmanaged' value as a parameter and returns 'void'</target>
<note />
</trans-unit>
<trans-unit id="StatefulMarshallerRequiresToManagedDescription">
<source>A stateful marshaller that supports a unmanaged-to-managed marshal mode must provide a 'ToManaged' instance method that takes no parameters and returns the managed type.</source>
<target state="new">A stateful marshaller that supports a unmanaged-to-managed marshal mode must provide a 'ToManaged' instance method that takes no parameters and returns the managed type.</target>
<note />
</trans-unit>
<trans-unit id="StatefulMarshallerRequiresToManagedMessage">
<source>The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a zero-parameter instance method named 'ToManaged' returns '{2}'</source>
<target state="new">The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a zero-parameter instance method named 'ToManaged' returns '{2}'</target>
<note />
</trans-unit>
<trans-unit id="StatefulMarshallerRequiresToUnmanagedDescription">
<source>A stateful marshaller that supports a managed-to-unmanaged marshal mode must provide a 'ToUnmanaged' instance method that takes no parameters and returns the 'unmanaged' type.</source>
<target state="new">A stateful marshaller that supports a managed-to-unmanaged marshal mode must provide a 'ToUnmanaged' instance method that takes no parameters and returns the 'unmanaged' type.</target>
<note />
</trans-unit>
<trans-unit id="StatefulMarshallerRequiresToUnmanagedMessage">
<source>The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a zero-parameter instance method named 'ToUnmanaged' returns the 'unmanaged' type for the marshaller</source>
<target state="new">The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a zero-parameter instance method named 'ToUnmanaged' returns the 'unmanaged' type for the marshaller</target>
<note />
</trans-unit>
<trans-unit id="StatelessLinearCollectionCallerAllocFromManagedMustHaveBufferSizeDescription">
<source>When the 'Managed to Unmanaged with Caller-Allocated Buffer' shape is used by providing an 'AllocateContainerForUnmanagedElements' method that takes a 'Span&lt;T&gt;' on the marshaller type, the type must provide a static 'BufferSize' property to provide the number of elements in the caller-allocated buffer.</source>
<target state="new">When the 'Managed to Unmanaged with Caller-Allocated Buffer' shape is used by providing an 'AllocateContainerForUnmanagedElements' method that takes a 'Span&lt;T&gt;' on the marshaller type, the type must provide a static 'BufferSize' property to provide the number of elements in the caller-allocated buffer.</target>
<note />
</trans-unit>
<trans-unit id="StatelessLinearCollectionCallerAllocConstructorMustHaveBufferSizeMessage">
<trans-unit id="StatelessLinearCollectionCallerAllocFromManagedMustHaveBufferSizeMessage">
<source>The marshaller type '{0}' must have a static read-only 'int' 'BufferSize' property to specify the size of the caller-allocated buffer because it has an 'AllocateContainerForUnmanagedElements' method that takes a caller-allocated 'Span&lt;{1}&gt;'</source>
<target state="new">The marshaller type '{0}' must have a static read-only 'int' 'BufferSize' property to specify the size of the caller-allocated buffer because it has an 'AllocateContainerForUnmanagedElements' method that takes a caller-allocated 'Span&lt;{1}&gt;'</target>
<note />
Expand Down
Loading