Socket SelectTest.Poll_NotReady() fail in ILC mode due to metadata removed for performance reason
System.Net.Sockets tests run fine in F5 ('uap') mode. But in ILC ('uap-aot') mode they are failing. It seems that the metadata the test needs to look up has been removed:
[Theory]
[InlineData(SelectMode.SelectRead)]
[InlineData(SelectMode.SelectError)]
public void Poll_NotReady(SelectMode mode)
{
KeyValuePair<Socket, Socket> pair = CreateConnectedSockets();
try
{
Assert.False(pair.Key.Poll(SmallTimeoutMicroseconds, mode));
}
finally
{
pair.Key.Dispose();
pair.Value.Dispose();
}
}
We get failures like this:
System.Reflection.MissingMetadataException : This operation cannot be carried out because metadata for the following object was removed for performance reasons:\n\n System.Net.Sockets.SelectMode\n\nNo further information is available. Rebuild in debug mode for better information.\n\n
Is this an expected problem from the UWP test runner in ILC mode? Or we need to fix this?
cc: @davidsh
cc: @tarekgh @safern
CC @joperezr
I think this need to be fixed in the ILC toolchain
System.Net.Sockets is more appropriate area than System.Reflection.Metadata.
Two ways of fixing this:
- Have an rd.xml that makes sure that types/members are not optimized out (similar to what I did in PR dotnet/corefx#20995)
- See if @morganbr 's work and improvements in reflection will fix this on the ILCToolchain.
@joperezr please complete the rd.xml change and create a future bug for @morganbr. @morganbr 's work will come in later and we'll need this test running sooner.
If this is something about XUnit theories, the analysis changes won't affect it. Go ahead with rd.xml.
I will work on completing the rd.xml
Fixed with dotnet/corefx#21171