Bug 58088 - [generator] Fails to generate code/file when [Protocol (Name="A")] is used
Summary: [generator] Fails to generate code/file when [Protocol (Name="A")] is used
Status: RESOLVED INVALID
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: XI 10.99 (xcode9)
Hardware: PC Mac OS
: --- major
Target Milestone: Xcode9
Assignee: Alex Soto [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-07-11 21:23 UTC by Sebastien Pouliot
Modified: 2017-07-12 02:15 UTC (History)
1 user (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Sebastien Pouliot 2017-07-11 21:23:27 UTC
The current code for 

	[Protocol]
	interface WKHttpCookieStoreObserver
	{
		[Export ("cookiesDidChangeInCookieStore:")]
		void CookiesDidChangeInCookieStore (WKHttpCookieStore cookieStore);
	}

is incorrect since the native name is different. However using

	[Protocol (Name = "WKHTTPCookieStoreObserver")

result in build failures like

> error CS0246: The type or namespace name `IWKHttpCookieStoreObserver' could not be found. Are you missing an assembly reference?

It seems the file for the protocol type is not generated.

This is a pattern we've been using elsewhere but _maybe_ it's the first time without a `[Model]` ?
Comment 1 Alex Soto [MSFT] 2017-07-11 22:02:10 UTC
Weird, I remember using this elsewhere without a [Model], will test and report back
Comment 2 Alex Soto [MSFT] 2017-07-12 00:05:21 UTC
@Sebastien it works for me

[Mac (10,13), iOS (11,0)]
[Protocol (Name = "WKHTTPCookieStoreObserver")]
interface WKHttpCookieStoreObserver
{
    [Export ("cookiesDidChangeInCookieStore:")]
    void CookiesDidChangeInCookieStore (WKHttpCookieStore cookieStore);
}

Any chance you can double check again?
Comment 3 Alex Soto [MSFT] 2017-07-12 00:12:32 UTC
@sebastien I think I know what happened, you missed the closing bracket

> [Protocol (Name = "WKHTTPCookieStoreObserver")

This will result in just a warning

> wkwebkit.cs(129,2): warning CS0658: `interface' is invalid attribute target. All attributes in this attribute section will be ignored

and then you will get `CS0246` error `The type or namespace name `IWKHttpCookieStoreObserver' could not be found. Are you missing an assembly reference?` because the interface is missing the `[Protocol]` information.

Please let me know if it works for you :)
Comment 4 Alex Soto [MSFT] 2017-07-12 02:04:09 UTC
Closing because of the next slack comment: https://xamarinhq.slack.com/archives/C03CCJNR7/p1499822329984617

Sebastien Pouliot
[8:18 PM] 
@dalexsoto yes that was it