WildernessLabs / Meadow_Issues

Public repo for bugs and issues with Meadow
15 stars 0 forks source link

Adding SignalR Client NuGet makes deployment fail #493

Open ProgrammerAL opened 9 months ago

ProgrammerAL commented 9 months ago

Describe the bug When creating a new F7 app using the default template that references the SignalR Client NuGet, the app fails to deploy.

To Reproduce

  1. Use the templates to create a basic Meadow F7 Feather App (If it matters, I used C#)
  2. Deploy the app to an F7. Notice this compiles and deploys successfully.
  3. Add a NuGet reference to the Microsoft.AspNetCore.SignalR.Client.Core package using the latest version (8.0.2 at time of this writing). Make no other changes. Just reference the NuGet.
  4. Deploy the app. This will compile, and then deployment will fail. (outputs are below in the Additional Context section)
  5. Open the .csproj file and remove the line referencing the Microsoft.AspNetCore.SignalR.Client.Core NuGet package
  6. Deploy the app. This time it will work.

Expected behavior The app should deploy.

Developer tools (please complete the following information as best as you can):  - OS and version: Windows 11 Pro. 23H2  - IDE and version: Visual Studio Community 2022 64-bit Version 17.9.2  - Meadow extension for IDE version: VS 2022 Tools for Meadow v1.9.0

Meadow (please complete the following information as best as you can):  - Meadow hardware version: F7Micro F7FeatherV2  - Meadow OS version: 1.9.0.0  - If they are different, please provide these versions as well.    - Meadow Mono version: 1.9.0.0    - Meadow coprocessor version: 1.9.0.0

Additional context

Someone in the Slack mentioned the device could be running out of disk space. I don't think this is happening. Using the default template to generate a Meadow Feather app, the /bin/Debug/netstandard2.1 folder is 27.5 MB. After adding the  Microsoft.AspNetCore.SignalR.Client.Core NuGet reference the /bin/Debug/netstandard2.1 folder was 28.6 MB.

The error output I got from Visual Studio when deploying the app is:

Build started at 2:11 PM...
1>------ Build started: Project: practice_Meadow2, Configuration: Debug Any CPU ------
1>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
1>practice_Meadow2 -> C:\temp\practice_Meadow2\practice_Meadow2\bin\Debug\netstandard2.1\App.dll
2>------ Deploy started: Project: practice_Meadow2, Configuration: Debug Any CPU ------
2>
2>Connecting to Meadow on COM4
2>Meadow OS version 1.9.0.0 was previously downloaded to: C:\Users\Progr\AppData\Local\WildernessLabs\Firmware\1.9.0.0.
2>
2>Connecting to Meadow on COM4
2>Found App.dll (CRC: 2151921768)
2>Found App.pdb (CRC: 1513073462)
2>Found app.config.yaml (CRC: 2897788161)
2>Found App.deps.json (CRC: 2763365217)
2>Found meadow.config.yaml (CRC: 1329136832)
2>Found Meadow.Contracts.dll (CRC: 2294790477)
2>Found Meadow.dll (CRC: 2462916829)
2>Found Meadow.F7.dll (CRC: 843020962)
2>Found Meadow.Foundation.dll (CRC: 502125622)
2>Found Meadow.Logging.dll (CRC: 3819891859)
2>Found Meadow.Units.dll (CRC: 2334787585)
2>Found Microsoft.Bcl.AsyncInterfaces.dll (CRC: 3215379713)
2>Found Microsoft.Extensions.Configuration.Abstractions.dll (CRC: 33053645)
2>Found Microsoft.Extensions.Configuration.dll (CRC: 2526625974)
2>Found Microsoft.Extensions.Configuration.FileExtensions.dll (CRC: 4121043609)
2>Found Microsoft.Extensions.Configuration.Json.dll (CRC: 1836327059)
2>Found Microsoft.Extensions.FileProviders.Abstractions.dll (CRC: 2670091038)
2>Found Microsoft.Extensions.FileProviders.Physical.dll (CRC: 338685548)
2>Found Microsoft.Extensions.FileSystemGlobbing.dll (CRC: 2950879595)
2>Found Microsoft.Extensions.Primitives.dll (CRC: 163906323)
2>Found Mono.Security.dll (CRC: 1866976119)
2>Found MQTTnet.dll (CRC: 2520105510)
2>Found mscorlib.pdb (CRC: 109299838)
2>Found NetEscapades.Configuration.Yaml.dll (CRC: 2894847578)
2>Found netstandard.dll (CRC: 1086434667)
2>Found System.Buffers.dll (CRC: 2270003332)
2>Found System.Configuration.dll (CRC: 3052968424)
2>Found System.Core.dll (CRC: 2131138376)
2>Found System.Core.pdb (CRC: 3455730041)
2>Found System.dll (CRC: 264040526)
2>Found System.IO.Compression.dll (CRC: 2004292632)
2>Found System.IO.Compression.FileSystem.dll (CRC: 1307849617)
2>Found System.Memory.dll (CRC: 1315600087)
2>Found System.Net.Http.dll (CRC: 3040392666)
2>Found System.Numerics.dll (CRC: 2619691808)
2>Found System.Numerics.Vectors.dll (CRC: 3108004323)
2>Found System.pdb (CRC: 786670127)
2>Found System.Runtime.CompilerServices.Unsafe.dll (CRC: 27007476)
2>Found System.Security.dll (CRC: 1299344238)
2>Found System.Text.Encodings.Web.dll (CRC: 2255902349)
2>Found System.Text.Json.dll (CRC: 1859305368)
2>Found System.Web.dll (CRC: 2667671119)
2>Found System.Xml.dll (CRC: 3384391195)
2>Found YamlDotNet.dll (CRC: 1259838021)
2>Found System.Threading.Tasks.Extensions.dll (CRC: 2160723354)
2>Found mscorlib.dll (CRC: 903900467)
2>Found meadow.log (CRC: 2333961918)
2>Found dns.conf (CRC: 2979744109)
2>An error occurred during the App deployment process.
2>Error:
2>An item with the same key has already been added. 
2>Stack Trace :
2>   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
2>   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
2>   at Meadow.CLI.Core.Devices.MeadowLocalDevice.<>c__DisplayClass83_1.<<DeployApp>g__AddFile|3>d.MoveNext()
2>--- End of stack trace from previous location where exception was thrown ---
2>   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2>   at Meadow.CLI.Core.Devices.MeadowLocalDevice.<DeployApp>d__83.MoveNext()
2>
2>Connecting to Meadow on COM4
2>Deploy failed. If a Meadow device is attached, please Reset Meadow and try again.
2>An item with the same key has already been added.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 2:12 PM and took 31.724 seconds ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
========== Deploy completed at 2:12 PM and took 31.724 seconds ==========

After the app failed to deploy, I power cycled my feather and ran meadow file list. The output was:

Getting file list...
Cache[folder]
Data[folder]
Documents[folder]
Temp[folder]
update-store[folder]
app.config.yaml
App.deps.json
App.dll
App.pdb
dns.conf
meadow.config.yaml
Meadow.Contracts.dll
Meadow.dll
Meadow.F7.dll
Meadow.Foundation.dll
meadow.log
Meadow.Logging.dll
Meadow.Units.dll
Microsoft.Bcl.AsyncInterfaces.dll
Microsoft.Extensions.Configuration.Abstractions.dll
Microsoft.Extensions.Configuration.dll
Microsoft.Extensions.Configuration.FileExtensions.dll
Microsoft.Extensions.Configuration.Json.dll
Microsoft.Extensions.FileProviders.Abstractions.dll
Microsoft.Extensions.FileProviders.Physical.dll
Microsoft.Extensions.FileSystemGlobbing.dll
Microsoft.Extensions.Primitives.dll
Mono.Security.dll
MQTTnet.dll
mscorlib.dll
mscorlib.pdb
NetEscapades.Configuration.Yaml.dll
netstandard.dll
System.Buffers.dll
System.Configuration.dll
System.Core.dll
System.Core.pdb
System.dll
System.IO.Compression.dll
System.IO.Compression.FileSystem.dll
System.Memory.dll
System.Net.Http.dll
System.Numerics.dll
System.Numerics.Vectors.dll
System.pdb
System.Runtime.CompilerServices.Unsafe.dll
System.Security.dll
System.Text.Encodings.Web.dll
System.Text.Json.dll
System.Threading.Tasks.Extensions.dll
System.Web.dll
System.Xml.dll
YamlDotNet.dll
        53 file(s)
doingnz commented 9 months ago

@bryancostanich it would be helpful for the error An item with the same key has already been added. to include the name of the assembly it was trying to link to, and ideally it would display the version number of the the already linked assembly and the one it was trying to add to the collection when the conflict occurred. This would make the issue clearer to developers trying to deploy apps.

@ProgrammerAL this problem has been occuring when different assemblies link to different version of System.Text.Json. You may need to check if the SignalR assembly is referencing V8.x of System.Text.Json. Previously Meadow assemblies referenced V7.x of Systems.text.Json and the Deployment process is unhappy when an attempt is made to deploy both versions of the assembly as there is only capability to have a single file with the give name. Deployment does not know which one is correct and throws up an error.

You may need to remove the Nuget references in the sample template application and replace them with project references to clones of the Meadow repositories and then ensure the same version of System.Text.Json is used throughout (or whatever assemble name is causing the clash.)

adrianstevens commented 9 months ago

@CartBlanche - we should probably prioritize updating the extension to the new CLI code base - let's talk strategy this week and get it across the line