diff --git a/IDisposableAnalyzers/IDisposableAnalyzers.csproj b/IDisposableAnalyzers/IDisposableAnalyzers.csproj index da3b57d0..a4563bd7 100644 --- a/IDisposableAnalyzers/IDisposableAnalyzers.csproj +++ b/IDisposableAnalyzers/IDisposableAnalyzers.csproj @@ -66,7 +66,10 @@ - + + + + diff --git a/IDisposableAnalyzers/build/IDisposableAnalyzers.targets b/IDisposableAnalyzers/build/IDisposableAnalyzers.targets new file mode 100644 index 00000000..f344706c --- /dev/null +++ b/IDisposableAnalyzers/build/IDisposableAnalyzers.targets @@ -0,0 +1,23 @@ + + + + $(MSBuildThisFileDirectory)OwnershipAttributes$(DefaultLanguageSourceExtension) + + true + + + + + + + <_GeneratedCodeFiles Include="$(OwnershipAttributesPath)" Visible="false" Condition="'$(UseWPF)' == 'true'" /> + + + + + + + + diff --git a/IDisposableAnalyzers/build/OwnershipAttributes.cs b/IDisposableAnalyzers/build/OwnershipAttributes.cs new file mode 100644 index 00000000..21372e42 --- /dev/null +++ b/IDisposableAnalyzers/build/OwnershipAttributes.cs @@ -0,0 +1,28 @@ +namespace IDisposableAnalyzers +{ + using System; + + /// + /// The return value must be disposed by the caller. + /// + [AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + internal sealed class GivesOwnershipAttribute : Attribute + { + } + + /// + /// The return value must not be disposed by the caller. + /// + [AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + internal sealed class KeepsOwnershipAttribute : Attribute + { + } + + /// + /// The ownership of instance is transferred and the receiver is responsible for disposing. + /// + [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + internal sealed class TakesOwnershipAttribute : Attribute + { + } +}