2

最近、C#プロジェクトを.NET 3.5から4.0に更新しました。ローカルマシンとCC.NETでGendarmeを実行します。 (ロギングがオンになって)私たちのプロジェクトのすべてを更新した後、憲兵は、私たちのアセンブリのいずれかのこのエラーを取得しているされていますSatelliteResourceMismatchRuleからファイルまたはアセンブリをロードできませんでした

An uncaught exception occured. Please fill a bug report at https://bugzilla.novell.com/ 
Rule: Gendarme.Rules.Globalization.SatelliteResourceMismatchRule 
Target: Core.UI, Version=27.0.0.0, Culture=neutral, PublicKeyToken=null 
Stack trace: System.IO.FileNotFoundException: Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 
File name: 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 
    at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, BooleanloadTypeFromPartialName) 
    at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) 
    at System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) 
    at System.Type.GetType(String typeName, Boolean throwOnError) 
    at System.Resources.ResourceReader.FindType(Int32 typeIndex) 
    at System.Resources.ResourceReader.DeserializeObject(Int32 typeIndex) 
    at System.Resources.ResourceReader.LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode) 
    at System.Resources.ResourceReader.GetValueForNameIndex(Int32 index) 
    at System.Resources.ResourceSet.ReadResources() 
    at Gendarme.Rules.Globalization.SatelliteResourceMismatchRule.CheckSatelliteResource(EmbeddedResource mainResource, EmbeddedResource satelliteResource, IMetadataTokenProvider satelliteAssembly) 
    at Gendarme.Rules.Globalization.SatelliteResourceMismatchRule.CheckSatelliteAssembly(AssemblyDefinition satellite) 
    at Gendarme.Rules.Globalization.SatelliteResourceMismatchRule.CheckAssembly(AssemblyDefinition assembly) 
    at Gendarme.Framework.Runner.OnAssembly(RunnerEventArgs e) 
    at Gendarme.ConsoleRunner.OnAssembly(RunnerEventArgs e) 
    at Gendarme.Framework.Runner.Run() 
    at Gendarme.ConsoleRunner.Run() 
    at Gendarme.ConsoleRunner.Execute(String[] args) 

=== Pre-bind state information === 
LOG: DisplayName = System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 
(Fully-specified) 
LOG: Appbase = file:///c:/sd/trunk/bin/prod/ 
LOG: Initial PrivatePath = NULL 
Calling assembly : (Unknown). 
=== 
LOG: This bind starts in default load context. 
LOG: No application configuration file found. 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config. 
LOG: Post-policy reference: System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 
LOG: Attempting download of new URL file:///c:/sd/trunk/bin/prod/System.Drawing.DLL. 
LOG: Attempting download of new URL file:///c:/sd/trunk/bin/prod/System.Drawing/System.Drawing.DLL. 
LOG: Attempting download of new URL file:///c:/sd/trunk/bin/prod/System.Drawing.EXE. 
LOG: Attempting download of new URL file:///c:/sd/trunk/bin/prod/System.Drawing/System.Drawing.EXE. 

同じエラーが複数のコンピュータで発生します。 GendarmeはSystem.Drawingを参照する他のアセンブリと、壊れているアセンブリを参照するアセンブリで正常に動作します。 gendarmeの設定ファイルを作成して.NET 4.0を指定しましたが、同じエラーが表示されます。私は参照を削除し、変更なしで再び追加しました。プログラムを実行すると、このアセンブリのコントロールは問題なくロードされ、動作します。このアセンブリで単体テストを行い、NUnitとPartCoverもうまく動作します。

Framework64 \ v2.0.50727フォルダのmachine.configファイルが使用されていますが、このアセンブリが他のものと異なる理由はわかりません。それが問題なのでしょうか?それ以外に何ができますか?

答えて

1

一般に、解析しているフレームワークのバージョンは関係ありません。つまり、Gendarmeはそれらをすべてサポートしています。しかし、この場合、ルールはリソースからデータをロードしようとします。逆シリアル化では、Gendarmeが実行されているバージョン(3.5)とは異なる.NET(4.0)のバージョンが必要です。

これはルール自体のバグであり、修正する必要があります(尋ねられたエラーメッセージのようにバグレポートを開いてください)。その間、分析からこのルールを(完全にまたは一部のアセンブリ/タイプ/メソッドで)除外します。

+0

ご回答いただきありがとうございます。これは現在[こちら](https://bugzilla.novell.com/show_bug.cgi?id=706526)に記録されています。 – DSway

1

FYI:私はあなたと同じ問題を抱えていました。しかし、私は最新のスナップショットバージョンをインストールすることでソナールでgendarmeを実行することができました:https://github.com/spouliot/gendarme/downloads(現在のgendarme-2.11-snapshot-20110305-win32-setup.zip)

インストールパスをsonar-project.propertiesファイル:

sonar.gendarme.installDirectory = C:/プログラムファイル/憲兵/

関連する問題