You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using System;classProgram{staticvoidMain(string[]args){objectvalue= args;// extract from hereIntPtrp;
unsafe
{objectt= value;p= IntPtr.Zero;}// to here
Console.WriteLine(p);}}
Open the C# console app in Dev14 and the Program.cs file.
Select lines 7 - 12 and execute the Extract Method command.
Expected
A new method that takes an object as a parameter and returns an IntPtr is created, and an invocation of that method replaces the selected lines that passes in "value" as the parameter and assigns the result to "IntPtr p".
Actual
A method is created that takes no parameters and returns void. Two compile errors are created by the refactoring as a result.
The text was updated successfully, but these errors were encountered:
Yes. this is a bug in the region analysis APIs. Assigning to @gafter
@gafter the core issue is here: We call AnalyzeDataFlow on the pair of statements IntPtr p; and unsafe { }. This fails immediately with a non-successful result. Debugging in a tiny bit, this is because the compiler doesn't get a boundnode for the unsafe { } block. Because there's no end bound node, nothing works.
From @AArnott:
Open the C# console app in Dev14 and the Program.cs file.
Select lines 7 - 12 and execute the Extract Method command.
Expected
A new method that takes an object as a parameter and returns an IntPtr is created, and an invocation of that method replaces the selected lines that passes in "value" as the parameter and assigns the result to "IntPtr p".
Actual
A method is created that takes no parameters and returns void. Two compile errors are created by the refactoring as a result.
The text was updated successfully, but these errors were encountered: