I'm trying to use toast notifications in my Windows app, and I'm using the following code...
new ToastContentBuilder()
.AddText("Hello");
But I'm getting the following error...
error CS0246: The type or namespace name 'ToastContentBuilder' could not be found (are you missing a using directive or an assembly reference?)
You need to install the Microsoft.Toolkit.Uwp.Notifications NuGet package!
In Visual Studio's solution explorer, right click your project, click "Manage NuGet Packages", search for "uwp notifications" and install the Microsoft.Toolkit.Uwp.Notifications package.
Then, IntelliSense should suggest adding the following using statement...
using Microsoft.Toolkit.Uwp.Notifications;
After that, everything should be working!
Related
I right click on my feature file I should get the option to Generate step definitions. It is not there in the context menu.
I did a search and it says to install specrun for nunit.
I tried installing SpecRun.Nunit from Manage NuGet Packages.
I get the error:
Severity Code Description Project File Line Suppression State
Error Unable to load the service index for source
http://packagesource.
An error occurred while sending the request.
The remote name could not be resolved: 'packagesource' 0
I have Visual Studio Enterprise 2017 isntalled.
I have installed Selenium-webdriver, Specflow
How can I solve this issue please, thanks.
You need to install the specflow nuget package as well as the Visual Studio integration package from the menu item Tools -> "Extensions and Updates..."
Here's what I have to do to make the option appear in the context menu in VS2019.
I installed Specflow normally, from Extensions-> Manage Extensions,
then searched for Specflow for Visual Studio 2019.
Installed the package and re-started VS.
Then I created a new project, a C# Test.
Once the initial setup is ready, from the context menu in the
Solution Explorer I went "Add->New Item..." and selected "SpecFlow
Feature File", I typed in the info I wanted in my Feature file.
Over any of the Gherkin lines, I right clicked to get the context
menu and selected "Go to Definition". A dialog displays, telling me
that there is not a match, but I can save the lines in clipboard. I
selected Yes.
Then again on the Solution Explorer (like step 4), Right Click
"Add->New Item...", but now selected "SpecFlow Step Definition". The
Step Definition will be that for the calculator test.
Now here's the trick:
Delete all of the steps, leaving the main class empty.
Like this:
using System;
using TechTalk.SpecFlow;
namespace SpecflowFirst
{
[Binding]
public class SpecFlowFeature1Steps
{
}
}
Then paste the snippet you got from the dialog box inside the main
class
Like this:
using System;
using TechTalk.SpecFlow;
namespace SpecflowFirst
{
[Binding]
public class SpecFlowFeature1Steps
{
[Given(#"I navigated to the github login page")]
public void GivenINavigatedToTheGithubLoginPage()
{
ScenarioContext.Current.Pending();
}
}
}
This will trigger errors in the compilation. If you point to the error in "ScenarioContext" and do "Show potential fixes", one of the fixes will be to install "Sprecflow extension". With this you install the remaining integration that will now display the option in the context menu.
That fixed the issue to me and now I can see in the context menu "Generate Step Definitions"
I followed Kyon's excellent walkthrough, but this didn't work for me. Even though SpecFlow was installed correctly, it didn't recognise the following library, or make any suggestions to "Fix this issue":
using TechTalk.Specflow
Then I noticed that, with the a brand-new MsTest project and the latest VS2019 (as of October 2020) you need to install a slightly-earlier version of SpecFlow (v2.1 compared to v2.4).
So, if you're also having problems getting this illusive "Generate Step Definitions" menu item to appear, check out your Dependencies\Packages for any exclamation marks.
Recently I was facing an issue coding React app on Visual Studio code. Because of this issue, whenever I wrote JSX inside the render function of the React Component and saved it, it would go messed up (I mean indentation would get messy). See the pic:
This error was also showing error like:
1. Unclosed regular expression
How to solve this?
If you are using jshint plugin, remove it and install ESLint plugin.
It is a good replacement for jshint in reactJS work.
I tried several options like creating a .eslintrc file or .jshintrc file.
But it turned out that in my Visual Studio Code IDE, there was third party extensions(eslint/jslint/tslint/beautify/jsformatter etc) that were causing a big mess in my JSX code.
I had to go to the extensions and disable all the extension which could hinder in the natural process of linting and code cleaning of React framework.
(These extensions are really great. But disabling them helped me in solving this issue of mine, no offense to anyone.)
If you are facing the same issue and the issue persists event after adding a .jshintrc with content:
{
"esversion": 6
}
then consider disabling the third party extensions.
Hope my answer helped.
the extension that did it for me was...
jshint
dbaeumer.jshint
Dirk Baeumer
as #abhay-shiro says, disabling a few extensions will usually resolve the issue.
I had the same problem, but it was "beautify" extension which was causing the error, I uninstalled it and installed prettier. It fixed the problem.
I solved this issue by disabling show syntax errors checkbox in visual studio 2015.
Tools -> options - > text editor -> javascript -> intelliSense -> general -> show syntax errors(disable)
I have been using VSCode for quite a long time and while it's very good, I'm missing intellisense and features that seem to be ES6-only:
I cannot ctrl+click to go to definition
I cannot have a preview of the definition
Here is what I am using:
ES5
Angular JS
All my files are wrapped into a closure, like:
(function() {
angular.module('foo').factory('bar', ['dep1', function(dep1) {
dep1.stuff();
}]);
})();
With that in mind, is it possible to have "goto definition" and other nice VSCode stuff working ? If so, how ?
What can I do to be able to simply click ctrl+click on dep1 and have VSCode open the file where dep1 is defined ?
What I can recommend is that you try to install John Papa's extension for Visual Studio Code for Angular 1.x. It is installed directly through VSCode. You can check some examples of how it works here. It will offer you code completion and it will automate a lot of tasks you frequently do in Angular, such as creating services, controllers, directives...
Btw John Papa is the author of the Angular Style guide and his way of coding could be called "best-practice" in the world of Angular development.
The best way to get intellisense for javascript/typescript is to install typings.
I find that this extension is good with installing typings: https://marketplace.visualstudio.com/items?itemName=benjaminromano.typings-installer
Once you have that installed, you can then launch it (F1 > Typings Installer: Typings > angular) and install the dt~angular typings. from there you should start getting intellisense, go to definition and possibly error checking.
Code should then pick this up (if not just reload the editor). You should then start getting intellisense. If you want to tweak it more, I would suggest looking into jsconfig.json files: https://code.visualstudio.com/docs/languages/jsconfig
You can get general purpose typing information pulled by enabling Synthetic Default Imports in Visual Studio Code.
It lets you get Intellisense either from TypeScript type definitions or by inferenced type information from the JSDoc of many popular repositories.
Here is a tutorial for how to get things set up.
I opened up angular code in VSCode. At first it didn't recognize angular, so used the light-bulb to add:
/// <reference path="../../typings/angularjs/angular.d.ts"/>
But it still doesn't recognize angular and now I get an error saying that it can't find angular.d.ts.
It looks like the problem was that VSCode failed to download the file and create the directories. I googled angular.d.ts and found it on GitHub - DefinitelyTyped
I created "typings/angularj/" folders and added the file and now intellisense is working for angular :)
You don't need to add anything to your file, VS Code will add angular.d.ts to the typings folder. VSCode doesn't require the /// tag to be included in all your files, you might even confuse the editor doing this.
If you don't see the "typings" folder with the angular intellisense file you will not get intellisense and you need to repeat the light-bulb step.
I am using Windows 7 and Visual Studio .NET 2010 with Silverlight 5 Framework.
I am working with a video tutorial from YouTube on how to create a Windows phone application using a web service.
The problem is that when I add the web service "http://msrmaps.com/TerraService2.asmx", once added the service reference i get a lots of and an error that I do not understand.
I call the web service as follows:
In Solution Explorer, right -click and choose "Add Service Reference"
Paste the URL above into the Address Box
click Go
Accept the provided namespace or type in another valid name for the namespace. I have named it as TerraService in my case.
Build the project.
WARNINGS AND ERRORS
Warning 1 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Could not load type 'System.Runtime.Serialization.DataContractSet' from assembly 'System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://msrmaps.com/']/wsdl:portType[#name='TerraServiceSoap'] c:\users\botoeo\documents\visual studio 2010\Projects\OpenEye\OpenEye\Service References\TerraService\Reference.svcmap
Warning 2 Custom tool warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[#targetNamespace='http://msrmaps.com/']/wsdl:portType[#name='TerraServiceSoap']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://msrmaps.com/']/wsdl:binding[#name='TerraServiceSoap'] c:\users\botoeo\documents\visual studio 2010\Projects\OpenEye\OpenEye\Service References\TerraService\Reference.svcmap
Warning 3 Custom tool warning: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[#targetNamespace='http://msrmaps.com/']/wsdl:binding[#name='TerraServiceSoap']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://msrmaps.com/']/wsdl:service[#name='TerraService']/wsdl:port[#name='TerraServiceSoap'] c:\users\botoeo\documents\visual studio 2010\Projects\OpenEye\OpenEye\Service References\TerraService\Reference.svcmap
Warning 4 Custom tool warning: No endpoints compatible with Silverlight 3 were found. The generated client class will not be usable unless endpoint information is provided via the constructor. c:\users\botoeo\documents\visual studio 2010\Projects\OpenEye\OpenEye\Service References\TerraService\Reference.svcmap
Warning 5 Custom tool warning: Exception has been thrown by the target of an invocation. c:\users\botoeo\documents\visual studio 2010\Projects\OpenEye\OpenEye\Service References\TerraService\Reference.svcmap
Error 6 Custom tool error: Failed to generate code for the service reference 'TerraService'. Please check other error and warning messages for details. c:\users\botoeo\documents\visual studio 2010\Projects\OpenEye\OpenEye\Service References\TerraService\Reference.svcmap
How do I get rid of these warnings and erros. What causes this?
I found the solution for this problem.. I simply updated my Windows Phone SDK to the latest version. Latest Version can be found HERE . Download the latest update installer. Save your solution and close the Visual Studio. Update your Windows Phone SDK using downloaded file. Once this is done. Open your Visual Studio again. It will work smoothly.