Bug 42380 - The type or namespace 'GeneratedCode' could not be found CS0246
Summary: The type or namespace 'GeneratedCode' could not be found CS0246
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-07-06 09:18 UTC by John Nolan
Modified: 2016-07-06 14:42 UTC (History)
6 users (show)

Tags: GeneratedCode attribute, build error
Is this bug a regression?: ---
Last known good build:


Attachments
Showing Error list for GeneratedCodeAttribute and System namespaces (52.48 KB, image/png)
2016-07-06 09:18 UTC, John Nolan
Details
Showing GeneratedCode namespace error (51.41 KB, image/png)
2016-07-06 09:18 UTC, John Nolan
Details
Showing reference list for my Xamarin.iOS project (9.92 KB, image/png)
2016-07-06 09:59 UTC, John Nolan
Details
Showing origin of error within a designer.cs file. (currently the error is replicated in all designer files) (11.62 KB, image/png)
2016-07-06 10:03 UTC, John Nolan
Details
Correct reference list for project (9.31 KB, image/png)
2016-07-06 12:45 UTC, John Nolan
Details
Depicting configuration manager (8.63 KB, image/png)
2016-07-06 13:01 UTC, John Nolan
Details
iOS build (29.89 KB, image/png)
2016-07-06 13:07 UTC, John Nolan
Details


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 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 FIXED

Description John Nolan 2016-07-06 09:18:19 UTC
Created attachment 16584 [details]
Showing Error list for GeneratedCodeAttribute and System namespaces

Hi, 

I am unable to build my project for the iOS simulator at the moment as multiple occurrences (244+) of the notorious CS0246. Looking at my Xamarin log I cannot see any exception info nor compiler messages: 

Xamarin Information: 0 : [2016-07-06 09:23:11.3554] Xamarin - 4.1.1.3-c7sr0+34a92cd
Xamarin.VisualStudio.Activation.AccountManager Information: 0 : [2016-07-06 09:23:11.4532] VS2015 Professional
Xamarin.VisualStudio.ActivationManager Information: 0 : [2016-07-06 09:23:11.4813] No license found for iOS
Xamarin.VisualStudio.ActivationManager Information: 0 : [2016-07-06 09:23:11.4863] Running license sync for iOS
Xamarin.VisualStudio.ActivationManager Information: 0 : [2016-07-06 09:23:11.4933] No license found for Android
Xamarin.VisualStudio.ActivationManager Information: 0 : [2016-07-06 09:23:11.5053] Running license sync for Android
Xamarin.VisualStudio.ActivationManager Information: 0 : [2016-07-06 09:23:13.4565] Updated license: Android VSProfessional
Xamarin.VisualStudio.ActivationManager Information: 0 : [2016-07-06 09:23:14.4684] Updated license: iOS VSProfessional
Xamarin.VisualStudio.TastyPackage Information: 0 : [2016-07-06 09:23:21.8461] Hooked up SDB tracing adapter
Xamarin.VisualStudio.TastyPackage Information: 0 : [2016-07-06 09:23:21.8766] Initialization finished
Xamarin.VisualStudio.IOS.XamarinIOSPackage Warning: 0 : [2016-07-06 09:23:21.8821] Initializing Xamarin.VisualStudio.IOS.XamarinIOSPackage.
Xamarin.VisualStudio.IOS.XamarinIOSPackage Information: 0 : [2016-07-06 09:23:21.8871] MDAddinsHash: 33f406fa2dcf214012c78cb846585f062b2e1d24

Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Information: 0 : [2016-07-06 09:23:39.2165] MacServer State transition from DisconnectedState to SshConnectingState on ITSL-Administrators-MacBook-Pro.local (172.20.1.64)
Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2016-07-06 09:23:41.6944] Starting Broker 4.1.1.3 in port 55737...
Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Information: 0 : [2016-07-06 09:23:48.6532] MacServer State transition from SshConnectingState to SshConnectedState on ITSL-Administrators-MacBook-Pro.local (172.20.1.64)
Xamarin Information: 0 : [2016-07-06 09:23:48.6612] SSH Connection established with the Mac 172.20.1.64:55737
Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Information: 0 : [2016-07-06 09:23:48.7609] MacServer State transition from SshConnectedState to AgentsStartingState on ITSL-Administrators-MacBook-Pro.local (172.20.1.64)
Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Information: 0 : [2016-07-06 09:23:48.7669] Starting agents on Mac ITSL-Administrators-MacBook-Pro.local (172.20.1.64)
Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2016-07-06 09:23:49.4593] Starting Agent IDB 4.1.1.3...
Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2016-07-06 09:23:53.9762] Agent IDB 4.1.1.3 is running
Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2016-07-06 09:24:01.6050] Starting Agent Build 4.1.1.3...
Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2016-07-06 09:24:03.6504] Agent Build 4.1.1.3 is running
Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2016-07-06 09:24:14.8195] Starting Agent Designer 4.1.1.3...
Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2016-07-06 09:24:21.0924] Agent Designer 4.1.1.3 is running
Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2016-07-06 09:24:21.1084] MacServer State transition from AgentsStartingState to ConnectedState on ITSL-Administrators-MacBook-Pro.local (172.20.1.64)
Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Information: 0 : [2016-07-06 09:24:21.1164] Connected to the Mac ITSL-Administrators-MacBook-Pro.local (172.20.1.64) with Full support.
Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2016-07-06 09:24:22.0697] SSH Connection established with the Mac 172.20.1.64:55737
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:25:52.1397] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:27:22.1545] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:28:52.1543] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:30:22.1694] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:31:52.1694] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:33:22.1698] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:34:52.1835] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:36:22.1831] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:37:52.1827] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:39:22.1821] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:40:52.1817] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:42:22.1820] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:43:52.1826] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:45:22.1961] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:46:52.1954] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:48:22.1956] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:49:52.1962] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:51:22.2096] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive
System.Net.Mqtt.Client.ClientPacketListener Warning: 0 : [2016-07-06 09:52:52.2245] Client build9836johnn - No packet has been sent in 90 seconds. Sending Ping to Server to maintain Keep Alive


