Page 1 of 1

Pasted UserCode does not generate "using" statements

Posted: Fri Dec 16, 2016 8:12 pm
by codemaster2b
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.

Re: Pasted UserCode does not generate "using" statements

Posted: Mon Dec 19, 2016 3:36 pm
by krstcs
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.

Re: Pasted UserCode does not generate "using" statements

Posted: Mon Dec 19, 2016 7:12 pm
by codemaster2b
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?

Re: Pasted UserCode does not generate "using" statements

Posted: Mon Dec 19, 2016 9:40 pm
by krstcs
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