WinForms: improve the designer experience for .NET Framework apps#4425
WinForms: improve the designer experience for .NET Framework apps#4425swharden merged 6 commits intoScottPlot:mainfrom
Conversation
|
Wow @CoderPM2011, great find! This is fantastic! 🚀 |
|
Hi @CoderPM2011 - I'm curious, how are you testing this? I have a SDK project that I set to target <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net48</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<SignAssembly>True</SignAssembly>
<LangVersion>latest</LangVersion>
<AssemblyOriginatorKeyFile>../../Key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\ScottPlot5 Controls\ScottPlot.OpenGL\ScottPlot.OpenGL.csproj" />
<ProjectReference Include="..\..\ScottPlot5 Controls\ScottPlot.WinForms\ScottPlot.WinForms.csproj" />
<ProjectReference Include="..\..\ScottPlot5\ScottPlot.csproj" />
</ItemGroup>
</Project>namespace Sandbox.WinForms;
static class Program
{
[STAThread]
static void Main()
{
#if NETFRAMEWORK
#else
ApplicationConfiguration.Initialize();
#endif
Application.Run(new Form1());
}
} |
|
Oof, it seems to be failing for me the same way when I try to load any control (including a blank one) from the |
I first have the |
Ah, interesting! I've only tested this running from source which may explain why I've had difficulty reaching a solution. Thanks again for your feedback and this PR! I'm excited to give this a try soon 👍 |
I'm guessing that the reason for the failure to work from the source code may be related to multiple target frameworks or whether VS itself is running properly. 🤔 |
|
I tested the pattern directly referenced in the source project. If I change |
Wow, that was the magic piece of information! I got it working now and will refine the error screen a bit. This is what I'm thinking of having it show when the DLL fails to load: ... but if this is successful after the next release, I'm tempted to use |
|
I'll merge this now, but note that it has been modified to only show this message if design time mode is detected. The reason is I don't want that message accidentally showing up on client machines of a third party publishes an app using ScottPlot. Instead, we can explore adding a new PR to display a user-facing message (not aimed at developers necessarily) for when the DLL cannot be located. This is a semi-common issue actually, unrelated to running inside visual studio, because sometimes people build an app but forget to include all those platform specific subfolders (e.g., I once published a WinForms app and omitted the arm folders but someone with one of those new windows arm tablet PCs couldn't load the app) |



resolve #4362
After investigation, it was found that
FormsPlotinheritsFormsPlotBase, and its memberPlotwill call the method inSkiaSharp, soFormsPlotBasealso needs to be adjusted.Adjusted to detect whether
FormsPlotBasethrows an exception thatlibSkiaSharp.dllcannot be found, and display the current version and error message on the control.like this

I found that I had to be careful whether
FormsPlotproperties were set inForm.Designer.cs.If the property calls
SkiaSharp, it may also affect the control and cause an error.🤔