user3845056
user3845056

Reputation: 497

crmsvcutil error Exception has been thrown by the target of an invocation

I get the following error when generating early bound entities

Exiting program with exception: Exception has been thrown by the target of an invocation. Enable tracing and view the trace files for more information.

The command I run is

crmsvcutil.exe /out:"..\Entities.cs" /namespace:XXXX.CRM.Model.Xrm /serviceContextName:XrmServiceContext /codewriterfilter:"XXX.CRM.Util.SvcUtil.Extensions.EntityFilteringService, XXX.CRM.Util.SvcUtil.Extensions" /codecustomization:"XXX.CRM.Util.SvcUtil.Extensions.EntityCodeCustomizationService, XXX.CRM.Util.SvcUtil.Extensions"

The config file is

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="url" value="https://XXX.api.crm6.dynamics.com/XRMServices/2011/Organization.svc"/>
    <add key="domain" value=""/>
    <add key="username" value="XXX"/>
    <add key="password" value="XXXX"/>
    <add key="solution" value="XXXX"/>
  </appSettings>
  <system.diagnostics>
    <trace autoflush="false" indentsize="4">
      <listeners>
        <add name="configConsoleListener" type="System.Diagnostics.ConsoleTraceListener">
          <filter type="System.Diagnostics.EventTypeFilter" initializeData="Error" />
        </add>
        <add name="fileListener"/>
      </listeners>
    </trace>
   <sharedListeners>
      <add name="fileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="CrmSvcUtil.log"/>
    </sharedListeners>
  </system.diagnostics>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

I have two questions What is causing this error? How can I get the file tracing working?

Upvotes: 1

Views: 529

Answers (2)

Daryl
Daryl

Reputation: 18895

Almost certainly it has to be one of your code extensions. You can run CrmSvcUtil from the command line, and then attach the debugger, and set break points within VS to diagnose.

You can read how to turn the teaching on here.

Upvotes: 1

Jordi
Jordi

Reputation: 1470

Maybe you are trying to pull too many entities in one go. Here's an example to modify the codewriter file to include the Account entity only. You could use it as a starting point to filter out other entities.

Upvotes: 1

Related Questions