dotnet / Comet

Comet is an MVU UIToolkit written in C#
MIT License
1.65k stars 117 forks source link

Problems with Comet and Maui #246

Closed dmccolloughOneGas closed 2 years ago

dmccolloughOneGas commented 2 years ago

I thought I would give Comet a whirl and see if I could get it working.

I'm on a Mac.

I installed powershell core I installed typescript with npm i -g typescript

I installed the Comet for Mobile VS Code extension

I set the VSCode setting omnisharp.useGlobalMono to never

I created a .NET Maui project with the command dotnet new maui -n SampleApp

I opened the project I just created with VS Code and created a .vscode/launch.json file with the following: { "version": "0.2.0", "configurations": [ { "name": "Debug", "type": "comet", "request": "launch", "preLaunchTask": "comet: Build" } ] }

In the lower left corner of VS Code, there is a spinning icon next to it says Mobile .NET Projects

I received a popup in the lower right corner indicating some projects couldn't load. See image. Screen Shot 2022-03-23 at 7 22 46 AM

I clicked on show output and I see a fail in the output. Below is the text

    Could not resolve field token 0x040000ff, due to: Could not set up parent class, due to: Could not set up parent class, due to: Could not load type of field 'Svg.SvgElement:_graphicsTransform' (10) due to: Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. assembly:/usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.200-preview.14.5099/targets/Svg.Custom.dll type:SvgElement member:(null) assembly:/usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.200-preview.14.5099/targets/Svg.Custom.dll type:SvgFragment member:(null) assembly:/usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.200-preview.14.5099/targets/Svg.Custom.dll type:SvgDocument member:(null)

at Microsoft.Maui.Resizetizer.ResizetizeImages.ExecuteAsync () [0x0000d] in <4626eb33475f4dfd994e46e3c269431b>:0 at Microsoft.Maui.Resizetizer.MauiAsyncTask.b__0_0 () [0x00000] in <4626eb33475f4dfd994e46e3c269431b>:0 at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <36514b14425c4337b446653c547aa9c3>:0 at System.Threading.Tasks.Task.Execute () [0x00000] in <36514b14425c4337b446653c547aa9c3>:0

    Failed to load project file '/Users/oke17225/Documents/Repos/Personal/NonTFS/Prev14App/Prev14App.csproj'.

/Users/oke17225/Documents/Repos/Personal/NonTFS/Prev14App/Prev14App.csproj /usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.200-preview.14.5099/targets/Microsoft.Maui.Resizetizer.targets(475,9): Error: Could not resolve field token 0x040000ff, due to: Could not set up parent class, due to: Could not set up parent class, due to: Could not load type of field 'Svg.SvgElement:_graphicsTransform' (10) due to: Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. assembly:/usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.200-preview.14.5099/targets/Svg.Custom.dll type:SvgElement member:(null) assembly:/usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.200-preview.14.5099/targets/Svg.Custom.dll type:SvgFragment member:(null) assembly:/usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.200-preview.14.5099/targets/Svg.Custom.dll type:SvgDocument member:(null) at Microsoft.Maui.Resizetizer.ResizetizeImages.ExecuteAsync () [0x0000d] in <4626eb33475f4dfd994e46e3c269431b>:0 at Microsoft.Maui.Resizetizer.MauiAsyncTask.b__0_0 () [0x00000] in <4626eb33475f4dfd994e46e3c269431b>:0 at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <36514b14425c4337b446653c547aa9c3>:0 at System.Threading.Tasks.Task.Execute () [0x00000] in <36514b14425c4337b446653c547aa9c3>:0

    Attempted to update project that is not loaded: /Users/oke17225/Documents/Repos/Personal/NonTFS/Prev14App/Prev14App.csproj

How do I resolve this issue?

SarthakGz commented 2 years ago

@dmccolloughOneGas you are creating MAUI project and trying to run as Comet project. Command to create comet project is dotnet new -i Clancey.Comet.Templates.Multiplatform dotnet new comet -n RideTheComet You can Check documentation also from below https://github.com/dotnet/Comet/wiki/Getting-Started

ghost commented 2 years ago

I've been struggling with this issue for months now, and found out the solution! You have to enable the following omisharp option in vscode: Omnisharp: Use modern Net. Restart vscode to make sure the new omnisharp package is downloaded and voila! I'm now able to debug ios and mac apps from vscode running on my m1 mac! woohooo

dmccolloughOneGas commented 2 years ago

@cfierro-glb Thanks very much for your response, I did the same thing and it's now working.