xamarin / SignaturePad

MIT License
245 stars 150 forks source link

Signature Pad not working in UWP Projects after Fall Creators Update if debugging with Visual Studio on Local Machine #105

Open mahop-net opened 6 years ago

mahop-net commented 6 years ago

If trying to display a Signature pad I get the following exception: The used device feature is not supported on this system.

Maybe the problem is, that inkcanvas.InkPresenter.InputDeviceTypes default is set to pen only...???

See section remarks under: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.inkcanvas

Remarks By default, the InkCanvas does not support ink input from devices other than pen. You must specify support for other devices through the InputDeviceTypes of an InkPresenter object.

Stack Trace:

   at Windows.UI.Xaml.Controls.InkCanvas..ctor()
   at Xamarin.Controls.SignaturePadCanvasView.Initialize()
   at SignaturePad.Forms.SignaturePadCanvasRenderer.OnElementChanged(ElementChangedEventArgs`1 e)
   at Xamarin.Forms.Platform.UWP.VisualElementRenderer`2.SetElement(VisualElement element)
   at Xamarin.Forms.Platform.UWP.Platform.CreateRenderer(VisualElement element)
   at Xamarin.Forms.Platform.UWP.VisualElementPackager.OnChildAdded(Object sender, ElementEventArgs e)
   at Xamarin.Forms.Platform.UWP.VisualElementPackager.Load()
   at Xamarin.Forms.Platform.UWP.VisualElementRenderer`2.SetElement(VisualElement element)
   at Xamarin.Forms.Platform.UWP.Platform.CreateRenderer(VisualElement element)
   at Xamarin.Forms.Platform.UWP.VisualElementPackager.OnChildAdded(Object sender, ElementEventArgs e)
   at Xamarin.Forms.Platform.UWP.VisualElementPackager.Load()
   at Xamarin.Forms.Platform.UWP.VisualElementRenderer`2.SetElement(VisualElement element)
   at Xamarin.Forms.Platform.UWP.Platform.CreateRenderer(VisualElement element)
   at Xamarin.Forms.Platform.UWP.VisualElementPackager.OnChildAdded(Object sender, ElementEventArgs e)
   at Xamarin.Forms.Element.OnChildAdded(Element child)
   at Xamarin.Forms.VisualElement.OnChildAdded(Element child)
   at Xamarin.Forms.Layout`1.OnChildAdded(Element child)
   at Xamarin.Forms.Layout.OnInternalAdded(View view)
   at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   at System.Collections.ObjectModel.Collection`1.Add(T item)
   at Xamarin.Forms.ObservableWrapper`2.Add(TRestrict item)
mattleibow commented 6 years ago

Thanks for reporting this, I will investigate.

mattleibow commented 6 years ago

I had a look at this and was not able to reproduce it. What device are you using? Maybe is has no touch/pen support? I have been testing on a Surface Book and Lumia 950 XL without issues.

mahop-net commented 6 years ago

Yes, my Desktop has no touch nor pen, but still the SignaturePad was working before the Fall Creators Update. I could perfectly paint with the mouse on the signature area...???

mahop-net commented 6 years ago

Just as an info: The FCU broke more things on my machine. It was installing an NVIDI Driver wich has no 3D capabilities and lets crash most apps using advanced grafic stuff like games. Reinstalling an older version provided by NVIDIA made things a little better but still apps like paint.net and all 3D apps are not working any more... After trying a lot, I gave up and installed a Windows 7 for gaming and 3D to a small partition...

mattleibow commented 6 years ago

@Hopfenspirger FCU broke my machine and I had to reset (this is why I was offline for a few days). I also had a machine that just can't do any 3D graphics/games properly anymore.

I am thinking the InkCanvas is using the GPU, not the CPU - especially in the light of this: #104 The chances are if your 3D isn't right, the ink won't work. As this is supposedly the same control used in Edge or the ink workspace, are you able to test if those apps work fine?

mahop-net commented 6 years ago

@mattleibow: The note feature of Edge and also all Ink Workspace Apps are working on my Desktop. I can draw with the mouse... (Also OneNote is working)

But InkCanvas is still displaying the error as soon as added to a Window in UWP Projects...???

mahop-net commented 6 years ago

As an info: On a normal UWP Project (not Xamarin) InkCanvas is also NOT working any more.

Code:

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" >
        <Grid Background="Aquamarine">
            <InkCanvas  />
        </Grid>
    </Grid>

Error:

Windows.UI.Xaml.Markup.XamlParseException occurred
  HResult=0x802B000A
  Message=Der Text zu diesem Fehlercode wurde nicht gefunden.

Cannot create instance of type 'Windows.UI.Xaml.Controls.InkCanvas' [Line: 12 Position: 14]
  Source=
  StackTrace:
   at Windows.UI.Xaml.Application.LoadComponent(Object component, Uri resourceLocator, ComponentResourceLocation componentResourceLocation)
   at InkCanvasTester.MainPage.InitializeComponent() in D:\TFS\W1\trunk\MaHop.Net.cleverDev.Learning\InkCanvasTester\InkCanvasTester\obj\x86\Debug\MainPage.g.i.cs:line 33
   at InkCanvasTester.MainPage..ctor() in D:\TFS\W1\trunk\MaHop.Net.cleverDev.Learning\InkCanvasTester\InkCanvasTester\MainPage.xaml.cs:line 27
   at InkCanvasTester.InkCanvasTester_XamlTypeInfo.XamlTypeInfoProvider.Activate_0_MainPage() in D:\TFS\W1\trunk\MaHop.Net.cleverDev.Learning\InkCanvasTester\InkCanvasTester\obj\x86\Debug\XamlTypeInfo.g.cs:line 178
   at InkCanvasTester.InkCanvasTester_XamlTypeInfo.XamlUserType.ActivateInstance() in D:\TFS\W1\trunk\MaHop.Net.cleverDev.Learning\InkCanvasTester\InkCanvasTester\obj\x86\Debug\XamlTypeInfo.g.cs:line 333

I reported the Problem now over Visual Studio. If I get a solution there I will report it here... https://developercommunity.visualstudio.com/content/problem/149528/uwp-projects-inkcanvas-not-working-any-more-after.html

mattleibow commented 6 years ago

That is news - I suppose. So I think this is not SignaturePad directly, but the InkCanvas. Hopefully this is something that can be fixed with a driver update or windows update.

mahop-net commented 6 years ago

I found a workaround for this problem: If I tell the grafik card driver to not use the grafik Card Processor for 3D Display the problem is gone... (NVIDIA Control Panel - 3D Display Management - Used Grafikprozessor - Deselect the HighPreformanceNVIDIA Grafik Prozessor and use a different setting like on board grafik card or whatever is available on your system.)

So the problem definitely is outside the scope of SignaturePad...

mattleibow commented 6 years ago

Thanks for investigating this. I had issues with my graphics (BSoD) after updating to FCU - it appears that after I downloaded the latest drivers it is fixed...