Here is the error list from Visual Studio:


Error	CS0246	The type or namespace name 'GeneratedCode' could not be found (are you missing a using directive or an assembly reference?) D:\Development\Client name omitted\ProjectName omitted\trunk\src\*.designer.cs


Error	CS0246	The type or namespace name 'GeneratedCodeAttribute' could not be found (are you missing a using directive or an assembly reference?) D:\Development\Client name omitted\Project Name omitted\trunk\src\*.designer.cs


There is also a CS0246 now for the namespace System.Timers? This was reference previously and did not prevent successful builds?



However the error originates within the *.designer.cs files.

Any idea how to resolve this issue as it is holding up development. Could it be that the Mac build host is missing the /Library/Developer/Monotouch or is that now obsolete. 



Windows Environment as follows:
____________________________________________________________________________________________
Microsoft Visual Studio Professional 2015
Version 14.0.25123.00 Update 2
Microsoft .NET Framework
Version 4.6.01038

Installed Version: Professional

Visual Basic 2015   00322-50000-31647-AA417
Microsoft Visual Basic 2015

Visual C# 2015   00322-50000-31647-AA417
Microsoft Visual C# 2015

Visual C++ 2015   00322-50000-31647-AA417
Microsoft Visual C++ 2015

Windows Phone SDK 8.0 - ENU   00322-50000-31647-AA417
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   5.209.60613.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 (Beta8)   14.1.11106.0
ASP.NET and Web Tools 2015.1 (Beta8)

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
For additional information, visit http://www.asp.net/

Clang with Microsoft CodeGen   14.0.25115
Clang with Microsoft CodeGen

CodeMaid   10.1.93
CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, R, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.

Common Azure Tools   1.7
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Devart SQL Complete   5.1.46
Devart dbForge SQL Complete for Visual Studio
Copyright (c) 2015 Devart. All rights reserved.
Web: http://www.devart.com/dbforge/sql/sqlcomplete 
Support: http://www.devart.com/dbforge/sql/sqlcomplete/support.html 
Ordering: http://www.devart.com/dbforge/sql/sqlcomplete/ordering.html 

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

