Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0.100-preview.5.23269.37] global tool "dotnet-snow" cannot load libSkiaSharp.dll #86571

Closed
Junjun-zhao opened this issue May 22, 2023 · 6 comments

Comments

@Junjun-zhao
Copy link
Member

Junjun-zhao commented May 22, 2023

Description

When launching dotnet-snow global tool, it cannot load the native assembly named "libSkiaSharp.dll" on dotnet sdk version 8.0.100-preview.5.23269.37.

Reproduction Steps

The machine only has 8.0.100-preview.5.23269.37 installed and set DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX environment variable as 2.

1.Open cmd.exe form %windir%\System32
2.Input ‘dotnet tool install –g dotnet-snow’
3.Press keyboard ‘Enter’
4.Input ‘dotnet-snow’
5.Press keyboard ‘Enter’

Expected behavior

A snowing window will be opened.

Actual behavior

The window doesn't be opened and will get following exception in command prompt window:

Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> Portable.Xaml.XamlObjectWriterException: Could not convert object 'F1 M 38,20.5833C 42.9908,20.5833 47.4912,22.6825 50.6667,26.046L 50.6667,17.4167L 55.4166,22.1667L 55.4167,34.8333L 42.75,34.8333L 38,30.0833L 46.8512,30.0833C 44.6768,27.6539 41.517,26.125 38,26.125C 31.9785,26.125 27.0037,30.6068 26.2296,36.4167L 20.6543,36.4167C 21.4543,27.5397 28.9148,20.5833 38,20.5833 Z M 38,49.875C 44.0215,49.875 48.9963,45.3932 49.7703,39.5833L 55.3457,39.5833C 54.5457,48.4603 47.0852,55.4167 38,55.4167C 33.0092,55.4167 28.5088,53.3175 25.3333,49.954L 25.3333,58.5833L 20.5833,53.8333L 20.5833,41.1667L 33.25,41.1667L 38,45.9167L 29.1487,45.9167C 31.3231,48.3461 34.483,49.875 38,49.875 Z ' (of type System.String) to {clr-namespace:Avalonia.Media;assembly=Avalonia.Visuals}Geometry: Unable to load DLL 'libSkiaSharp' or one of its dependencies: The specified module could not be found. (0x8007007E)
 ---> System.DllNotFoundException: Unable to load DLL 'libSkiaSharp' or one of its dependencies: The specified module could not be found. (0x8007007E)
   at SkiaSharp.SkiaApi.sk_path_new()
   at SkiaSharp.SKPath..ctor()
   at Avalonia.Skia.StreamGeometryImpl.Open()
   at Avalonia.Media.StreamGeometry.Open()
   at Avalonia.Media.StreamGeometry.Parse(String s)
   at Avalonia.Markup.Xaml.Converters.GeometryTypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at Portable.Xaml.XamlObjectWriterInternal.GetCorrectlyTypedValue(XamlMember xm, XamlType xt, Object value)
   --- End of inner exception stack trace ---
   at Portable.Xaml.XamlObjectWriterInternal.GetCorrectlyTypedValue(XamlMember xm, XamlType xt, Object value)
   at Portable.Xaml.XamlObjectWriterInternal.StoreAppropriatelyTypedValue(ObjectState state, MemberAndValue ms, Object obj, Object keyObj)
   at Portable.Xaml.XamlObjectWriterInternal.StoreAppropriatelyTypedValue(Object obj, Object keyObj)
   at Portable.Xaml.XamlObjectWriterInternal.OnWriteValue(Object value)
   at Portable.Xaml.XamlWriterInternalBase.WriteValue(Object value)
   at Portable.Xaml.XamlObjectWriter.WriteValue(Object value)
   at Portable.Xaml.XamlWriter.WriteNode(XamlReader reader)
   at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.LoadFromReader(XamlReader reader, AvaloniaXamlContext context)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Stream stream, Object rootInstance, Uri uri)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Type type, Object rootInstance)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Object obj)
   at AvaloniaCoreSnow.MainWindow.InitializeComponent() in S:\W-old\let-it-snow\AvaloniaCoreSnow\MainWindow.xaml.cs:line 27
   at AvaloniaCoreSnow.MainWindow..ctor() in S:\W-old\let-it-snow\AvaloniaCoreSnow\MainWindow.xaml.cs:line 19
   at System.RuntimeType.CreateInstanceOfT()
   --- End of inner exception stack trace ---
   at System.RuntimeType.CreateInstanceOfT()
   at System.Activator.CreateInstance[T]()
   at Avalonia.Controls.AppBuilderBase`1.Start[TMainWindow](Func`1 dataContextProvider)
   at AvaloniaCoreSnow.App.Main(String[] args) in S:\W-old\let-it-snow\AvaloniaCoreSnow\App.xaml.cs:line 19
