Hi,
I found an annoying problem while creating/editing methods in Studio (4.0.4 but I saw it also in previous versions), when the studio sometimes (re)create empty methods.
Steps to reproduce:
Load the attached solution
It should open with active FillNotepad.UserCode.cs tab. Sometimes, there is immediatelly created an empty method TestMethod_1 in that UserCode file. If you don't get this result right after loading the project for the first time, try to rebuild the whole solution. Now the empty method should definitely appear and there should be issued a warning (as shown in the above attached picture). If not, try to close the solution and repeat the steps again.
Now about the background of this issue.
While editing recording FillNotepad, I added a new "User Code" action TestMethod_1. By default, it created an empty method declaration in Recording.UserCode.cs file. This creation of empty method is expected. So far so good. I added one line of code and then I moved whole method to common.cs file. Then I made the common.cs inherited by FillNotepad.UserCode.cs. I checked the FillNotepad recording table and it seems it correctly inherited the TestMethod_1. I then saved and closed the solution. Since then, the empty method is sometimes re-created right after loading the solution, sometimes during the solution build. And this is unfortunately neither expected or wanted behavior
Hope this helps?
Ranorex studio (re)creates empty methods
Ranorex studio (re)creates empty methods
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 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
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Ranorex studio (re)creates empty methods
Hello,
Unfortunately, I couldn't reproduce your issue followed your steps.
Could you please describe how you moved your method from FillNotepad.UserCode.cs to common.cs?
Did you use cut & paste?
Regards,
Markus (T)
Unfortunately, I couldn't reproduce your issue followed your steps.
Could you please describe how you moved your method from FillNotepad.UserCode.cs to common.cs?
Did you use cut & paste?
Regards,
Markus (T)
Re: Ranorex studio (re)creates empty methods
Hi Markus,
Thanks for the reply. That's weird. I can repeat it quite steadily. And yes, I moved the method by using Cut&Paste.
I just manually created a new method in FillNotepad.UserCode.cs, added a new User Code action to the FillNotepad recording and then I moved the newly created method from FillNotepad.UserCode.cs to common.cs. I then saved the solution, closed/reload it and then rebuild it. After that, there were created two empty methods TestMethod_1() and TestMethod_2(). I reproduced it also on another machine and also with other projects.
Thanks for the reply. That's weird. I can repeat it quite steadily. And yes, I moved the method by using Cut&Paste.
I just manually created a new method in FillNotepad.UserCode.cs, added a new User Code action to the FillNotepad recording and then I moved the newly created method from FillNotepad.UserCode.cs to common.cs. I then saved the solution, closed/reload it and then rebuild it. After that, there were created two empty methods TestMethod_1() and TestMethod_2(). I reproduced it also on another machine and also with other projects.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Ranorex studio (re)creates empty methods
If you still have a reference in your rxrec file to the method that you moved, Ranorex will create an empty method with the same signature if it cannot find the referenced method in your UserCode file.
This appears to be by design in order to keep the system from reporting NullReferenceExceptions at runtime. In other-words, this is there to keep you from removing methods that you still have references to, which is a bad thing.
If you don't want an empty method to be created, you need to remove the "UserCode" line from your rxrec file, or change the method reference to a method that is actually in your .UserCode.cs file for that module.
You cannot reference a method in any other file from within this module's rxrec file. All references in the current module's rxrec must be in this module's .cs or .UserCode.cs files.
edit to add:
If you need to reference external methods, you will need to do so inside a UserCode method in this module.
This appears to be by design in order to keep the system from reporting NullReferenceExceptions at runtime. In other-words, this is there to keep you from removing methods that you still have references to, which is a bad thing.
If you don't want an empty method to be created, you need to remove the "UserCode" line from your rxrec file, or change the method reference to a method that is actually in your .UserCode.cs file for that module.
You cannot reference a method in any other file from within this module's rxrec file. All references in the current module's rxrec must be in this module's .cs or .UserCode.cs files.
edit to add:
If you need to reference external methods, you will need to do so inside a UserCode method in this module.
Shortcuts usually aren't...
Re: Ranorex studio (re)creates empty methods
Hi krstcs,
Thanks for your suggestions.
I completely removed the user code action from the recording and also all previously generated empty methods from UserCode.cs. I even searched the source files at binary level, just to see if there is not a forgotten reference of the TestMethod_2. But it seems Common.cs is the only place where this method exists.
I reloaded the solution, created new User Code action and selected one of the offered methods. All of them are now available only in common.cs! I then saved and rebuild the solution. No empty method has been created...so far so good.
Finally, I again reloaded the solution and simply rebuild it one more time. And sure enough, this time, the empty method has been created. Reloading solution seems to be a crucial step in reproducibility of this issue.
PS: I forgot to mention it before, but UserCode.cs inherits common.cs methods! So I don't think there is a need for Ranorex Studio to recreate empty methods in UserCode.cs?
Thanks for your suggestions.
I completely removed the user code action from the recording and also all previously generated empty methods from UserCode.cs. I even searched the source files at binary level, just to see if there is not a forgotten reference of the TestMethod_2. But it seems Common.cs is the only place where this method exists.
I reloaded the solution, created new User Code action and selected one of the offered methods. All of them are now available only in common.cs! I then saved and rebuild the solution. No empty method has been created...so far so good.
Finally, I again reloaded the solution and simply rebuild it one more time. And sure enough, this time, the empty method has been created. Reloading solution seems to be a crucial step in reproducibility of this issue.
PS: I forgot to mention it before, but UserCode.cs inherits common.cs methods! So I don't think there is a need for Ranorex Studio to recreate empty methods in UserCode.cs?
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Ranorex studio (re)creates empty methods
Hello krstcs,
Finally, I could reproduce this behavior although it didn't happen every time.
I will add this issue to our internal bug-tracking system.
In the meantime, please try to re-select your method in the Recording action table.
Regards,
Markus (T)
Finally, I could reproduce this behavior although it didn't happen every time.
I will add this issue to our internal bug-tracking system.
In the meantime, please try to re-select your method in the Recording action table.
Regards,
Markus (T)
Re: Ranorex studio (re)creates empty methods
Unfortunately, re-selecting does not help. I even tried to create completely new User Code action using already moved methods from common.cs. The problem with empty methods reappears after some time.
I think it has something to do with inheriting common.cs in .UserCode.cs. But without inheriting, the common.cs methods are not available for given recording. Catch 22 I hope it's something easy to fix. Feel free to contact me in case you need more details.
I think it has something to do with inheriting common.cs in .UserCode.cs. But without inheriting, the common.cs methods are not available for given recording. Catch 22 I hope it's something easy to fix. Feel free to contact me in case you need more details.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Ranorex studio (re)creates empty methods
Hello,
Thank you for your information.
It seems that inheriting causes this issue.
Our development team will analyze it.
Regards,
Markus (T)
Thank you for your information.
It seems that inheriting causes this issue.
Our development team will analyze it.
Regards,
Markus (T)
Re: Ranorex studio (re)creates empty methods
Hi Markus,
Should this problem be fixed in 4.0.5? I found this bug fix in 4.0.5 description...
Fixed detection of user code methods inherited from a grandparent base class
Unfortunately, the problem seems to be still there. At least I can still reproduce it.
Should this problem be fixed in 4.0.5? I found this bug fix in 4.0.5 description...
Fixed detection of user code methods inherited from a grandparent base class
Unfortunately, the problem seems to be still there. At least I can still reproduce it.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Ranorex studio (re)creates empty methods
Hello,
Unfortunately, this issue has not been fixed in 4.0.5.
We will provide a fix in our next minor release version (4.1.0).
Regards,
Markus (T)
Unfortunately, this issue has not been fixed in 4.0.5.
We will provide a fix in our next minor release version (4.1.0).
Regards,
Markus (T)
Re: Ranorex studio (re)creates empty methods
Hi Markus,
No problem! I just thought the issue is fixed after reading 4.0.5 changes It's not a critical issue anyway.
No problem! I just thought the issue is fixed after reading 4.0.5 changes It's not a critical issue anyway.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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