Search

Exception thrown by the target of an invocation in Microsoft.RIA.Client.targets by W.Meints

Closed
as Not Reproducible Help for as Not Reproducible

3
0
Sign in
to vote
Type: Bug
ID: 662780
Opened: 4/18/2011 3:06:13 AM
Access Restriction: Public
1
Workaround(s)
2
User(s) can reproduce this bug
I'm trying to build a RIA services project that uses System.ComponentModel.DataAnnotations attributes for validation and display name. The attributes are configured to use resx based strings for the error messages etc.

When I build the solution I get the following exception:

The code generator 'Microsoft.ServiceModel.DomainServices.Tools.CSharpCodeDomClientCodeGenerator' encountered a fatal exception and could not generate code for project 'C:\Projects\GMS60\40 - BSVehicleManagement\10 - Implementation\Agents\Agents.csproj':
Exception has been thrown by the target of an invocation.

After starting MSBuild.exe with the /debug option it gives me a bit more information. The inner exception of the TargetInvocationException actually is:

Object of type 'System.Collections.Generic.List`1[Microsoft.Build.Evaluation.ProjectProperty]' cannot be converted to type 'System.Collections.Generic.ICollection`1[Microsoft.Build.Execution.ProjectPropertyInstance]

The error occurs on line 304 in the Microsoft.RIA.Client.targets file inside in the CreateRiaClientFilesTask MSBuild task
Details (expand)

Visual Studio/Silverlight/Tooling version

Silverlight 4

What category (if any) best represents this feedback?

Performance

Steps to reproduce

1. Create a new RIA services application
2. Create a basic entity model
3. Create a new resource file with one string in it
4. Apply the Required attribute to one of the fields of the entity and refer to the string in the resource file created earlier
5. Link the resource file to the client project and configure the CustomTool options the same as in the server project. Be sure to specify a custom tool namespace to be the same as the namespace the resource type was generated inside the server project.
6. Try to build the project

Product Language

English

Operating System

Windows Server 2008 R2

Operating System Language

English

Actual results

Build failure with the error message:

The code generator 'Microsoft.ServiceModel.DomainServices.Tools.CSharpCodeDomClientCodeGenerator' encountered a fatal exception and could not generate code for project 'C:\Projects\GMS60\40 - BSVehicleManagement\10 - Implementation\Agents\Agents.csproj':
Exception has been thrown by the target of an invocation.

Expected results

Build succeeded
File Attachments
File Name Submitted By Submitted On File Size  
Realty.7z 1/19/2012 6.13 MB
Sign in to post a comment.
Posted by Andrii.C.Sharp on 11/28/2012 at 12:27 PM
Don't lie
It is reproducible by running debug on attached solution
Posted by Andrii.C.Sharp on 1/19/2012 at 2:58 PM
In my case it is because I added copy of generated resources.cs files to Web project
Posted by Andrii.C.Sharp on 1/19/2012 at 2:51 PM
I've reproduced it eventually.
See new attachment
Posted by ArielBH on 1/19/2012 at 3:09 AM
I can reproduce it,
From my exprience it is connected to the DataAnnotions attributes when it is looking for types in the resx.
When I tried to manipulate the Buisness Applocation template and move Ria Services link and files to other assembly I had the same issue. When I removed all references to those resx files this issue disappered.
Posted by Microsoft on 7/11/2011 at 2:05 PM
I was unable to reproduce the issue based on the steps provided. Could you share your solution with us? Also please let me know which Visual studio version and RIA version you are on.

Posted by W.Meints on 7/2/2011 at 1:51 AM
Why is this issue closed? The error still occurs and I haven't heard of a workaround or a solution for this issue.
Posted by Microsoft on 4/18/2011 at 6:26 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 4/18/2011 at 3:12 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by ArielBH on 1/19/2012 at 3:10 AM
Remove all usage for the resx files in the data annotation attribute.
The penalty is that you lose the ability to localize those strings.