Jump to content

Conversion not successful - Error message


500driver

Recommended Posts

Hi,

I tried to convert my SL project and it ended with the following error message:

Unerwarteter Fehler bei der ResourceFilesRelocatorTask-Aufgabe.
System.Collections.Generic.KeyNotFoundException: Der angegebene Schlüssel war nicht im Wörterbuch angegeben.
   bei System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   bei Artinsoft.Common.NetAggregation.Project.GetDocument(String filename)
   bei Artinsoft.Common.NetAggregation.Project.GetSource(String filename, SMExceptionHandler exceptionHandler, CancellationToken cancellationToken, Func`2 getDefaultEncoding)
   bei Artinsoft.Winph2UAP.ResourceFilesRelocatorTask.<>c__DisplayClass4.<MoveDesignerGeneratedFiles>b__0(DesignerResxPair item)
   bei System.Linq.Enumerable.<>c__DisplayClass7_0`3.<CombineSelectors>b__0(TSource x)
   bei System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   bei System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   bei Artinsoft.Winph2UAP.ResourceFilesRelocatorTask.MoveDesignerGeneratedFiles(Project project, ITargetSolutionArtifacts artifacts, IResourcesRelocator relocator)
   bei Artinsoft.Winph2UAP.ResourceFilesRelocatorTask.ExecuteImpl()
   bei Artinsoft.CSharp.Tasks.AbstractTask.BeforeExecuteImpl()
   bei Artinsoft.Common.MSBuild.BaseCancellableTask.Execute()
   bei Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   bei Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() 
 

The Migration log ends with the ResourceFilesRelocatorTask.

What to do now?

Regards,

Thomas

Link to comment
Share on other sites

Here's the English version of that same Exception, which I also get for my project.
Herb

 

The "ResourceFilesRelocatorTask" task failed unexpectedly.
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
  at Artinsoft.Common.NetAggregation.Project.GetDocument(String filename)
  at Artinsoft.Common.NetAggregation.Project.GetSource(String filename, SMExceptionHandler exceptionHandler, CancellationToken cancellationToken, Func`2 getDefaultEncoding)
  at Artinsoft.Winph2UAP.ResourceFilesRelocatorTask.<>c__DisplayClass4.<MoveDesignerGeneratedFiles>b__0(DesignerResxPair item)
  at System.Linq.Enumerable.<>c__DisplayClass7_0`3.<CombineSelectors>b__0(TSource x)
  at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
  at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
  at Artinsoft.Winph2UAP.ResourceFilesRelocatorTask.MoveDesignerGeneratedFiles(Project project, ITargetSolutionArtifacts artifacts, IResourcesRelocator relocator)
  at Artinsoft.Winph2UAP.ResourceFilesRelocatorTask.ExecuteImpl()
  at Artinsoft.CSharp.Tasks.AbstractTask.BeforeExecuteImpl()
  at Artinsoft.Common.MSBuild.BaseCancellableTask.Execute()
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
  at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()

 
Link to comment
Share on other sites

  • Mobilize.Net Staff

Hi 500driver and Herb

Our solution team is looking closely into this issue. We expect a reply from them as soon as they manage to replicate and pinpoint the issue.

Thanks for the collaboration

Link to comment
Share on other sites

  • Mobilize.Net Staff

Hi,

We're having problem reproducing this problem in our environment.

The problem occurs while the conversion tool is trying to process resource (resx) files which contain an associated C#(.cs) file with properties for each resource key. It seems that  the tool is not able to find one of these C# (.cs) files.

If possible can you send us the 'MigrationLog.txt' file?. Also if possible , can you tell us if the .csproj file you're processing has entries entries like:

 

   <Compile Include="Resources\AppResources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>AppResources.resx</DependentUpon>
    </Compile>

 

Thanks

Link to comment
Share on other sites

Yes it has.

Example:

    <Compile Include="..\KeyRing\Resources\AppResources.pt-BR.Designer.cs">
      <Link>Resources\AppResources.pt-BR.Designer.cs</Link>
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>AppResources.pt-BR.resx</DependentUpon>
    </Compile>
The resource is located in another project in the same solution. I'm sharing (esp. string resources) through different (OS) versions of my app.

Is this a situation the converter is prepared for?

-Thomas

MigrationLog.txt

Link to comment
Share on other sites

  • Mobilize.Net Staff

Maybe we didn't consider some particular scenario. The project that has the resource file is a WP8 library csproject? or is it a portable class library csproject?

I'm going to try to reproduce the problem on our side with the information that you gave us.

 

Thanks,

Luis

Link to comment
Share on other sites

I have a similar setup.

The Resources are in a separate WP8 project. There only the default resource catalog AppResources.resx has a AppResources.Designer.resx associated to it. The other languages (e.g. AppResources.de-DE.resx ) don't have that.

The csproj file of that library does include:
<Compile Include="Resources\AppResources.Designer.cs">
  <DependentUpon>AppResources.resx</DependentUpon>
  <AutoGen>True</AutoGen>
  <DesignTime>True</DesignTime>
</Compile>

 

and also:

    <TargetFrameworkIdentifier>WindowsPhone</TargetFrameworkIdentifier>
    <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>

Link to comment
Share on other sites

In my case the project with the resources is a SL WP7 (!) app. The project I'm converting is a WP8.1 SL app.

All language resources have a Designer.cs and are linked to the WP7 project.

If you think it can help we might schedule a TeamViewer session.

Edited by 500driver
Link to comment
Share on other sites

  • Mobilize.Net Staff

Hi,

I was able to reproduce with problem by creating a separate project with a RESX file which is added as a link .   This is the scenario that Thomas (500driver) described:

   <Compile Include="..\KeyRing\Resources\AppResources.pt-BR.Designer.cs">
       <Link>Resources\AppResources.pt-BR.Designer.cs</Link>
       <AutoGen>True</AutoGen>
       <DesignTime>True</DesignTime>
       <DependentUpon>AppResources.pt-BR.resx</DependentUpon>
     </Compile>

I guessing but I can tell that AppResources.pt-BR.resx is also added as a link (that is, a file that is stored in a directory separated from the .csproj directory. I understand this is a common pattern when sharing fields between projects with different targets.


Would it be possible to move this files inside de project directory structure? This is only required to perform the migration and to verify if this is the problem.

As for herb, can you verify is there’s a file added as Link in your CSPROJ WP8 projects?

Thanks,
Luis

Link to comment
Share on other sites

  • Mobilize.Net Staff

Herb, if possible, can you send me the MigrationLog.txt?  If not it will be useful to know the way you are referencing .RESX files . Again the exception described above is related to processing .CS files generated from RESX files.

 

Thanks again,

Luis

Link to comment
Share on other sites

Here's how we work with Resources:

  • Only the default resx has an auto-generated .cs associated with it, all others do not have that (cannot remember why)
  • Resources are in a WP8 project as EmbeddedResources
  • That class exposes them to all other projects in the solution via a LocalizationHelper, which does the lookup via
    AppResources.ResourceManager.GetString(key, AppResources.Culture);

The log ends with:

[AppXamlCorrectionTask] Processing C:\Users\herb\AppData\Local\Temp\WindowsPhone,Version=v8.0.AssemblyAttributes.cs
Starting task: UniversalManifestGenerationTask
Starting task: AddSplashScreenImageWhenMissingTask
Starting task: ResourceFilesRelocatorTask

 

It does contain some lines about AppResources:
[CompletedActionPatternTask] Processing D:\myApp\Win8_Silverlight\app\myApp\myAppSharedHelpers\Resources\AppResources.Designer.cs
[DynamicEventHandlerDecoratorTask] Processing D:\myApp\Win8_Silverlight\app\myApp\myAppSharedHelpers\Resources\AppResources.Designer.cs
[NamespaceReferenceTransformationTask] Processing D:\myApp\Win8_Silverlight\app\myApp\myAppSharedHelpers\Resources\AppResources.Designer.cs
[AppXamlCorrectionTask] Processing D:\myApp\Win8_Silverlight\app\myApp\myAppSharedHelpers\Resources\AppResources.Designer.cs

 

Should we try the following?
a) kick out the additional languages or
b) add the .cs to the additional resources?

Link to comment
Share on other sites

Jay!

Conversion succeeded when I added my resources as copy instead of as link

But I got hundreds of warnings like

The tool does not have information on the 'System.Collections.Generic.Dictionary' library class. Its 'Add' member was referenced.

Are you real? You don't know a generic dictionary?

 

 

Edited by 500driver
Link to comment
Share on other sites

  • Mobilize.Net Staff

Thomas (500driver),

Those kind of warnings are generated when the tool finds invocations to APIs that don’t have a registered conversion action.

In this specific case (System.Collections.Generic.Dictionary) it is not a problem because this class exists in the target platform (UWP),

For a list of all registered APIs with its mapping actions see: https://github.com/MobilizeNet/UWPConversionMappings/blob/master/code_mappings_listing.md

 

Link to comment
Share on other sites

  • Mobilize.Net Staff

Herb,

Is there another file in your .CSPROJECT which has the ‘AutoGen’, ‘DesignTime’ and ‘DependentUpon’ tags? . For example the one you sent us:

<Compile Include="Resources\AppResources.Designer.cs">
  <DependentUpon>AppResources.resx</DependentUpon>
  <AutoGen>True</AutoGen>
  <DesignTime>True</DesignTime>
</Compile>

Is there another ‘Compile’ tag with this structure which is referenced as a link?

Or is there another file in your project that is referenced as a <link>?

Thanks again,

Luis

Link to comment
Share on other sites

10 hours ago, luis said:

Those kind of warnings are generated when the tool finds invocations to APIs that don’t have a registered conversion action.

In this specific case (System.Collections.Generic.Dictionary) it is not a problem because this class exists in the target platform (UWP),

 

Why are you emitting a warning then? I mean, it distracts from the real problems.

 

Will there be a fix for the scenario with the linked resources?

Link to comment
Share on other sites

  • 1 month later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use