AnantLabs / codesmith

Automatically exported from code.google.com/p/codesmith
1 stars 0 forks source link

xxxxList.Genearted templates generates AddNewCode incorrectly #667

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Generate EditableRootList, EditableChildList or any List 

What is the expected output? What do you see instead?
#If !Silverlight or !NETFX_CORE
   protected override classname AddNewCore()
...
#else
   protected async Task<DMSMenuLanguageName> AddNewCoreAsync()
...
#endif

and no other AddNewCodeAsync after the if

What version of the product are you using?
CodeSmith 6.5 with CSLA 4.5 templates

Please provide any additional information below.
The code around AddNewCore() is a bit werid , when you have the 
IncludeSilverlightSupport it generates it twice , once for the #If !Silverlight 
area, and another in the #else part of the code, the Else part is the problem, 
it uses await without aving the async in the method signature.Now it seems to 
be the exact same as the AddNewCoreAsync genarated just after.

Original issue reported on code.google.com by jteneg...@gmail.com on 20 Oct 2012 at 3:23

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 23 Oct 2012 at 12:56

GoogleCodeExporter commented 9 years ago
Can you please let me know if you can reproduce this in the latest nightly 
build http://community.codesmithtools.com/nightly/csla/.

Original comment by bniemyjski on 25 Oct 2012 at 5:17

GoogleCodeExporter commented 9 years ago
yes the problem is still there , here is the code generated in the 
xxxListGenerated.cs

The problem is in the #Else of the #if !NETFX_CORE of ListGenerated.cs, 
you see that it generates a 
 protected override void AddNewCore()

and the method returns an object

second problem is in object.generated.cs, you have a #If !NETFX_CORE, and i'm 
not sure why, first there is a need for an else or if the method is the same in 
the else, then just don't put an if 

hope this clarifies

Original comment by jteneg...@gmail.com on 25 Oct 2012 at 1:59

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks, I'll take a look into this.

Original comment by bniemyjski on 25 Oct 2012 at 4:56

GoogleCodeExporter commented 9 years ago
any progress?

Original comment by jteneg...@gmail.com on 8 Nov 2012 at 9:47

GoogleCodeExporter commented 9 years ago
Hello,

I haven't had time, we were away last week at Microsoft Build conference and 
I've been catching up ever since :\. I'll take a look into this tonight / 
tomorrow morning.

Original comment by bniemyjski on 9 Nov 2012 at 12:05

GoogleCodeExporter commented 9 years ago
I did make some progress on this over the weekend and I hope to commit a fix 
soon.

Original comment by bniemyjski on 12 Nov 2012 at 1:11

GoogleCodeExporter commented 9 years ago
This issue was updated by revision r2902.

Updates for Silverlight.

Original comment by bniemyjski on 12 Nov 2012 at 10:56

GoogleCodeExporter commented 9 years ago
Hello,

I just committed a fix for AddNewCore so that it waits for the task to complete 
on the methods that are not marked as Async.

Upon looking into your comments about the #If !Silverlight or !NETFX_CORE... 
The current behavior is correct to the best of my knowledge as you only place 
these directives on the project that is being compiled specifically for 
Silverlight or WinRT. So you will only have one or the other. IF you have one 
or both of the directives specified in your Silverlight/WinRT projects then it 
will work as expected. I've tested this in the WinRT and Silverlight Sample 
applications available under SVN.

The !NETFX_CORE is commented out for the partial methods because it contains 
code that does not compile under WinRT (SafeDataReader).

I'm not sure if both AddNewCore and AddNewCoreAsync are needed at the same 
time. But for now I'm leaving them in there until I have time to research / 
feedback is given.

If I'm overlooking something or not following something, my apologies. If you 
could attach a small sample that can reproduce an issue that would be the best 
as I would have something to go off of, other than my samples.

Original comment by bniemyjski on 12 Nov 2012 at 11:01

GoogleCodeExporter commented 9 years ago
Here is what I meant

When generating EditableRootList, Codesmith generates both the NETFX_CORE and 
the .NET AddNewCode functions as in the included file 
GeneratedEditableRootList

But it should generate ModifiedEditableRootList to work

Look at the protected async override void AddNewCore()
function

Let me know if it is not clear

Original comment by jteneg...@gmail.com on 3 Dec 2012 at 6:35

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was updated by revision r2929.

Issue 667:  xxxxList.Genearted templates generates AddNewCode incorrectly

Original comment by bniemyjski on 12 Dec 2012 at 9:42

GoogleCodeExporter commented 9 years ago
Please let me know if the latest nightly build resolves this issue.

Original comment by bniemyjski on 12 Dec 2012 at 9:43