Jump to content
500driver

Conversion not successful - Error message

Recommended Posts

500driver    0

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

Share this post


Link to post
Share on other sites
herb    0

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()

 

Share this post


Link to post
Share on other sites
jmena    0

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

Share this post


Link to post
Share on other sites
luis    0

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

Share this post


Link to post
Share on other sites
500driver    0

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

Share this post


Link to post
Share on other sites
luis    0

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

Share this post


Link to post
Share on other sites
herb    0

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>

Share this post


Link to post
Share on other sites
500driver    0

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

Share this post


Link to post
Share on other sites
luis    0

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

Share this post


Link to post
Share on other sites
herb    0

Hi,
I do not have that <Link> node. The Resources have the following properties: EmbeddedResource, Do not copy

Herb

Share this post


Link to post
Share on other sites
luis    0

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

Share this post


Link to post
Share on other sites
herb    0

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?

Share this post


Link to post
Share on other sites
herb    0

I have now kicked out the additional languages (references in project-properties as well as the .resx files). The exception remains.

 

Share this post


Link to post
Share on other sites
500driver    0

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

Share this post


Link to post
Share on other sites
luis    0

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

 

Share this post


Link to post
Share on other sites
luis    0

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

Share this post


Link to post
Share on other sites
500driver    0
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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×