You have probably missed to add the following using statement:
using System.Reflection;
I tried to run the following console application (I don't think that you will notice any difference in a asp.net core project):
using System;
using System.Reflection;
namespace ConsoleApp1
{
public class Message
{
public string CustomerName { get; set; }
public DateTime Date { get; set; }
public string RegistrationCode { get; set; }
}
public class Program
{
public static void Main(string[] args)
{
var obj = new Message();
var properties = obj.GetType().GetProperties();
Console.ReadKey();
}
}
}
and I din't notice any issue. Below is the project.json for reference:
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}
Are you sure that you use the latest .net core version?