Rob McCabe

1

votes
2

answer
915

views

VSTS - how to get Code Coverage results

I'm new to DevOps work and I've been tasked to setup a build for one of our .net Standard Library projects. I used the build template for this, which works great! But I want to add a code coverage into build output (there's a test project in the solution). In the 'VsTest - testAssemblies' task, I'...
Rob McCabe
1

votes
1

answer
192

views

How to run .net Core app that depends on NuGet packages on Ubuntu

I have a very simple .net Core (2.1) console application that uses a couple of NuGet packages for development. When I compile (not self-contained) it's output is as follows: HelloWorld.deps.json HelloWorld.dll HelloWorld.pdb HelloWorld.runtimeconfig.dev.json HelloWorld.runtimeconfig.json NOTE:...
Rob McCabe
1

votes
1

answer
1.2k

views

Bootstrap Css - vertically aligned progress bar with label

I have been given a screen design for a website with a vertically rotated component that I am trying to write the css and html for. The design is as follows: As I am using bootstrap, I decided to customise the existing .progressbar by rotating it by 90 degrees in order to fit the design. My html...
Rob McCabe
1

votes
1

answer
62

views

Intermittent problems displaying google maps in angular view

I've got a google map embedded in an angular view and it displays (as shown below - right) some of the times and then shows up as grey (below - left) when I refresh the page. My reference to google is in the page head like this: My html (in the angular view), looks like this: My code in the controll...
Rob McCabe
1

votes
3

answer
373

views

Why am I automatically pushed to login page when a user is unauthenticated by calling the Web API?

I am using MVC 6 web api and I have a method (shown below). When the user is not authenticated (logged on) and makes the call (example url: https://localhost:44338/api/account/Test), they get automatically pushed to url: https://localhost:44338/Account/Login?ReturnUrl=%2Fapi%2Faccount%2FTest BUT th...
Rob McCabe
1

votes
2

answer
1.2k

views

Error running ASP.net CORE 1 project in IIS

I've recently created a very simple ASP.net CORE 1 application using the default template. I published it to a directory and created a new website in IIS for it. Tested connecting to the site and it worked fine! Great! I took the same code and deployed it to my test server and get very different...
Rob McCabe
1

votes
1

answer
1.6k

views

Json date being serialized to wrong format

I have a Web Api ASP.net CORE 1 MVC, c#. I make calls to the web api via a Client app I've built that is written using Angular (version 1). I have a POST method that has a model with a date as a property. In my development environment, when I post to the method, the date comes through fine, the mod...
Rob McCabe
1

votes
1

answer
179

views

Azure - migration options for moving Web Jobs from ASE to Kubernetes (AKS)

I am very new to development on Azure and I am working on an existing Azure cloud solution that has Service Bus receiving messages from a UI and the message events start Azure (on-demand) Web Jobs at various points in the solution. Similar to this: We are hosting most parts of the solution on ASE an...
Rob McCabe
1

votes
1

answer
118

views

Understanding the adaptor pattern (c#) [duplicate]

This question already has an answer here: Understanding Adapter Pattern 3 answers I have a scenario I am coding, where I feel the Adaptor Pattern would be useful. I have a service that has multiple possible providers I want to switch when I like, so as long as each 'Adapter' follows the same rules...
Rob McCabe
1

votes
1

answer
140

views

How to add a Nuget Package badge in the latest version of VSTS

I've been trying to add a package badge to my Readme.md file in my code repository, something like this: I've been following this article: https://docs.microsoft.com/en-gb/azure/devops/artifacts/vsts-package-badges?view=vsts I'm using the latest version of VSTS and don't seem to have the 'Create Ba...
Rob McCabe
1

votes
1

answer
184

views

How to add dynamic retry policies using dotnet core and Polly

I have a dotnet core (2.1) Console application and I am using Polly to wrap a segment of my code with a retry policy. This works fine with a simple use case shown below: private void ProcessRun() { var policy = Policy.Handle().WaitAndRetryAsync( retryCount: 3 sleepDurationProvider: attempt => Time...
Rob McCabe
1

votes
1

answer
0

views

Problems using MSI to authenticate to Azure BlobStorage

I am trying to connect my C# console app (.net core 2.1) to blob storage. I initialise the Blob Storage client in a couple of different ways. They are: Connection String - useful during development Service Principle - possibility for production deployment MSI Authentication - more secure, keys are...
Rob McCabe
1

votes
1

answer
656

views

Custom JSON.net serialization and deserialization

I am writing out data into JSON format to be consumed by another program. I need to serialize the large number of JSON objects into a file. Using JSON.net this is really straight forward to serialize with the following lines of code: [JsonConverter(typeof(SimpleClassSerializer))] public class Simp...
Rob McCabe
1

votes
2

answer
624

views

Convert contents of an XmlNodeList to a new XmlDocument without looping

I have Xml that I filter using XPath (a query similar to this): XmlNodeList allItems = xDoc.SelectNodes('//Person[not(PersonID = following::Person/PersonID)]'); This filters all duplicates from my original Persons Xml. I want to create a new XmlDocument instance from the XmlNodeList generated abov...
Rob McCabe
1

votes
1

answer
996

views

Xamarin - Reliable way to see device is connected to Wifi network (Android)

I am building a mobile application on Android and the user can decide not to send data if not connected to Wifi in a configurable settings, as follows: I am looking a reliable way to check this and have come up with this solution: public class AndroidDeviceNetwork : IDeviceNetwork { private const st...
Rob McCabe
1

votes
1

answer
364

views

Dockerfile to run .net core console app on Linux (which is not self contained)

I have a .net Core 2.1 console application and I want to build it into a docker container that will be deployed to Linux (Alpine). If this had an output on windows of an exe (and was self-contained of course). My docker file might look like this: COPY /output/ /bin/ CMD ['/bin/sample.exe'] As I wa...
Rob McCabe
1

votes
2

answer
58

views

How to set VM operating system to update automatically when creating using an ARM template - Azure

I've built a VM in Azure using Powershell commands and an ARM template. My template has this section: 'osProfile': { 'computerName': '[parameters('virtualMachines_abc_name')]', 'adminUsername': 'testadm', 'windowsConfiguration': { 'provisionVMAgent': true, 'enableAutomaticUpdates': true }, 'secrets...
Rob McCabe
1

votes
1

answer
24

views

Issue running rescharper inspect code - dotsettings file not picked up when testing .csproj (c#)

I am using Resharper's inspectcode to run analysis on my code. To do so, I run the following command: inspectcode.x86.exe 'C:\CODE\src\AI.Core\AI.Core.csproj' /o:'C:\CODE\analysis\CodeQualityResults.xml' /disable-settings-layers:SolutionPersonal My dotsettings file lives here: C:\CODE\src\AI.Core.d...
Rob McCabe
1

votes
1

answer
1.6k

views

c# Word Interop - Setting paragraph indentation

I have a requirement to programatically (in C#) either switch on or off the hanging indent of a particular paragraph. I have created an add in, with a button that when clicked, executes code where I (attempt) to do this. Its a toggle, so first click adds the Hanging indent and second click should r...
Rob McCabe
5

votes
1

answer
80

views

dotnet cli - specified .runsettings file not used in code coverage run

I have a solution containing two dotnet core 2.1 projects (c#). The first is a console application The seconds is a test project with unit tests I generate code coverage stats about project 1 when executing tests in project 2 using this command: dotnet test C:\tempDir\SampleApp\Tests\SampleApp.Tes...
Rob McCabe
1

votes
1

answer
372

views

Error when building an XDocument

Using the following example xml containing one duplicate: 7506 K Seddon Male 6914 Clark Kent Clark Kent Male 6914 Clark Kent Clark Kent Male I have the following code where I am trying to build an XDocument with the output of an XPath query that filters the duplicate elements: string outputXml = nul...
Rob McCabe
1

votes
2

answer
1.3k

views

MVC Web API and Unity for dependency injection

I'm building a very simple set of controllers that I would like to inject dependencies into. My Web Api project is using .net 4.5.1 (vs2015) and I am using Unity for dependency injection (really really new to Unity). Here's what I've done: New Project > ASP.Net web appliction > Web Api Project (no a...
Rob McCabe
9

votes
0

answer
1.8k

views

ASP.net core auth cookie not being set in Google Chrome when running in dev

I have three applications in my solution, all built in asp.net core 1 MVC 6. App 1 is an MVC app used for authenticating a user. App 2 is an Angular SPA app and is the main app in the solution. App 3 is an MVC web api application. In app 3, I have the usual asp.net core SignInManager and Use...
Rob McCabe
3

votes
1

answer
7.5k

views

WPF - animate image source change

I'm pretty new to WPF but I think what I need to do is relatively simple. I need to create an image 'animation', where I am changing an image source every .25 of a second. I have a folder named 'animation' with images 1 to 25 png live (named 1.png, 2.png... 25.png). Each image correlate to differen...
Rob McCabe
5

votes
3

answer
2.2k

views

Whats the difference with returning Task<bool> and just returning bool

Hopefully this is a nice and simple answer. I'm using C# MVC Web API in ASP.NET Core 1. I'm creating web methods and I've seen examples with this of returning data. Example 1: public async Task ExampleCall([FromBody]ExampleObj model) { // Call some lower level function... var result = LowerLevelC...
Rob McCabe
1

votes
1

answer
73

views

Use the yield to defer Azure blob storage call - c#

I currently have a method where I pull a list of blob file names from Azure. The method is as follows: internal async Task GetFiles(CloudBlobContainer container, string directoryName, bool recursive) { var results = new List(); BlobContinuationToken continuationToken = null; do { var response = awa...
Rob McCabe
21

votes
1

answer
8.6k

views

How to use ASP.net Core 1 “SignInManager” without EntityFramework

I'm looking to implement ASP.net authentication via the SignInManager but without the EntityFramework. I have built my own database layer using SQLClient and want to just create whatever calls is needed in order to make ASP.net authentication work. The code I have is as follows (executed from the S...
Rob McCabe
5

votes
4

answer
4.4k

views

How to host multiple .NET Core apps under same url

I am building a few web sites in asp.net core (multiple user interface applications and a web api app). They all work together, utilising the web api. For the purpose of my question we'll call them App1, App2 and App3. I am hosting my websites in IIS. Typically, in the old .net Framework (4.5.1),...
Rob McCabe
2

votes
1

answer
847

views

Error running a new google v3 api application

I recently logged the following forum article asking for help setting up a Google v3 Api application. I got information back but I am getting an error running the code. Google c# Api, changing from v2.3 to v3 Here are the steps I took: Registered a new native application on the google web site Do...
Rob McCabe
2

votes
1

answer
97

views

XPath query to select nodes

I have the following XML: 6352 Tristan 6353 Ruth 6913 Mina Asif 6914 Clark Williams I use the following code to load the xml: XmlDocument xDoc = new XmlDocument(); xDoc.Load(@'example.xml'); I need to ask for all nodes that DO NOT have a Surname using an XPath query and the select nodes call (someth...
Rob McCabe
3

votes
1

answer
1.9k

views

Kinect SDK - Transform the rotation of an angle by degrees

I am reasonably new to Kinect development and I am trying to build a component that allows rotations of Kinect joints. The purpose of this is to manually 'fix' any skeleton data I've captured, post capture, where the skeleton starts jumping around. I am displaying the Kinect skeleton in 3D space us...
Rob McCabe
2

votes
0

answer
690

views

How to compress high resolution image bytes without converting to an image/bitmap first

I'm working with the Kinect 2.0 and in particular with the color stream. The color stream arrives with a whooping 1920×1080 resolution, which is great! Except, I intend to capture the image bytes and write them to disk. So, the most viable solution for me is to compress each image frame and then...
Rob McCabe
2

votes
3

answer
379

views

Linq where clause using filter object

I have a piece of Linq that queries an EntityFramework context in my web controller and returns the result, as follows: [HttpGet] public IActionResult GetRoutingRules() { var query = (from rr in _context.RoutingRules join dest in _context.RoutingZones on rr.DestinationZoneId equals dest.ZoneId join...
Rob McCabe
5

votes
2

answer
2.6k

views

how to add user controls as listbox items

I am using WPF .net 4.5 (c#) and I would like to make a ListBox that contains a series of user controls. (If a listbox is the wrong type of control, please let me know). I want my listbox to have a copy of the user control as the list items, with different contents within each one. How do I add use...
Rob McCabe
2

votes
1

answer
3.6k

views

Handle a large number of TCP Client Connections in .net

I need to build an application (a server) that handles data sent from a Client via TCP. I must be able to support (at least) 2000 connections. I've made an attempt to write the TCP Server, but I find when I start to reach 600/700 connections, that the response from my server slows greatly (it actu...
Rob McCabe
2

votes
1

answer
1.4k

views

Which Javascript Framework for a data driven web application?

I've been asked to design a web application which has multiple tiers. It will have a client aspect (rendering information for the user), a server aspect (web api serving data) and a database behind it all. I'm comfortable choosing the technology stack for the web api and database. It will either b...
Rob McCabe
39

votes
2

answer
24.4k

views

Angular 5 internationalization

I'm building an application using the latest Angular5 and what I need is for a user to be able to switch languages. I've never had to implement this in an Angular2+ (actually I'm using Angular5). I need to set translations in two places: Component's template html - change labels to the specified l...
Rob McCabe
43

votes
1

answer
45.4k

views

How to use SqlClient in ASP.NET Core?

I am trying to use SQLClient library in the ASP.net Core but cant seem to get it working. I found this article online advising how to setup but its not working for me: http://blog.developers.ba/using-classic-ado-net-in-asp-net-vnext/ I have a simple console application package. My project.json loo...
Rob McCabe
2

votes
2

answer
2.1k

views

Static resource images not appearing at runtime (are at design time)

I have setup static resources in my WPF application as follows: I can see the images appearing at design time with the following declaration: But when I run my application the images aren't appearing. Any ideas what I've done wrong? Thanks in advance!
Rob McCabe
2

votes
1

answer
5.7k

views

WCF Service Configuration for basicHttpBinding

I am having an issue where I have SOA with a web site consuming services and a web site hosting services. One of my services accepts an image (byte[]). When I pass an image of 83kb to the WCF service I get the following error: The maximum array length quota (16384) has been exceeded while reading...
Rob McCabe

View additional