Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenRiaServices.Silverlight 4.4.0.0 - compilation errors in generated code #60

Closed
Daniel-Svensson opened this issue Jan 2, 2018 · 20 comments

Comments

@Daniel-Svensson
Copy link
Member

Daniel-Svensson commented Jan 2, 2018

I just upgraded OpenRiaServices.Silverlight to version 4.4.0.0 and I'm now getting a number of compilation errors in the generated code:

ERROR #1: The type or namespace name 'Task' could not be found in the global namespace (are you missing an assembly reference?)
ERROR #2: The type or namespace name 'CancellationToken' could not be found (are you missing a using directive or an assembly reference?)

Generated code:
///


/// Asynchronously invokes the 'AddImageVersionVersion' method of the DomainService.
///

/// The value for the 'imageVersionId' parameter of this action.
/// The value for the 'versionId' parameter of this action.
/// The value for the 'changeDescription' parameter of this action.
/// A cancellation token that can be used to cancel the work
/// An operation instance that can be used to manage the asynchronous request.
public global::Task<global::OpenRiaServices.DomainServices.Client.InvokeResultglobal::CommBank.ACDC.Model.DTOs.ImageVersionUpdateTimeStamp> AddImageVersionVersionAsync(int imageVersionId, int versionId, string changeDescription, global::System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
global::System.Collections.Generic.Dictionary<string, object> parameters = new global::System.Collections.Generic.Dictionary<string, object>();
parameters.Add("imageVersionId", imageVersionId);
parameters.Add("versionId", versionId);
parameters.Add("changeDescription", changeDescription);
this.ValidateMethod("AddImageVersionVersion", parameters);
return this.InvokeOperationAsyncglobal::CommBank.ACDC.Model.DTOs.ImageVersionUpdateTimeStamp("AddImageVersionVersion", parameters, true, cancellationToken);
}

ERROR #3: The type or namespace name 'HasSideEffectsAttribute' could not be found in the global namespace (are you missing an assembly reference?)
ERROR #4: The type or namespace name 'HasSideEffects' could not be found in the global namespace (are you missing an assembly reference?)