KofePackagePackage Extension   1.0
KofePackagePackage Visual Studio Extension Detailed Info

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Microsoft Azure Tools   2.7
Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.7.30728.1602

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

NuGet Package Manager   3.4.4
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.60311.1
Microsoft SQL Server Data Tools

TypeScript   1.8.31.0
TypeScript tools for Visual Studio

Visual C++ for Cross Platform Mobile Development (Android)   14.0.25116.00
Visual C++ for Cross Platform Mobile Development (Android)

Visual C++ for Cross Platform Mobile Development (iOS)   14.0.25116.00
Visual C++ for Cross Platform Mobile Development (iOS)

Visual Studio Tools for Apache Cordova   Update 9
Visual Studio Tools for Apache Cordova

Visual Studio Tools for Universal Windows Apps   14.0.25219.00
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin   4.1.1.3 (34a92cd)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   6.1.1.1 (7db2aac)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   9.8.1.4 (3cf8aae)
Visual Studio extension to enable development for Xamarin.iOS.


MAC environment
______________________________________________________________________________________________________
Mac OS X El Capitan 10.11.5
Mono 4.4.1 (mono-4.4.0-branch-c7sr0/4747417
GTK+ 2.24.23
Xcode 7.3.1
Xamarin.iOS 9.8.1.4 c7sr0
Xamarin.Mac 2.8.1.4


Any assistance would be greatly appreciated, 

All the best, 




John
Comment 1 John Nolan 2016-07-06 09:18:48 UTC
Created attachment 16585 [details]
Showing GeneratedCode namespace error
Comment 2 John Nolan 2016-07-06 09:58:46 UTC
[GeneratedCode] is part of the System.CodeDom.Compilers.dll however I cannot see a reference to this in my Xamarin.iOS project. However, is this needed?
Comment 3 John Nolan 2016-07-06 09:59:58 UTC
Created attachment 16586 [details]
Showing reference list for my Xamarin.iOS project
Comment 4 John Nolan 2016-07-06 10:03:55 UTC
Created attachment 16587 [details]
Showing origin of error within a designer.cs file. (currently the error is replicated in all designer files)
Comment 5 John Nolan 2016-07-06 12:38:50 UTC
Any news on this? 

At present the bug is rendering Xamarin unusable for our team...

Thanks,

John
Comment 6 Sebastien Pouliot 2016-07-06 12:40:55 UTC
That's a compile time issue (before it reach our tools) so I guess you might be using an incorrect profile. Otherwise there might be something missing on the SDK shipped with XVS (reassigning bug).

Side note: https://bugzilla.xamarin.com/attachment.cgi?id=16586 shows you're referencing both monotouch.dll (classic) and Xamarin.iOS.dll (unified) which won't work (and should give you an error later).
Comment 7 John Nolan 2016-07-06 12:45:28 UTC
Hi Sebastien, 

Silly me, I added monotouch.dll to see if it fixed the error (clutching at straws) and you're right it would cause errors later down the road. I have removed the monotouch reference but it has not effected the error in any way.
Comment 8 John Nolan 2016-07-06 12:45:59 UTC
Created attachment 16590 [details]
Correct reference list for project
Comment 9 John Nolan 2016-07-06 12:59:59 UTC
Whilst I get that the error occurs at comile time it seems strange that the errors are only present within the Xamarin generated .designer.cs files. 

Looking at my profile I can see it is setup for Debug (iPhone Simulator) and supported architectures i386 and x86_64.
Comment 10 John Nolan 2016-07-06 13:01:02 UTC
Created attachment 16591 [details]
Depicting configuration manager
Comment 11 John Nolan 2016-07-06 13:07:35 UTC
Created attachment 16592 [details]
iOS build
Comment 12 John Nolan 2016-07-06 14:42:46 UTC
Hi all, 

I have just noticed that for some unexplained reason VS2015 Update 3 caused the System.dll in the following location to be removed:

/Program File (x86)/Reference Assemblies/Microsoft/Framework/Xamarin.iOS/v1.0/System.dll

Re-adding the reference enabled the project to resolve the [GeneratedCode] attribute and the project now successfully builds.


Thanks for your help Seb.