Book a Demo

Author Topic: Spaces after interface names in C# generated  (Read 4606 times)

nemethmik

  • EA User
  • **
  • Posts: 21
  • Karma: +1/-0
    • View Profile
Spaces after interface names in C# generated
« on: August 11, 2012, 03:49:50 pm »
When I generate (F11) source code for C# interfaces, the generated code will insert an additional space after the interface name .
For example, when I first generated the interface, there was only one space after the name.
public interface IMScreenServices {
When I generate next time, there are two spaces
public interface IMScreenServices  {
and more and more:
public interface IMScreenServices   {
This makes no harm for the compiler, but, I use sorce code version control system (GIT) extensively, and it is terribly annoying that dozens of "modified" files are shown by GIT because of these extra spaces even when I have not changed anything in the model. I am using 9.3.934.
This occures for all my interfacees but never with classes.
Thank You and All the Best,
Miklos
« Last Edit: August 11, 2012, 04:27:16 pm by nemethmik »

nemethmik

  • EA User
  • **
  • Posts: 21
  • Karma: +1/-0
    • View Profile
Re: Spaces after interface/class names in C# gener
« Reply #1 on: August 11, 2012, 03:57:23 pm »
This happens all the time with all my interfaces.

namespace AppLogicBaseInterfaces {
      public interface IMScreenServices {
      }//end IMScreenServices
}//end namespace MFramework

namespace AppLogicBaseInterfaces {
      public interface IMScreenEvents     {
            void OnScreenLoaded();
            void OnBack();
      }//end IMScreenEvents
}//end namespace MFramework

but not with this class
namespace BLServicesBaseInterfaces {
      public class BLServerConfiguration {
    public string ContextPassword { get; set; }
    public string ContextUser { get; set; }
    public string ServerURL { get; set; }
    public string ServiceContext { get; set; }
      }//end BLServerConfiguration
}//end namespace MFramework

Thank You,
Miklos
« Last Edit: August 11, 2012, 04:28:27 pm by nemethmik »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Spaces after interface names in C# generated
« Reply #2 on: August 13, 2012, 08:34:14 am »
It's an error in the C# Class Declaration template.

Look for
Code: [Select]
%if elemType == "Interface"%
%classTag:"unsafe"=="true" ? "unsafe" : ""%
%CONVERT_SCOPE(classScope)%
%classTag:"new"=="true" ? "new" : ""%
%classTag:"partial"=="true" ? "partial"%
%PI=""%
interface %className%$generic$bases
 $genericConstraints
%endTemplate%

Replace it with
Code: [Select]
%if elemType == "Interface"%
%classTag:"unsafe"=="true" ? "unsafe" : ""%
%CONVERT_SCOPE(classScope)%
%classTag:"new"=="true" ? "new" : ""%
%classTag:"partial"=="true" ? "partial"%
%PI=" "%
interface %className%$generic$bases
$genericConstraints
%endTemplate%

(PI = a space instead of having an explicit space before $genericConstraints)

nemethmik

  • EA User
  • **
  • Posts: 21
  • Karma: +1/-0
    • View Profile
Re: Spaces after interface names in C# generated
« Reply #3 on: August 13, 2012, 07:47:20 pm »
Quote
It's an error in the C# Class Declaration template.
Replace it with
Code: [Select]
%if elemType == "Interface"%
%classTag:"unsafe"=="true" ? "unsafe" : ""%
%CONVERT_SCOPE(classScope)%
%classTag:"new"=="true" ? "new" : ""%
%classTag:"partial"=="true" ? "partial"%
%PI=" "%
interface %className%$generic$bases
$genericConstraints
%endTemplate%
Thank You for the help! The space before the $genericConstraints on line 26 caused the problem. Thank You again and All the Best,
Miklos

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Spaces after interface names in C# generated
« Reply #4 on: August 14, 2012, 08:46:44 am »
Exactly, and by moving the space into the PI (processing instruction) directive EA will still insert one if $genericConstraints is non-empty.