我正在尝试调试通过ILRepack合并的插件程序集,但是插件注册工具的重放插件执行会引发一个与System.Text.Json:Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Operation could destabilize the runtime.相关的错误
合并命令如下所示:
<Target Name="ILRepack" AfterTargets="Build">
<Message Text="ILRepack is running..." />
<ItemGroup>
<ILRepackPackage Include="..\packages\ILRepack.2.0.18\tools\ILRepack.exe" />
</ItemGroup>
<Error Condition="!Exists(@(ILRepackPackage->'%(FullPath)'))" Text="You are trying to use the ILRepack package, but it is not installed or at the correct location." />
<Exec Command="@(ILRepackPackage->'%(FullPath)') /out:$(OutputPath)Merged\$(AssemblyName).dll $(OutputPath)$(AssemblyName).dll <...AND ALL OTHER ASSEMBLIES> /parallel /wildcards /target:library /keyfile:NPDKey.snk" />
</Target>在Dynamic365CE(在线)中,代码执行很好,只有插件重放才会抛出错误。
我试过:
ILRepect.Lib.MSBuild.Task或ILRepack.MSBuild.Task,但这些工具具有相同的效果。下面是一些抛出实际错误的代码:
var data = System.Text.Json.JsonSerializer.Serialize(object);System.Text.Json版本为6.0.5
发布于 2022-08-26 12:29:04
在做了更多的研究之后,我发现我可以通过插件注册工具中的回放插件执行特性来调试ILRepack合并程序集。但是在“设置”选项卡中,“隔离模式”必须选择为“无”,请参见下面的图像。

https://stackoverflow.com/questions/73428404
复制相似问题