Generated code:
[global::HasSideEffects(true)]
[global::System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/ACDCDomainService/AddImageVersionVersion", ReplyAction="http://tempuri.org/ACDCDomainService/AddImageVersionVersionResponse")]
global::System.IAsyncResult BeginAddImageVersionVersion(int imageVersionId, int versionId, string changeDescription, global::System.AsyncCallback callback, object asyncState);

The generated code doesn't have any using statements in it.
I'm using Visual Studio 2013 Update 3
The server-side OpenRiaServices library is a .NET Framework 4 class library (referenced by an ASP.NET project).
The client-side OpenRiaServices library is a Silverlight 5 class library (referenced by a Silverlight Application project).
Microsoft® Silverlight® 5 SDK is installed
Version 4.3.0.0 of OpenRiaServices was working fine
Build Output is attached

Attachments

Build Output.txt

This work item was migrated from CodePlex

CodePlex work item ID: '60'
Vote count: '2'

@Daniel-Svensson
Copy link
Member Author

[ColinBlair@2014-12-16]
I haven't been able to reproduce this, but I did just notice that at the beginning of the build output there are references to the 4.3.0.0 version of the NuGet packages. There may be something going wrong with having a mix of the different versions.

@Daniel-Svensson
Copy link
Member Author

[danneesset@2015-01-03]
0: If you solved the problem with colin's help then please let us know, otherwise see if these instructions can help you.

1: Try to first close visual studio and then delete all your "Generated_Code", "bin" and "obj" folders and try again, in some rare instances you can end up with old assemblies beeing used by the code generator.

2: If that does not solve your problems:
ake sure that none of the assemblies referenced by your application uses open ria services 4.3.0.0 (you can use telerik's justDecompile to check references). (Colins suggestion)

3:

  • Which code generator does you use, the "default", the T4 code gen or one derived from the T4 codegen?
    ** Please also try switching the code generator (by adding or removing the OpenRiaServices.T4 package from your server projects) and let us know if that makes a difference.
  • How many services does your solution use?

@Daniel-Svensson
Copy link
Member Author

[cashe@2015-01-05]

0: If you solved the problem with colin's help then please let us know, otherwise see if these instructions can help you.

Upgrading all packages to 4.4.0.0 didn't help.

1: Try to first close visual studio and then delete all your "Generated_Code", "bin" and "obj" folders and try again, in some rare instances you can end up with old assemblies beeing used by the code generator.

This didn't help.

2: If that does not solve your problems:
ake sure that none of the assemblies referenced by your application uses open ria services 4.3.0.0 (you can use telerik's justDecompile to check references). (Colins suggestion)

I verified that everything was on 4.4.0.0

Which code generator does you use, the "default", the T4 code gen or one derived from the T4 codegen?
** Please also try switching the code generator (by adding or removing the OpenRiaServices.T4 package from your server projects) and let us know if that makes a difference.

I use the "default" code generator. I added the OpenRiaServices.T4 package to the server projects, cleaned the solution and generated files etc, restarted visual studio, regenerated the client code and got the same errors.

How many services does your solution use?

3

I'm getting a new warning which may be relevant:

Warning 1 The following exception occurred creating the MEF composition container:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
The default code generator will be used. ACDC.RIAServicesLibrary

I'm not sure how to retrieve the LoaderExceptions property to provide you with more information.

This warning might be related to the fact that I recently introduced dependency injection (Autofac) to the domain services; they no longer have parameterless constructors. This warning exists when I'm on 4.3.0.0 but the solution builds fine.

@Daniel-Svensson
Copy link
Member Author

[ColinBlair@2015-01-05]
The MEF error has always happened, it is left over from WCF RIA Services and I haven't changed it. It just means that you haven't provided a custom code generator so the default one is being used.

I have a second user who is getting the same error but I haven't been able to reproduce the problem. If you can create a solution that demonstrates the problem I would love to get a copy of it and see if I can reproduce the problem.

@Daniel-Svensson
Copy link
Member Author

[matbel@2015-01-20]
I also tried everything but no luck. This part I don't understand:

2: If that does not solve your problems: Make sure that none of the assemblies referenced by your application uses open ria services 4.3.0.0 (you can use telerik's justDecompile to check references). (Colins suggestion)

With a decompiler, this is the only info I see:

OpenRiaServices.DomainServices.Client, Version=2.0.5.0, Culture=neutral, PublicKeyToken=null

Or

[assembly: AssemblyCompany("Outercurve Foundation")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCopyright("© Outercurve Foundation.  All rights reserved.")]
[assembly: AssemblyDescription("OpenRiaServices.DomainServices.Client.dll")]
[assembly: AssemblyProduct("Open RIA Services")]
[assembly: AssemblyTitle("OpenRiaServices.DomainServices.Client")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("2.0.5.0")]
[assembly: CLSCompliant(true)]
[assembly: CompilationRelaxations(8)]
[assembly: ComVisible(false)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: Guid("b15b8171-0edc-4d96-a126-e086e4f3ea2c")]
[assembly: InternalsVisibleTo("OpenRiaServices.Controls.DomainServices.Test")]
[assembly: InternalsVisibleTo("OpenRiaServices.DomainServices.Client.Test")]
[assembly: InternalsVisibleTo("OpenRiaServices.DomainServices.Client.Test.Vb")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows=true)]
[assembly: TargetFramework("Silverlight,Version=v5.0", FrameworkDisplayName="Silverlight 4")]

So I can't tell if it's 4.3 or 4.4
I do have other projects that did work after the update, but they are smaller.

@Daniel-Svensson
Copy link
Member Author

[ColinBlair@2015-01-20]
The assembly version never changes, it is always 2.0.5.0. This is left over from how Microsoft versions their assemblies,

First off, you are always welcome to send me your solution through email. If the zip file is too large a link to a OneDrive file / DropBox, etc would work for me as well. My email is easy, mail at then my first and last name followed by .com

Second, here is the cleanup instructions I have used in the past:

  1. Clean the solution
  2. Close the solution and open your source directory in explorer.
  3. Open the Packages folder and remove all packages.
  4. Do a search in explorer for all files ending in .dll
  5. Delete all of the found files
  6. Reopen the solution
  7. Open the NuGet window so that it can do a restore of the missing packages
  8. Look in the packages directory to see if any packages restored that shouldn't be there. For example, a 4.3.0.0 version of Open RIA Services.

@Daniel-Svensson
Copy link
Member Author

[matbel@2015-01-21]
Yeah that's exactly what I did. No leftovers from 4.3 found anywhere.
Unfortunately I can't send you my solution. I would be violating some contracts.
I'll try to replicate it somehow.

@Daniel-Svensson
Copy link
Member Author

[matbel@2015-01-21]
This might help:

  1. I update all packages to the latest version except the OpenRiaServices.Silverlight.CodeGen package.
  2. I go through all silverlightclients except 1 and update OpenRiaServices.Silverlight.CodeGen package.
    -Up until this point I can build fine.
  3. I go to the last silverlightclient and update the OpenRiaServices.Silverlight.CodeGen package.
    Visual studio asks me to restart so the OpenRiaServices.Silverlight.CodeGen 4.3 package can be removed.
    After this I can no longer build.

@Daniel-Svensson
Copy link
Member Author

[marcelot@2015-02-12]
We have exactly the same problem, no suggested solution was efficient. Anything new?

@Daniel-Svensson
Copy link
Member Author

[ColinBlair@2015-02-12]
I haven't been able to either reproduce the problem or have someone send me an example solution demonstrating the problem.

@Daniel-Svensson
Copy link
Member Author

[danneesset@2015-02-15]
Is this still a problem with the latest 4.4.0.1/2 releases of the code generation?

If so please have a look at the following page with details of how to debugg the code generation projects and let us know if it helped you:
[Debugging Open Ria Code generation source]{https://openriaservices.codeplex.com/wikipage?title=Debugging%20Open%20Ria%20Code%20generation%20source}

@Daniel-Svensson
Copy link
Member Author

[matbel@2015-02-16]
The problem is still there. While looking for the problem I took a working solution and did some configuration to make it look more like my broken solution. It got the same problem when I set the client to use full typenames.
true

@Daniel-Svensson
Copy link
Member Author

[danneesset@2015-02-19]
@matbel, @marcelot, @cashe can you verify if your solution can build if you remove "OpenRiaClientUseFullTypeNames" from your solution?

I will look into making sure that the code generation works when OpenRiaClientUseFullTypeNames is set to true and will hopefully have a solution within the next week, but I would appreciate if anybody could check if the problems dissapear if you set it to false.

@Daniel-Svensson
Copy link
Member Author

[matbel@2015-02-19]
This would make these problems disappear yes. I also looked at the last commit from Colin and added the namespaces for CancellationToken and Task in InvokeOperationProxyGenerator.cs. After this I was able to build with "OpenRiaClientUseFullTypeNames" set to true.

@Daniel-Svensson
Copy link
Member Author

[danneesset@2015-02-22]
Fixed in changeset eeba2b6

@Daniel-Svensson
Copy link
Member Author

[danneesset@2015-02-22]
This should be fixed now, but I am waiting a bit with a new nuget package release since I want to investigate if I can fix Workitem 62 (mixing signed / unsigned) in the coming week.

Please feel free to fetch the latest version and compile OpenRiaServices.DomainServices.Tools yourself and replace the verion in "packages\OpenRiaServices.Client.CodeGen.4.4.0.*\build" if you want to try it

@Daniel-Svensson
Copy link
Member Author

[ColinBlair@2015-02-23]
When the new NuGet package is ready I will also be releasing a new version of the Tooling with the OpenRiaClientUseFullTypeNames added as a checkbox in the UI. That way in the future it will not be a hidden setting that we forget about.

@Daniel-Svensson
Copy link
Member Author

[danneesset@2015-03-01]
I made the changes for WorkItem 62 and have also attached a build of the new codegen to that issue (https://openriaservices.codeplex.com/workitem/62).

The code gen works for me, but I would appreciate if anybody else would like to test it before it is published. The nupkg is just a zip file so you should be able to open it and replace the contents of your build directory with the new version.

Don't worry about it not being the Silverlight package, the next Silverlight package (4.4.0.3) will depend on the OpenRiaServices.Client.CodeGen where the actual implementation will be so that we only have to maintain one version of the code generation.

@Daniel-Svensson
Copy link
Member Author

[matbel@2015-03-02]
I took the tools dll out of your attached file and pasted it in: \packages\OpenRiaServices.Silverlight.CodeGen.4.4.0.1\build
After this everything was still building.
Great job guys! Thanks.

@Daniel-Svensson
Copy link
Member Author

Issue closed by danneesset with comment
Nuget package realeased

Reason closed
Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant