This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 56895 - VS2017 stable - previewer exception crash- no method found Button_click on type
Summary: VS2017 stable - previewer exception crash- no method found Button_click on type
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Stephane Delcroix
URL:
Depends on:
Blocks:
 
Reported: 2017-05-26 22:01 UTC by Stanley Broo
Modified: 2017-07-07 04:47 UTC (History)
6 users (show)

See Also:
Tags: AC
Is this bug a regression?: ---
Last known good build:


Attachments
printscreen that the clicked event actually exists :-) ..previewer cant see it? (352.58 KB, application/pdf)
2017-05-26 22:01 UTC, Stanley Broo
Details

Description Stanley Broo 2017-05-26 22:01:12 UTC
Created attachment 22524 [details]
printscreen that the clicked event actually exists :-) ..previewer cant see it?

Exception occured An exception occured when rendering the control, No method found Button_Clicked.
Comment 1 Alan McGovern 2017-05-29 10:05:30 UTC
Can we adjust forms to silently ignore missing event handlers when running under the previewer?
Comment 2 Stanley Broo 2017-05-30 12:25:30 UTC
Very easy to reproduce the bug

vs2017 proffessional 
Xamarin updater - latest Form templates
latest everyting..

1. Create new Xamarin Forms PCL
2. In the MainPage.xaml paste som XAML code that includes a Button Clicked eventhandler.
3. The previewer will throw an exception ..no handler found
4. Add the clicked eventhandler from XAML page ..navigate to eventhandler.
5. check that the handler is in the codebehind ..save all files.

..Exception still there.

..remove the handlers from XAML
..previewer now works
..add the clicked handlers for the buttons again
..previewer now works with the handlers in the XAML
Comment 3 Stephane Delcroix 2017-05-30 13:49:29 UTC
this is a previewer issue, but we can workaround it in XF

https://github.com/xamarin/Xamarin.Forms/pull/946
Comment 4 Stanley Broo 2017-05-30 14:58:57 UTC
Same for Tapped Image ...PREVIEWER CANT FIND THE HANDLER?, It is there and we can navigate to it?

But for Tapped ..we can't do the workaround as for Button Clicked events
 ..removing and adding tappedevent wont make the previewer refresh
..the previewer never finds the tapped event in codebehind?


<Image x:Name="img1" HeightRequest="32" Margin="10" Source="map.png" >
                <Image.GestureRecognizers>
                    <TapGestureRecognizer 
                                Tapped="img1_Tapped"
                                NumberOfTapsRequired="1" />
                </Image.GestureRecognizers>
            </Image>
Comment 5 Stanley Broo 2017-05-30 15:13:25 UTC
Some weird stuff going on with the background process of the previewer also.
This happens all the time working with the previewer in VS2017 proffessional
latest XF nuget STABLE and latest XF updater.


cxpf.dll is our xamarin PCL project 

Error list:

Severity	Code	Description	Project	File	Line	Suppression State
Error		Unable to copy file "obj\Debug\cxpf.dll" to "bin\Debug\cxpf.dll". The process cannot access the file 'bin\Debug\cxpf.dll' because it is being used by another process.	cxpf			


Severity	Code	Description	Project	File	Line	Suppression State
Error		Could not copy "obj\Debug\cxpf.dll" to "bin\Debug\cxpf.dll". Exceeded retry count of 10. Failed.	cxpf
Comment 6 Stephane Delcroix 2017-06-01 07:25:24 UTC
this will be included in 2.3.6-pre1, 2.3.5 and in services releases for 2.3.4 (if any)
Comment 7 Saurabh Paunikar 2017-06-30 13:13:17 UTC
I have used code 

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:App3"
             x:Class="App3.MainPage">

	<Label Text="Welcome to Xamarin Forms!" 
           VerticalOptions="Center" 
           HorizontalOptions="Center" />
    <Button Text="Click ME" Clicked="Button_Clicked">
        
    </Button>

</ContentPage>


And event Handler is not available in code behind,Still I am able to render Previewer. Is this expected behavior

Verified on Xamarin.form version 2.3.5.255-pre5
Comment 8 Jason Smith 2017-07-06 16:36:23 UTC
This is expected now yes
Comment 9 Saurabh Paunikar 2017-07-07 04:47:10 UTC
Verified on Xamarin.form version 2.3.5.255-pre5

Note You need to log in before you can comment on or make changes to this bug.