nameof() expression

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
andrii.savka
Posts: 21
Joined: Mon Mar 30, 2020 2:10 pm

nameof() expression

Post by andrii.savka » Tue Jun 23, 2020 7:52 pm

Hello,

I updated all my projects to use C# 7.0 and .NET Framework 4.7.2.
But I couldn't use nameof() expression.

Any idea why is it?

P.S. Ranorex 9.3.2

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: nameof() expression

Post by odklizec » Wed Jun 24, 2020 7:36 am

Hi

It is not possible to compile the solution or what? I believe that NameOf is C# 6 related? Actual Ranorex version should be able to compile C# code up to version 7, so there should not be a problem with compiling this expression. Could you please post a small sample solution, featuring problematic code?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

andrii.savka
Posts: 21
Joined: Mon Mar 30, 2020 2:10 pm

Re: nameof() expression

Post by andrii.savka » Wed Jun 24, 2020 12:09 pm

Hello odklizec,

Yep, I could not compile. You can see it on screenshots.
2020-06-24_14-03-03.png
2020-06-24_14-02-53.png
As you can see, all my projects are updated to the last support version.
But I could not use C# 7.0 features.
2020-06-24_14-04-11.png
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: nameof() expression

Post by odklizec » Wed Jun 24, 2020 1:14 pm

Hi,

I just tried to convert C#5 to C#7, added nameof and it compiles OK? So I guess something's missing on your computer? Have you tried to install 4.7.2 SDK and targeting pack?
2020-06-24_14-13-58.png
You do not have the required permissions to view the files attached to this post.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

andrii.savka
Posts: 21
Joined: Mon Mar 30, 2020 2:10 pm

Re: nameof() expression

Post by andrii.savka » Wed Jun 24, 2020 1:21 pm

Hello,
I have already made this. I had converted all projects, and after that, I stuck with this problem.
Also, I have installed sdk.
2020-06-24_15-19-09.png
2020-06-24_15-16-36.png
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: nameof() expression

Post by odklizec » Wed Jun 24, 2020 1:25 pm

Hi,

Well, there seems to be missing 4.7.2 targeting pack in your system? This is what I have installed:
2020-06-24_14-23-36.png
You do not have the required permissions to view the files attached to this post.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

andrii.savka
Posts: 21
Joined: Mon Mar 30, 2020 2:10 pm

Re: nameof() expression

Post by andrii.savka » Thu Jun 25, 2020 2:34 pm

Could not solve the problem with targeting packs.
Fixed problem by downgrading to .net framework 4.6.2
thank you!