Pasted UserCode does not generate "using" statements

Bug reports.
codemaster2b
Posts: 2
Joined: Thu Dec 15, 2016 3:34 pm

Pasted UserCode does not generate "using" statements

Post by codemaster2b » Fri Dec 16, 2016 8:12 pm

Scenario:
0) C#
1) UserCode exists in a recording module that calls

Code: Select all

File.Exists("file.txt");
.
2) UserCode is called in the recording module
3) UserCode line from the recording module is copy-pasted into a new recording module.

Expected:
New recording module has a copy of the previous UserCode in its .UserCode.cs file.

Code: Select all

using System.IO;
included at the top of new .UserCode.cs file

Actual:
New recording module has a copy of the previous UserCode in its .UserCode.cs file.

Code: Select all

using System.IO;
NOT included at the top of new .UserCode.cs file
Does not compile.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Pasted UserCode does not generate "using" statements

Post by krstcs » Mon Dec 19, 2016 3:36 pm

If you want a using directive in your usercode file, you need to put it in yourself. Ranorex does not automatically generate using directives (or any other code) when you copy code from one file to another. The only time that it generates any code is for code files that are made from the standard file template, or when adding actions to the action table.

This is not a bug.
Shortcuts usually aren't...

codemaster2b
Posts: 2
Joined: Thu Dec 15, 2016 3:34 pm

Re: Pasted UserCode does not generate "using" statements

Post by codemaster2b » Mon Dec 19, 2016 7:12 pm

Respectfully, krstcs, it sounds like you're an engineer. I'm an engineer too. From your perspective it is not a bug, because it is working as intended. Let's split the difference and call it a feature request?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Pasted UserCode does not generate "using" statements

Post by krstcs » Mon Dec 19, 2016 9:40 pm

No offense intended, I don't know your user level any more than you know mine. :D

You posted in the Bug Reports forum as if you believed it to be a bug, so I was addressing it as such, pointing out that it does, indeed, work as expected from the Ranorex team's point of view, meaning it is not a bug.


Feature requests are only handled through Ranorex's new User Voice site.

http://uservoice.ranorex.com/forums/150 ... ve-ranorex
Shortcuts usually aren't...