Okay, I've been searching and searching and it seems that people have somewhat similar scenarios concerning my problem, however, none of the solutions presented even offer a sound solution. I've recently installed Visual Studio 2017. I went on to test the Xamarin Android Emulator by creating an app (named "Try") with absolutely nothing on it. Mind you, this is a fresh install of Visual Studio 2017 with JDK 1.8.0_152 and Android 7.1.1 (25). Right off the bat, the build failed. I cleaned the solution and tried to build again. Fail.
I kept getting these errors:
Severity Code Description Project File Line Suppression State
Error error: <identifier> expected
package try.try; Try C:\Users\User\source\repos\Try\Try\obj\Debug\android\src\try\try\R.java 8
_______________________________________________________________________
Severity Code Description Project File Line Suppression State
Error error: class, interface, or enum expected
package try.try; Try C:\Users\User\source\repos\Try\Try\obj\Debug\android\src\try\try\R.java 8
_______________________________________________________________________
Severity Code Description Project File Line Suppression State
Error error: class, interface, or enum expected
package try.try; Try C:\Users\User\source\repos\Try\Try\obj\Debug\android\src\try\try\R.java 8
Great, so this has to have something to do with R.java 8? I go to the source and get this:
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package try.try;
public final class R {
public static final class attr {
}
public static final class id {
public static final int textureView1=0x7f040000;
}
public static final class layout {
public static final int main=0x7f020000;
}
public static final class string {
public static final int app_name=0x7f030000;
}
}
What is wrong here? I haven't even began to start coding or tinkering with Xamarin yet. Can someone please explain?
Figured it out. I don't know why, but Visual Studio 2017 put those project files in a completely different location unlike previous versions. Usually, it would have been put here: Documents>Visual Studio 2017>Projects>[Project Name]. It seems that the place you put your project is conflicting with Xamarin somehow. My suggestion would be to change the project location to what I mentioned above and then build the solution again. If that doesn't work, make a new project with the specified location and test it out. I had a similar problem and that fixed it for me.
Related
I successfully installed Visual Studio 2019 for Mac (community edition, version 8.10.14) and managed to install few other required extensions/packages for my work. These are Specflow, Specflow.NUnit, Selenium WebDriver & Server.
I added one feature file and unable to create step def for that feature file as there is no option i can see to create step def. I try and added a separate file (template is called 'specflow step definition' from right click on folder then add>new file) and it's like added sample step def for calculator sample feature. When i right click on steps in feature file it doesn't show an option to generate step defs.
This issue is only on Mac OS. The same project works perfectly fine on windows machine.
A cursory search for specflow visual studio mac seems to conclude that this is not yet available for MacOS versions of Visual Studio. On Windows, the SpecFlow extension for Visual Studio allows you to auto generate step definitions from a feature file. This does not appear to be supported on MacOs, but there is a feature request to add support.
In the meantime, stubbing out a step definition class isn't too bad. The basic shell is:
using TechTalk.SpecFlow;
[Binding]
public sealed class YourStepDefinitions
{
[Given(#"...")]
public void GivenX(...)
{
ScenarioContext.Current.Pending();
}
[When(#"...")]
public void WhenX(...)
{
ScenarioContext.Current.Pending();
}
[Then(#"...")]
public void ThenX(...)
{
ScenarioContext.Current.Pending();
}
}
The challenge is getting the regular expression right. Unfortunately, that requires knowing the step before creating the step definition.
See Step Definitions for more information.
I'm using Mac OS Catalina (10.15.3) Here is my code.
dart shows an error Only static members can be accessed in initializers
And that's it. Error doesn't go away. Even when comment everything delete everything dart continues giving that error. I don't understand. Was working in Android Studio. Exactly the same. I thought it was Android Studio problem. Because of that I downloaded VS Code but again. Here is the photo of error after I comment lines.
Please help me. It annoys me. I don't know what to do.
Edit 1:
I could reproduce the issue.
Let's say I have some StateLessWidget class
class SearchPage extends StatelessWidget {
// Whenever I try to write property beginning with type Future
Future<... // <--- Android Studio and VS Code both stop working.
// then it starts working when I restart
#override
Widget build(BuildContext context) {
return Container();
}
}
Then doesn't matter what you do. Nothing works until restart.
Here's a few things you can try :
Update VS Code.
Does flutter doctor -v contains any error message ?
Try running flutter clean
Open pubspec.yaml, right-click and "Get Packages".
Move to another channel (flutter channel beta for example) and run
flutter upgrade
Delete and reinstall Flutter and its IDE extensions
I have a problem with IntelliSense and it is driving me crazy, I kept calm for 1 month but I can't stand it anymore.
IntelliSense keeps on suggesting things that are obviously incorrect suggestions.
Let's say I have a class called "PlayerModel" and a field/parameter of that type called "playerModel".
When I start typing "player" I somehow expect that the suggestions list will start with the field/parameter and not with the class, also given that the class obviously does not contain public constants or anything I might be using.
But this is not the case, IntelliSense gives me this every time:
Obviously I want to refer to the parameter and not the class.
This doesn't work also if I need to assign a value to a field.
PlayerModel anotherPlayerModel = player...
will also suggest the class instead of that parameter. So every time I need to manually select the second (and proper) suggestion.
Please help, I think this should be common sense. Thank you!
These are my installation package details:
Microsoft Visual Studio Community 2017
Version 15.8.5
VisualStudio.15.Release/15.8.5+28010.2036
Microsoft .NET Framework
Version 4.7.02556
Installed Version: Community
C# Tools 2.9.0-beta8-63208-01
FormatDocumentOnSave 1.0
NuGet Package Manager 4.6.0
ProjectServicesPackage Extension 1.0
Visual Basic Tools 2.9.0-beta8-63208-01
Visual Studio Code Debug Adapter Host Package 1.0
Visual Studio Tools for Unity 3.8.0.7
And this is my PlayerModel class: (ignore the Unity related stuff it is not relevant to the structure of the class)
using UnityEngine;
using static Constants;
public class PlayerModel : ObjectModel {
public int userId;
public int activeItemIndex;
public int kills;
public PlayerModel(int id, Vector3 position, Quaternion rotation, float hitpoints, int userId, int activeItemIndex) : base(id, ObjectType.PLAYER, position, rotation, hitpoints) {
this.userId = userId;
this.activeItemIndex = activeItemIndex;
}
}
Please try switching your locale--as a test--from 1026 bg-BG to 1033 en-US. So, first close all instances of Visual Studio, apply the locale change, then restart Visual Studio. I suspect that this might fix the issue. If it does then you can decide which international setting you want to continue to use...
I'm trying to develop a VS extension using the Visual Adornment project template.
The extension is working on the experimental instance of VS (it simply adds a text layer on the editor window), but now I'm trying to add 2 features, with no luck:
Help/About entry for the extension
Settings page for some basic configurations
So I started to study some other extension to understand how they do that, taking as example this from Phil Haack Encourage.
No way I can get it to work. I created a class that inherits from Microsoft.VisualStudio.Shell.Package and I've decorated it with all the needed attribute to have the Help/About entry, without any success.
[PackageRegistration(UseManagedResourcesOnly = true)]
[ComVisible(true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[Guid("665d2c8c-0d47-42b6-ae34-e1db4ac2ed0f")]
public sealed class MyPackage : Package
{
public MyPackage()
{
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
}
protected override void Initialize()
{
base.Initialize();
Debug.WriteLine("Initialize MyPackage");
}
}
Not only the package is not registering, but the debug lines are not written at all, I cannot even step in with the debugger.
I took a look around the web, and any article I found sounds like this one, even following any single step, my package is not registering itself BUT, and it is the strange thing, the viewport adornment it's working as expected...
UPDATE:
I can add some details: it seems that during the build the .pkgdef file is not created at all in the debug folder, and it's not added to the VSIX file (if I open it with 7zip there's no .pkgdef)
No way I can get it to work. I created a class that inherits from Microsoft.VisualStudio.Shell.Package and I've decorated it with all the needed attribute to have the Help/About entry, without any success.
I didn't understand that part quite. You're supposed to use Visual Studio "project template" for "Visual Studio packages". That will create all the stuff necessary to build VSIX file. Start with that, if you already haven't.
By default, Visual Studio extensions(>=2013) don't load automatically. This took me few hours of debugging, but you're supposed to decorate your package with an attribute if you'd like to load when Visual Studio starts up. Alternatively, there's an option to load your VSPackage once a solution is loaded.
This is a peek of my package definition:
[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[Guid(Guids.GuidMyStudioPackageString)]
[ProvideAutoLoad(UIContextGuids.NoSolution)]
[ProvideMenuResource("Menus.ctmenu", 1)]
public sealed class MyPackage : CommonPackage
Notice the [ProvideAutoLoad(...)] option. It says that load the package once visual studio starts.
In an existing solution I added a new Test Project. In my Test Project .cs file I have a class decorated with the [TestClass] attribute and a method decorated with the [TestMethod] attribute. I have verified that in Configuration Manager the build check box is checked for the Test Project (as my google search has revealed was the problem for others with this issue). I have set Test Project as my start up project for the solution. When I try to start the test I get "Can not start test project because the project does not contain any tests". I am really new to unit testing. What am I missing?
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Whole bunch of stuff
Assert.Inconclusive("Done");
}
}
Update: So I opened a new instance of VS, went to File => New => Project => Test Project. Did not touch or edit anything. Went straight to the cs file and here are its contents in its entirety:
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace TestProject2
{
public class Inspection
{
public bool SubmitInsp()
{
return true;
}
}
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Inspection insp = new Inspection();
bool result = insp.SubmitInsp();
Assert.IsTrue(result);
}
}
}
Same error about the project not containing any test when I try to start it. Also found this in the build output "Could not load file or assembly '~\my documents\visual studio 2010\Projects\TestProject2\bin\Debug\TestProject2.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
I don't know that units tests get much simpler than this. What the heck???
I've had the same problem, when tests in an working test project suddenly weren't recognized anymore.
Comparing the project file with one from another working test project showed me that the <ProjectTypeGuids> node was missing from the main <PropertyGroup> node.
Adding this line inside the <PropertyGroup> node solved my problem:
C#:
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
VB:
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
I was able to get this to work by modifying the devenv.exe configuration file found here:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config.
Add the following line to the <runtime> section, then restart Visual Studio:
<loadFromRemoteSources enabled = "true" />
(Here is the link that helped me)
The FrstCBC's anwser did not worked for me.
I am on a VirtualBox machine with Windows 7 64 bits and Visual Studio 2012.
I had to move the output to a local folder : open the unit tests project properties and in the Build tab, browse the Output path to a local folder. The tests are now detected and can be run.
Test Projects saved to a network folder or anywhere locally on my computer have this issue. Created another Test Project and saved it to my flash drive, works just fine. I don't know if it is because my machine is 64 bit or because its a virtual machine or what, but I guess I just need to test everything on external storage devices.
For me it was just that my class and method weren't public (I realize the poster did have public, but I found this post by Googling "testclass testmethod margin icons missing"). Dumb mistake on my part, but maybe it will help others.
Verify that all the .cs files are marked as Compile in the Properties window. If it is marked as Content then you will hit this issue.