!

Regression?

Yes.

Verify Scenarios:

  1. Windows10 21h2 x64 + dotnet-sdk-8.0.100-preview.5.23269.37: Fail
  2. Windows10 21h2 x64 + dotnet-sdk-8.0.100-preview.5.23265.7: Pass
  3. Windows10 21h2 x64 + dotnet-sdk-7.0.300: Pass
  4. Windows10 21h2 x64 + dotnet-sdk-6.0.409: Pass

Known Workarounds

No response

Configuration

Application Name: dotnet-snow
OS: Windows 10 21H2
CPU: X64
.NET Build Number: dotnet-sdk-8.0.100-preview.5.23269.37
Also can check this issue at https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1822944

Other information

Findings:
If we copy the libSkiaSharp.dll from "%userprofile%.dotnet\tools.store\dotnet-snow\1.0.1\dotnet-snow\1.0.1\tools\netcoreapp2.1\any\runtimes\win7-x64\native" to "%userprofile%.dotnet\tools.store\dotnet-snow\1.0.1\dotnet-snow\1.0.1\tools\netcoreapp2.1\any", the app launch successful.

@dotnet-actwx-bot @dotnet/compat

@ghost ghost added the untriaged New issue has not been triaged by the area owner label May 22, 2023
@vitek-karas
Copy link
Member

@elinor-fung this is very likely due to the RID graph changes:

f we copy the libSkiaSharp.dll from "%userprofile%.dotnet\tools.store\dotnet-snow\1.0.1\dotnet-snow\1.0.1\tools\netcoreapp2.1\any\runtimes\win7-x64\native" to "%userprofile%.dotnet\tools.store\dotnet-snow\1.0.1\dotnet-snow\1.0.1\tools\netcoreapp2.1\any", the app launch successful.

The tool uses very old Avalonia/SkiaSharp, more recent versions will not have this problem as SkiaSharp switched to portable RIDs.

Not sure if this warrants any changes on the design, but we might want to consider better errors (as it's really hard to match the failure to the change without knowing what's going on).

@ghost
Copy link

ghost commented May 22, 2023

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

When launching dotnet-snow global tool, it cannot load the native assembly named "libSkiaSharp.dll" on dotnet sdk version 8.0.100-preview.5.23269.37.

Reproduction Steps

The machine only has 8.0.100-preview.5.23269.37 installed and set DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX environment variable as 2.

1.Open cmd.exe form %windir%\System32
2.Input ‘dotnet tool install –g dotnet-snow’
3.Press keyboard ‘Enter’
4.Input ‘dotnet-snow’
5.Press keyboard ‘Enter’

Expected behavior

A snowing window will be opened.

Actual behavior

