Skip to content

Problem with Dotfuscator #8

Closed

Description

@mariohik

I couldn't compile my project using Dotfuscator:

Symbols were found but are not matching the assembly
at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader, Boolean throwIfSymbolsAreNotMaching)
at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters)
at Mono.Cecil.ModuleReader.CreateModule(Image image, ReaderParameters parameters)
at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
at Xamarin.AndroidX.Migration.CecilMigrator.Migrate(String source, String destination) in D:\a\1\s\source\Xamarin.AndroidX.Migration\CecilMigrator.cs:line 85
at Xamarin.AndroidX.Migration.CecilMigrator.Migrate(IEnumerable`1 assemblies) in D:\a\1\s\source\Xamarin.AndroidX.Migration\CecilMigrator.cs:line 50
at Xamarin.AndroidX.Migration.BuildTasks.CecilfyFiles.Execute() in D:\a\1\s\source\Xamarin.AndroidX.Migration.BuildTasks\CecilfyFiles.cs:line 35 x2Apps.CheckPlaca.App.Android C:\Users\mario.nuget\packages\xamarin.androidx.migration\1.0.0-preview02\build\Xamarin.AndroidX.Migration.targets 182

Setting the DotfuscatorXamarinEnabled option to FALSE in my csproj solves the problem.

Activity

  1. tranb3r commented on Sep 16, 2019

    @tranb3r

    Same for me, using Babel instead of Dotfuscator

  2. tranb3r commented on Oct 9, 2019

    @tranb3r

    I've moved my obfuscation task after _AndroidXCecilfy and now I can build and manually deploy my app (but deploy from VS still fails though).

  3. MarvinFrankenfeld commented on Jan 3, 2020

    @MarvinFrankenfeld

    Are there any news? We are having the same problem since updating to AndroidX and this is stopping us from delivering an important update to our users.

  4. kcrg commented on Jan 8, 2020

    @kcrg

    @MarvinFrankenfeld Thats why updating prod project to nugets in preview isn't good idea.

  5. MarvinFrankenfeld commented on Jan 8, 2020

    @MarvinFrankenfeld

    I know. But we had to migrate because the newest instabug xamarin version dependes on these packages and wen needed to update instabug because it includes some critical bug fixes. Instabug shouldn't release release updates depending on prerelease packages. Anyways, i fixed it. Here is the solution if anybody is interested in the future:

    I commented out the following part inside the PreEmptive.Dotfuscator.Xamarin.targets file.

      <!--<_DotfuscatorXamarinOriginalFiles Include="@(_DebugSymbolsIntermediatePath)"
                                            Condition="'$(_DebugSymbolsProduced)'=='true' and '$(SkipCopyingSymbolsToOutputDirectory)' != 'true' and '$(CopyOutputSymbolsToOutputDirectory)'=='true'">
            <Destination>%(_DebugSymbolsIntermediatePath.Filename)%(_DebugSymbolsIntermediatePath.Extension)</Destination>
          </_DotfuscatorXamarinOriginalFiles>-->
    

    Then it runs fine.

  6. maneca commented on Feb 24, 2020

    @maneca

    Hello everyone,

    I am using Babel and I am having the same problems in building the release version but I am using the stable versions of AndroidX (1.0.0)

    Xamarin.AndroidX.Migration.1.0.0/build/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : Symbols were found but are not matching the assembly

    Can anybody help me with this?

  7. jitendrajadav commented on Mar 2, 2020

    @jitendrajadav

    Same problem

    Severity Code Description Project File Line Suppression State
    Error Symbols were found but are not matching the assembly
    at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader, Boolean throwIfSymbolsAreNotMaching)
    at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters)
    at Mono.Cecil.ModuleReader.CreateModule(Image image, ReaderParameters parameters)
    at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
    at Xamarin.AndroidX.Migration.CecilMigrator.Migrate(String source, String destination)
    at Xamarin.AndroidX.Migration.CecilMigrator.Migrate(IEnumerable`1 assemblies)
    at Xamarin.AndroidX.Migration.BuildTasks.CecilfyFiles.Execute() KegID.Android C:\Users\jdj1.nuget\packages\xamarin.androidx.migration\1.0.0\buildTransitive\monoandroid90\Xamarin.AndroidX.Migration.targets 227

  8. maneca commented on Mar 9, 2020

    @maneca

    Hi everyone,

    After contacting Babel support, they discovered that it is necessary to add the --debug to the call to Babel obsfucator.

    Acoording to the support, in the next release of the babel obfuscator this will no longer be needed.

  9. alienwareone commented on Mar 20, 2020

    @alienwareone

    I've moved my obfuscation task after _AndroidXCecilfy and now I can build and manually deploy my app (but deploy from VS still fails though).

    I have the same problem. How did you setup that task after "_AndroidXCecilfy"?

  10. tranb3r commented on Mar 20, 2020

    @tranb3r

    I've moved my obfuscation task after _AndroidXCecilfy and now I can build and manually deploy my app (but deploy from VS still fails though).

    I have the same problem. How did you setup that task after "_AndroidXCecilfy"?

    In my csproj, I've added this target:

      <Target Name="_Obfuscate" Condition="'$(Configuration)' != 'Debug'" AfterTargets="_AndroidXCecilfyShrink">
        <Exec Command="obfuscate.bat Android $(Configuration)" WorkingDirectory="../scripts" />
      </Target>
    

    The obfuscate.bat script launches babel.exe and makes sure it processes dlls from the androidx\cecil\ folder.

  11. alienwareone commented on Mar 22, 2020

    @alienwareone

    Thanks @tranb3r.

    Did anyone found a solution for Dotfuscator (Community)?
    @MarvinFrankenfeld solution hasn't worked for me.

    I've tried to add "_AndroidXCecilfyShrink" to the build entry point of PreEmptive.Dotfuscator.Xamarin.Targets:

       <!--                    -->
       <!-- Build entry points -->
       <!--                    -->
     
       <Target Name="DotfuscatorXamarin_Build"
               DependsOnTargets="DotfuscatorXamarin_Validate;
                                 DotfuscatorXamarin_Prepare;
                                 DotfuscatorXamarin_Protect;
                                 DotfuscatorXamarin_Update;
                                 _AndroidXCecilfyShrink"/>
    

    But this gives me another error:

    {Path}\Xamarin.AndroidX.Migration.targets(227,9): error MSB4018: Unexpected error CecilfyFiles-task. [{MyProjectPath}.csproj]
    {Path}\Xamarin.AndroidX.Migration.targets(227,9): error MSB4018: System.ArgumentNullException: Value cannot be null. [{MyProjectPath}.csproj]
    {Path}\Xamarin.AndroidX.Migration.targets(227,9): error MSB4018: Parametername: source [{MyProjectPath}.csproj]
    {Path}\Xamarin.AndroidX.Migration.targets(227,9): error MSB4018:    bei System.Linq.Enumerable.Select[TSource,TResult](IEnumerable`1 source, Func`2 selector) [{MyProjectPath}.csproj]
    {Path}\Xamarin.AndroidX.Migration.targets(227,9): error MSB4018:    bei Xamarin.AndroidX.Migration.BuildTasks.CecilfyFiles.Execute() [{MyProjectPath}.csproj]
    {Path}\Xamarin.AndroidX.Migration.targets(227,9): error MSB4018:    bei Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [{MyProjectPath}.csproj]
    {Path}\Xamarin.AndroidX.Migration.targets(227,9): error MSB4018:    bei Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() [{MyProjectPath}.csproj]
    
  12. lucafederli commented on Mar 25, 2020

    @lucafederli

    Same issue in my case using dotfuscator community... And disabling obfuscation is no option so i am blocked with my app releases. Does anybody know a good alternative. Or does anybody know how to address this issue to PreEmptive?

  13. MarvinFrankenfeld commented on Mar 26, 2020

    @MarvinFrankenfeld

    @lucafederli , have you tried my solution described above?

    #8 (comment)

  14. lucafederli commented on Mar 27, 2020

    @lucafederli

    @MarvinFrankenfeld , I tried following:

    I commented out the following part inside the PreEmptive.Dotfuscator.Xamarin.targets file:

    <!--<_DotfuscatorXamarinOriginalFiles Include="@(_DebugSymbolsIntermediatePath)" Condition="'$(_DebugSymbolsProduced)'=='true' and '$(SkipCopyingSymbolsToOutputDirectory)' != 'true' and '$(CopyOutputSymbolsToOutputDirectory)'=='true'"> <Destination>%(_DebugSymbolsIntermediatePath.Filename)%(_DebugSymbolsIntermediatePath.Extension)</Destination> </_DotfuscatorXamarinOriginalFiles>-->

    --> same error when building in release mode with enabled obfuscation (dotfuscator)

    Then I tried the approach of @alienwareone , but same error as described by him.

  15. mattleibow commented on Apr 27, 2020

    @mattleibow
    Member

    Another case... maybe: xamarin/Xamarin.Forms#10441

  16. added a commit that references this issue on May 4, 2020
    ec350cd
  17. added a commit that references this issue on May 4, 2020
    e32d28e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions