@@ -2383,6 +2383,15 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to This combination of arguments to '{0}' is disallowed because it may expose variables referenced by parameter '{1}' outside of their declaration scope.
/// Looks up a localized string similar to Do not directly call your base class Finalize method. It is called automatically from your destructor..
/// </summary>
...
...
@@ -3940,6 +3949,24 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to Cannot use a result of '{0}' in this context because it may expose variables referenced by parameter '{1}' outside of their declaration scope.
/// Looks up a localized string similar to Cannot use a member of result of '{0}' in this context because it may expose variables referenced by parameter '{1}' outside of their declaration scope.
/// Looks up a localized string similar to A '{0}' character may only be escaped by doubling '{0}{0}' in an interpolated string..
/// </summary>
...
...
@@ -3949,6 +3976,33 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to Cannot use local '{0}' in this context because it may expose referenced variables outside of their declaration scope.
/// Looks up a localized string similar to Expression cannot be used in this context because it may indirectly expose variables outside of their declaration scope.
/// Looks up a localized string similar to A result of a stackalloc expression of type '{0}' cannot be used in this context because it may be exposed outside of the containing method.
/// Looks up a localized string similar to Argument missing.
/// </summary>
...
...
@@ -8341,24 +8404,6 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to Cannot return by reference a result of '{0}' because the argument passed to parameter '{1}' cannot be returned by reference.
/// Looks up a localized string similar to Cannot return by reference a member of result of '{0}' because the argument passed to parameter '{1}' cannot be returned by reference.
/// Looks up a localized string similar to 'await' cannot be used in an expression containing a call to '{0}' because it returns by reference.
/// </summary>
...
...
@@ -8430,18 +8475,20 @@ internal class CSharpResources {
<value>Constraints for override and explicit interface implementation methods are inherited from the base method, so they cannot be specified directly</value>
</data>
...
...
@@ -2369,7 +2372,7 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep
<value>Method '{0}' has a parameter modifier 'this' which is not on the first parameter</value>
<value>Struct members cannot return 'this' or other instance members by reference</value>
</data>
<dataname="ERR_EscapeOther"xml:space="preserve">
<value>Expression cannot be used in this context because it may indirectly expose variables outside of their declaration scope</value>
</data>
<dataname="ERR_EscapeLocal"xml:space="preserve">
<value>Cannot use local '{0}' in this context because it may expose referenced variables outside of their declaration scope</value>
</data>
<dataname="ERR_EscapeCall"xml:space="preserve">
<value>Cannot use a result of '{0}' in this context because it may expose variables referenced by parameter '{1}' outside of their declaration scope</value>
</data>
<dataname="ERR_EscapeCall2"xml:space="preserve">
<value>Cannot use a member of result of '{0}' in this context because it may expose variables referenced by parameter '{1}' outside of their declaration scope</value>
<value>This combination of arguments to '{0}' is disallowed because it may expose variables referenced by parameter '{1}' outside of their declaration scope</value>
<value>A result of a stackalloc expression of type '{0}' cannot be used in this context because it may be exposed outside of the containing method</value>
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// (11,24): error CS8164: Cannot return by reference a result of 'Program.M(ref int)' because the argument passed to parameter 'x' cannot be returned by reference
// (11,24): error CS8521: Cannot use a result of 'Program.M(ref int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// (15,24): error CS8165: Cannot return by reference a member of result of 'Program.M1(out int)' because the argument passed to parameter 'x' cannot be returned by reference
// (15,24): error CS8522: Cannot use a member of result of 'Program.M1(out int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// (8,24): error CS8164: Cannot return by reference a result of 'Program.this[in int]' because the argument passed to parameter 'x' cannot be returned by reference
// (8,20): error CS8521: Cannot use a result of 'Program.this[in int]' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// (6,24): error CS8164: Cannot return by reference a result of 'Program.this[in int]' because the argument passed to parameter 'x' cannot be returned by reference
// (6,20): error CS8521: Cannot use a result of 'Program.this[in int]' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// (6,20): error CS8164: Cannot return by reference a result of 'Program.M(in int)' because the argument passed to parameter 'x' cannot be returned by reference
// (6,20): error CS8521: Cannot use a result of 'Program.M(in int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// (6,20): error CS8164: Cannot return by reference a result of 'Program.M(in int)' because the argument passed to parameter 'x' cannot be returned by reference
// (6,20): error CS8521: Cannot use a result of 'Program.M(in int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// (7,20): error CS8164: Cannot return by reference a result of 'Program.M(in int)' because the argument passed to parameter 'x' cannot be returned by reference
// (7,20): error CS8521: Cannot use a result of 'Program.M(in int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
// (14,20): error CS8164: Cannot return by reference a result of 'C.G(ref dynamic)' because the argument passed to parameter 'd' cannot be returned by reference
// (14,20): error CS8521: Cannot use a result of 'C.G(ref dynamic)' in this context because it may expose variables referenced by parameter 'd' outside of their declaration scope
// (36,24): error CS8164: Cannot return by reference a result of 'Test.Goo<char>(ref char)' because the argument passed to parameter 'arg' cannot be returned by reference
// (36,24): error CS8521: Cannot use a result of 'Test.Goo<char>(ref char)' in this context because it may expose variables referenced by parameter 'arg' outside of their declaration scope
// (41,24): error CS8164: Cannot return by reference a result of 'Test.Goo<char>(ref char)' because the argument passed to parameter 'arg' cannot be returned by reference
// (41,24): error CS8521: Cannot use a result of 'Test.Goo<char>(ref char)' in this context because it may expose variables referenced by parameter 'arg' outside of their declaration scope
// (46,24): error CS8165: Cannot return by reference a member of result of 'Test.Goo<Test.S1>(ref Test.S1)' because the argument passed to parameter 'arg' cannot be returned by reference
// (46,24): error CS8522: Cannot use a member of result of 'Test.Goo<Test.S1>(ref Test.S1)' in this context because it may expose variables referenced by parameter 'arg' outside of their declaration scope
// (8,20): error CS8910: Cannot return or assign a reference to the result of 'D.Invoke(ref int, ref int, object)' because the argument passed to parameter 'i' cannot be returned or assigned by reference
// (8,20): error CS8521: Cannot use a result of 'D.Invoke(ref int, ref int, object)' in this context because it may expose variables referenced by parameter 'i' outside of their declaration scope
// return ref d(ref i, ref j, o);
Diagnostic(ErrorCode.ERR_RefReturnCall,"d(ref i, ref j, o)").WithArguments("D.Invoke(ref int, ref int, object)","i").WithLocation(8,20));
Diagnostic(ErrorCode.ERR_EscapeCall,"d(ref i, ref j, o)").WithArguments("D.Invoke(ref int, ref int, object)","i").WithLocation(8,20)
// (7,20): error CS8910: Cannot return or assign a reference to the result of 'Program.M(ref int)' because the argument passed to parameter 'i' cannot be returned or assigned by reference
// (7,20): error CS8521: Cannot use a result of 'Program.M(ref int)' in this context because it may expose variables referenced by parameter 'i' outside of their declaration scope
//PROTOTYPE(span): make this bind-time diagnostic?
//PROTOTYPE(span): need a better error message for invalid span captures (should not say ref)
comp.VerifyDiagnostics(
// (13,26): error CS0701: 'Span<int>' is not a valid constraint. A type used as a constraint must be an interface, a non-sealed class or a type parameter.