The window doesn't be opened and will get following exception in command prompt window:

Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> Portable.Xaml.XamlObjectWriterException: Could not convert object 'F1 M 38,20.5833C 42.9908,20.5833 47.4912,22.6825 50.6667,26.046L 50.6667,17.4167L 55.4166,22.1667L 55.4167,34.8333L 42.75,34.8333L 38,30.0833L 46.8512,30.0833C 44.6768,27.6539 41.517,26.125 38,26.125C 31.9785,26.125 27.0037,30.6068 26.2296,36.4167L 20.6543,36.4167C 21.4543,27.5397 28.9148,20.5833 38,20.5833 Z M 38,49.875C 44.0215,49.875 48.9963,45.3932 49.7703,39.5833L 55.3457,39.5833C 54.5457,48.4603 47.0852,55.4167 38,55.4167C 33.0092,55.4167 28.5088,53.3175 25.3333,49.954L 25.3333,58.5833L 20.5833,53.8333L 20.5833,41.1667L 33.25,41.1667L 38,45.9167L 29.1487,45.9167C 31.3231,48.3461 34.483,49.875 38,49.875 Z ' (of type System.String) to {clr-namespace:Avalonia.Media;assembly=Avalonia.Visuals}Geometry: Unable to load DLL 'libSkiaSharp' or one of its dependencies: The specified module could not be found. (0x8007007E)
 ---> System.DllNotFoundException: Unable to load DLL 'libSkiaSharp' or one of its dependencies: The specified module could not be found. (0x8007007E)
   at SkiaSharp.SkiaApi.sk_path_new()
   at SkiaSharp.SKPath..ctor()
   at Avalonia.Skia.StreamGeometryImpl.Open()
   at Avalonia.Media.StreamGeometry.Open()
   at Avalonia.Media.StreamGeometry.Parse(String s)
   at Avalonia.Markup.Xaml.Converters.GeometryTypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at Portable.Xaml.XamlObjectWriterInternal.GetCorrectlyTypedValue(XamlMember xm, XamlType xt, Object value)
   --- End of inner exception stack trace ---
   at Portable.Xaml.XamlObjectWriterInternal.GetCorrectlyTypedValue(XamlMember xm, XamlType xt, Object value)
   at Portable.Xaml.XamlObjectWriterInternal.StoreAppropriatelyTypedValue(ObjectState state, MemberAndValue ms, Object obj, Object keyObj)
   at Portable.Xaml.XamlObjectWriterInternal.StoreAppropriatelyTypedValue(Object obj, Object keyObj)
   at Portable.Xaml.XamlObjectWriterInternal.OnWriteValue(Object value)
   at Portable.Xaml.XamlWriterInternalBase.WriteValue(Object value)
   at Portable.Xaml.XamlObjectWriter.WriteValue(Object value)
   at Portable.Xaml.XamlWriter.WriteNode(XamlReader reader)
   at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.LoadFromReader(XamlReader reader, AvaloniaXamlContext context)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Stream stream, Object rootInstance, Uri uri)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Type type, Object rootInstance)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Object obj)
   at AvaloniaCoreSnow.MainWindow.InitializeComponent() in S:\W-old\let-it-snow\AvaloniaCoreSnow\MainWindow.xaml.cs:line 27
   at AvaloniaCoreSnow.MainWindow..ctor() in S:\W-old\let-it-snow\AvaloniaCoreSnow\MainWindow.xaml.cs:line 19
   at System.RuntimeType.CreateInstanceOfT()
   --- End of inner exception stack trace ---
   at System.RuntimeType.CreateInstanceOfT()
   at System.Activator.CreateInstance[T]()
   at Avalonia.Controls.AppBuilderBase`1.Start[TMainWindow](Func`1 dataContextProvider)
   at AvaloniaCoreSnow.App.Main(String[] args) in S:\W-old\let-it-snow\AvaloniaCoreSnow\App.xaml.cs:line 19
!

Regression?

Yes.

Verify Scenarios:

  1. Windows10 21h2 x64 + dotnet-sdk-8.0.100-preview.5.23269.37: Fail
  2. Windows10 21h2 x64 + dotnet-sdk-8.0.100-preview.5.23265.7: Pass
  3. Windows10 21h2 x64 + dotnet-sdk-7.0.300: Pass
  4. Windows10 21h2 x64 + dotnet-sdk-6.0.409: Pass

Known Workarounds

No response

Configuration

Application Name: dotnet-snow
OS: Windows 10 21H2
CPU: X64
.NET Build Number: dotnet-sdk-8.0.100-preview.5.23269.37
Also can check this issue at https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1822944

Other information

Findings:
If we copy the libSkiaSharp.dll from "%userprofile%.dotnet\tools.store\dotnet-snow\1.0.1\dotnet-snow\1.0.1\tools\netcoreapp2.1\any\runtimes\win7-x64\native" to "%userprofile%.dotnet\tools.store\dotnet-snow\1.0.1\dotnet-snow\1.0.1\tools\netcoreapp2.1\any", the app launch successful.

@dotnet-actwx-bot @dotnet/compat

Author: Junjun-zhao
Assignees: -
Labels:

area-Interop-coreclr, area-Host, untriaged

Milestone: -

@vitek-karas
Copy link
Member

@Junjun-zhao - it's a by design breaking change: dotnet/docs#35398

Forcing apps to run on latest runtime via the DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX can break the app, that's what major versions are for.

@PriyaPurkayastha
Copy link

Thanks @vitek-karas. @Junjun-zhao is part of the .NET Appcompat team and we use the roll forward switch for runtime compatibility testing with 3rd party apps. The goal is to identify any issues customers might come across with latest runtime and identify if it is an intentional breaking change and to understand the impact and provide mitigations/revisit the decision/reduce breaking nature etc. For example, it is valuable feedback that you have provided regarding better error handling so that it makes it easier for customers to figure out what change caused the break and what they need to do at their end to get their app working again.
@Junjun-zhao please look into upgrading the tool to latest version.

@Junjun-zhao
Copy link
Member Author

Thank you @vitek-karas for looking into this issue and your quickly response.

@PriyaPurkayastha This is a .NET Core Global Tool that we can't upgrade it. dotnet-snow did not have new version Nuget package these years.
We checked that when using its recent source, it will not have this problem because it has switched to portable RIDs same as vitek-karas said.

@Junjun-zhao
Copy link
Member Author

Close it as it is by design according to the above comment.

@Junjun-zhao - it's a by design breaking change: dotnet/docs#35398

@ghost ghost removed the untriaged New issue has not been triaged by the area owner label May 31, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants