Unknown type error in RemObject C#

Hi,

we deserialized an object and cast it into dynamic type .when tried to get specific (“item.project_id”) property from this object using RemObject c# it gives Error ("Unknown type object ") here is the code

var data = JsonConvert.DeserializeObject(response.Content).tasks;
foreach (var item in data)
{
if (!Projects.Any(x => x.Id == (int)item.project_id))
{
Projects.Add(new Projects()
{
Id = item.project_id,
Title = item.projectName,
});
}
}

Secondly, the namespace System.Windows.Automation is giving Unknown type error.

Can you kindly tell us the RemObject C# supported Types for the above issues.

Hi.

any chance i could get a complete test case for this? What platform is this on? on .NET, this should work in RemObjects C# the same as it does in Visual C#, as it’s using the same libraries under the hood… But it’s hard to say, without more context.

Here is the sample code

string GetUrl(string ProcessName)
{
string url = string.Empty;
try
{
System.Diagnostics.Process[] procsChrome = System.Diagnostics.Process.GetProcessesByName(ProcessName);
foreach (var pro in procsChrome)
{
if (pro.MainWindowHandle == IntPtr.Zero)
{
continue;
}
AutomationElement elm = AutomationElement.FromHandle(pro.MainWindowHandle);
AutomationElement elmUrlBar = elm.FindFirst(TreeScope.Descendants,
new PropertyCondition(AutomationElement.NameProperty, “Address and search bar”));
if (elmUrlBar != null)
{
AutomationPattern[] patterns = elmUrlBar.GetSupportedPatterns();
if (patterns.Length > 0)
{
ValuePattern val = (ValuePattern)elmUrlBar.GetCurrentPattern(patterns[0]);
url = val.Current.Value;
}
}
}
}
catch (Exception ex)
{
log.Error(ex);
}
return url;
}
it gives error unknow type on “AutomationElement”

According to Docs (AutomationElement Class (System.Windows.Automation) | Microsoft Docs), , this type isn defined in UIAutomationClient.dll, so you will need to add a reference to that, and add using System.Windows.Automation;.

for TreeScope and AutomationPattern you’ll also need to add UIAutomationTypes.dll.

See attached project for reference.

ConsoleApplication66 1.bugreport.zip (72.5 KB)

hth,
marc