Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Why does Xamarin suddenly not understand any project anymore

I have been working on several projects this week flawlessly. I didn't change anything ( I didn't even restart Xamarin or my pc) but suddenly Xamarin says there are faults in all my projects and all projects I create.

`
using Android.OS;
using Android.App;
using Android.Widget;
using Android.Graphics;

[ActivityAttribute(Label = "Hello", MainLauncher = true)]
public class HalloApp : Activity
{
protected override void OnCreate(Bundle b)
{
MainActivity.OnCreate(base, b);

    TextView screen;
    screen = new TextView(this);
    screen.Text     = "Hello!";
    screen.TextSize = 80;
    screen.SetBackgroundColor(Color.Yellow);
    screen.SetTextColor      (Color.DarkBlue);

    this.SetContentView(screen);
}

}
`
Most simple example is this. I am so sure there is nothing wrong with this. But I get the following error messages:
1. b. parameter name differs in base declaration.
2. Mainactivity: The name 'mainactivity' does not exist in the current context.
3. base: error. use of keyword 'base' is not valid in this context.

Has anyone got any idea if there is some setting that suddenly has gone missing or something?

Tagged:

Answers

  • JimBennettJimBennett GBXamarin Team, Insider, University, Developer Group Leader ✭✭✭✭

    Shouldn't your OnCreate have:

    base.OnCreate(b);

    instead of

    MainActivity.OnCreate(base, b);

  • Wim123Wim123 NLMember

    @JimBennett said:
    Shouldn't your OnCreate have:

    base.OnCreate(b);

    instead of

    MainActivity.OnCreate(base, b);

    Thanks for your answer. I didn't make any difference though. I did find a temporary solve. I cannot have multiple projects open in one solution. If I do have multiple projects open in the same solution, Xamarin will tell me that there are errors which aren't there if I have only one individual project open. I don't know why this is, as it has not been always like this. Anyways, temporary solution will do fine.

Sign In or Register to comment.