c#-3.0

Exception “error MSB3024: Could not copy the file…” is thrown when attempting to build in DevOps pipeline using .Net Core 3.0 SDK (preview5)

匆匆过客 提交于 2020-01-24 09:47:10
问题 I am attempting to build a .Net Core 3.0 (preview) project in a DevOps build pipeline. The steps in my azure-pipelines.yml executes up to the " docker build " step, successfully initiating the build process. The Docker file is read and executed up to the "dotnet build" step after which the following error is thrown. error MSB3024: Could not copy the file "/src/obj/Release/netcoreapp3.0/" to the destination file "/app/", because the destination is a folder instead of a file. To copy the source

Catch exceptions within a using block vs outside the using block - which is better?

你。 提交于 2020-01-20 16:51:51
问题 Is there any difference between these tow pieces of code & which approach is better. try { using() { //Do stuff } } catch { //Handle exception } using() { try { //Do stuff } catch { //Handle exception } } 回答1: There are differences, but it namely boils down to the fact that a using block creates it own try and scope blocks. try { using(IDisposable A = GetDisposable()) { //Do stuff } } catch { //Handle exception // You do NOT have access to A } using(IDisposable A = GetDisposable()) /

simple linq to sql has no supported translation to SQL

折月煮酒 提交于 2020-01-18 16:10:20
问题 i have this in my BlogRepository public IQueryable<Subnus.MVC.Data.Model.Post> GetPosts() { var query = from p in db.Posts let categories = GetCategoriesByPostId(p.PostId) let comments = GetCommentsByPostId(p.PostId) select new Subnus.MVC.Data.Model.Post { Categories = new LazyList<Category>(categories), Comments = new LazyList<Comment>(comments), PostId = p.PostId, Slug = p.Slug, Title = p.Title, CreatedBy = p.CreatedBy, CreatedOn = p.CreatedOn, Body = p.Body }; return query; } and public

Error when splitting and replacing chars C# email with LINQ Array Index not supported in LINQ

心已入冬 提交于 2020-01-16 20:06:08
问题 This throws an error 'ArrayIndex' is not supported in LINQ to Entities. so what would be an alternative for this as the split and replace fails? from S in db.Students where S.ID = ID select new { S.EMAIL.Split('@')[0].Replace(".", " ,"), S.NAME }; This is for a list of Students and this is how I currently can add them. mylist.DataValueField = "email"; mylist.DataTextField = "name"; This fails: S.EMAIL.Split('@')[0].Replace(".", " ,") Please help. Thanks 回答1: If you want it to run on the SQL

Error when splitting and replacing chars C# email with LINQ Array Index not supported in LINQ

大兔子大兔子 提交于 2020-01-16 20:05:03
问题 This throws an error 'ArrayIndex' is not supported in LINQ to Entities. so what would be an alternative for this as the split and replace fails? from S in db.Students where S.ID = ID select new { S.EMAIL.Split('@')[0].Replace(".", " ,"), S.NAME }; This is for a list of Students and this is how I currently can add them. mylist.DataValueField = "email"; mylist.DataTextField = "name"; This fails: S.EMAIL.Split('@')[0].Replace(".", " ,") Please help. Thanks 回答1: If you want it to run on the SQL

In Subsonic 2.1 how do I make this generic call take one generic parameter?

不问归期 提交于 2020-01-16 19:19:12
问题 Using Subsonic 2.1 I want to make my method call to results look like this: results(searchCriteria) right now I have to pass the CollectionType as well as the type. Animal searchCriteria = GetSearchCritera(); AnimalCollection results = results<Animal, AnimalCollection>(searchCriteria); // I want the call to be results(searchCriteria); Here is the results method that I want to just take Y public static T results<Y, T>(Y searchCriteria) where Y: ReadOnlyRecord<Y>, new() where T: ReadOnlyList<Y,

In Subsonic 2.1 how do I make this generic call take one generic parameter?

我怕爱的太早我们不能终老 提交于 2020-01-16 19:17:28
问题 Using Subsonic 2.1 I want to make my method call to results look like this: results(searchCriteria) right now I have to pass the CollectionType as well as the type. Animal searchCriteria = GetSearchCritera(); AnimalCollection results = results<Animal, AnimalCollection>(searchCriteria); // I want the call to be results(searchCriteria); Here is the results method that I want to just take Y public static T results<Y, T>(Y searchCriteria) where Y: ReadOnlyRecord<Y>, new() where T: ReadOnlyList<Y,

Decompress a GZipped response from the server (Socket)

Deadly 提交于 2020-01-15 09:16:08
问题 Umm, ok, after sending some data to the server, noting this particular part: "Accept-Encoding: gzip,deflate\r\n" I am getting the following response: HTTP/1.1 200 OK Server: nginx Date: Fri, 09 Apr 2010 23:25:27 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive X-Powered-By: PHP/5.2.8 Expires: Mon, 26 Jul 1997 05:00:00 GMT Last-Modified: Fri, 09 Apr 2010 23:25:27 GMT Cache-Control: no-store, no-cache, must-revalidate Cache-Control: post-check=0, pre

Why do I need a finalizer if my class implements IDisposable?

丶灬走出姿态 提交于 2020-01-14 18:59:09
问题 What about below disposable pattern? using System; public class MyClass : IDisposable { public void Dispose() // Implement IDisposable { //just do the cleanup GC.SuppressFinalize(this); } } Sorry for confustion. I meant to say, if there are no un-managed resources do i need finalizer? isnt the above disposable pattern is good enough? Yes, even though users/develoeprs doesnt invoke dispose, doesnt GC invoke dispose by default? And what about the order in which GC invokes dispose and finalizers

Bind XDocument to WPF and still use XPath?

不问归期 提交于 2020-01-13 19:25:08
问题 This is a 2 part question. 1) Is it possible to bind XDocument to a WPF control without using ObjectDataProvider ? Here is a snippet of my code in which XmlDocument works, but i cannot use XDocument XmlDataProvider provider = new XmlDataProvider(); provider.XPath = "/Parent/Child"; provider.Document = mydoc; // xmldocument works fine. Binding binding = new Binding(); binding.XPath = "InnerChild/Name"; binding.Source = provider; decisionCb.SetBinding(ComboBox.ItemsSourceProperty, binding); I