Questions tagged [.net-4.6.1]
.Net 4.6.1 of the Microsoft .Net framework. .Net 4.6.1 is compatible with .NET Standard 1.4
253
questions
3
votes
1
answer
54
views
How to filter IQueryable for null navigation property
Say I have 2 simple models (below), where 'User' contains a navigation property to 'UserDetail' (one-to-one relationship):
Database
CREATE TABLE [dbo].[UserDetail]
(
[UserId] [int] NOT NULL ...
0
votes
1
answer
42
views
C# DataTable Min Value excluding NaN
I am having a problem with datatable in C#. I want to find the min value for a column in a datatable that has NaN value. For example:
c1 c2 c3
1 2 3
4 NaN NaN
NaN 7 9
Say if I want to find ...
1
vote
1
answer
62
views
Azure App Service Memory Working Set steady at 0 bytes
We have an S3 app service running in Azure and deploy updates every other Wednesday night.
After last night's update (no change in any framework or nuget packages) our Memory working set, for the ...
0
votes
0
answers
14
views
Find details on native code performance issues
I have a .Net Framework 4.x WPF application that occasionally (1% occurrence rate) has a performance issue when loading data. I have narrowed the problem down to a very specific part of the WPF ...
0
votes
1
answer
23
views
Why calling AWS APIGateway from .Net framework 4.6.1 gives internal server error unlike .net 6.0 gives OK status?
Why calling AWS APIGateway from .Net framework 4.6.1 gives internal server error unlike .net 6.0 gives OK status.
The same exact code using httpclient & same timeout 30 seconds.
0
votes
0
answers
99
views
Project file cannot specify more than one Application Definition element
I am trying to integrate my WPF application (.net 4.6.1) into .net core 3.1.
I have made the changes every thing as per documented by Microsoft.
But I am getting this error at time of build the new ....
0
votes
1
answer
93
views
My async task is blocking other code from running and not outputting anything
Recently I've been converting my node.js bot to C# but I've ran across an problem for some odd reason public async Task InitCloudCompute() is blocking my other code from running. I got no idea why ...
0
votes
0
answers
92
views
Service Soap Client WebService not authorized .NET/C#
I'm trying to call a method for a web service we use. I keep getting this error
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from ...
0
votes
0
answers
32
views
Why does an extra await cause synchronous execution? [duplicate]
I am trying to understand a comment made on a legacy piece of code...
The original code:
public async Task Send(Notification notification)
{
await Task.WhenAll(notification.Methods....
3
votes
1
answer
716
views
Visual Studio Intellisense shows "new expression can be simplified", but that fails the build
I have this code
MyClass instance = new MyClass();
VS Intellisense shows:
'new' expression can be simplified
and upon selecting that action, it changes the code to:
MyClass instance = new();
but ...
3
votes
1
answer
1k
views
How to handle "A potentially dangerous Request.Form value was detected from the client"?
I've received some "generic" errors within the protected void Application_Error() handler on an ASP.NET MVC Framework application. The exception message is:
A potentially dangerous Request....
1
vote
1
answer
247
views
Cannot upload file to azure file share
I am trying to upload .msg file to azure file share. I followed the Azure Storage File Shares client library for .NET
My code
var connection = "DefaultEndpointsProtocol=https;AccountName=xxxx;...
1
vote
2
answers
85
views
isn't SaveChanges() managed by transactions?
I've several "thread" (i.e. Hangfire task) that will run in parallel this kind of function (each call passing different systemId):
private void UpdatePartners(int systemId)
{
try
{
...
0
votes
1
answer
103
views
AutoMapper from DataTable to DTO
I have a DataSet populated during an ADO.NET call which I want to then use AutoMapper to convert to a DTO.
I have defined a generic-use mapper for many of our DTO types:
IMapper DataReaderMapper = new ...
0
votes
0
answers
332
views
Headless unit testing for WebView2
I'm writing unit tests for a class that wraps the WebView2 browser control (WPF version if it matters).
Is there a way to run WebView2 in the equivalent of a headless mode so I don't have to actually ...
0
votes
1
answer
32
views
Why this routing is not catched?
I'm trying to catch "all route" which doesnt have a defined map and redirect to a custom page.
This way:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute(&...
0
votes
1
answer
34
views
Insights InstrumentationKey not populated after assignment in global.asax.cs
I have a .NET Framework 4.6.1 Web API solution which uses these Nuget packages:
<package id="Microsoft.ApplicationInsights" version="2.9.1" targetFramework="net461" /...
0
votes
2
answers
310
views
How to log every web api request in Insights with .NET 4.6.1
I have a .NET Framework 4.6.1 solution which has this global.asax.cs:
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{ Microsoft....
0
votes
3
answers
212
views
Is there a way to discriminate a specific System.Web.HttpException?
I've some "bad boys" users which call my website using controller that doesn't exist.
Such as www.myapp.com/.svn/, or www.myapp.com/wp-admin/.
The app basically throw a System.Web....
0
votes
0
answers
74
views
Assemblies 'C:\WINDOWS\PathToEsriDll' and 'C:\Program Files (x86)\PathToEsriDll' refer to the same metadata but only one is a linked reference
I'm having some problems associated with a .NET Framework 3.5 to to 4.6.1 upgrade. The upgrade triggers the error, CS1769 Type 'CustomClass1<CustomClass2>.CustomClass3<ESRI.ArcGIS.Geodatabase....
0
votes
0
answers
33
views
Why do generic parameters need to be cast to object before cast to specific type? [duplicate]
Why is the intermediate cast to object necessary?
I'm wondering why the compiler team designed it this way.
namespace ConsoleApp4
{
class Program
{
static void Main(string[] args)
...
0
votes
1
answer
73
views
Is there any standard way to load array from appSettings.config file in .NET 4.6.1
I have a setting like this in my appSettings.config file
<add key="logFilesLocations" value="[firstfile,secondfile]"/>
Is there any standard way to read these values as ...
0
votes
0
answers
18
views
Role based authorization with IdentityServer4 using a web forms application targeting .NET Framework 4.6.1
I was able to follow the steps in the following link to get role authorization working in an MVC application targeting .NET 5.0 using IdentityServer4: https://github.com/MitchDorrestijn/identity-...
0
votes
0
answers
23
views
Different dependency (dll) management behaviours between .NET versions
I started working with .NET when .NET Core was 1.0 RC2. At that time I learned how handy nugets are. Now I am at a new employer and learning .NET 4.X (currently .NET 4.6.1) where the existing projects ...
0
votes
1
answer
164
views
PowerPoint Interop: copy-pasting a shape crashes if done too fast
I'm using the Microsoft.Office.Interop.PowerPoint in a C#/.NET program in order to automate some operation on a PPTX file.
I'm trying to create a copy of an existing Shape in the presentation by using ...
0
votes
0
answers
103
views
C# Split string on 'þ', not on 'th'
In C# I have a string that I need to split on the character 'þ'. The problem is that the string is split on 'th' as well.
string dataline = 'is thisþis that';
string[] dataFields;
dataFields = ...
0
votes
0
answers
51
views
EF6 doesn't update table when it claims it has
Problem
Entity Framework reads from the database and then falsely logs that it has written back to the database. I first tried using synchronous code and then async code. Any ideas, please?
...
1
vote
1
answer
1k
views
.Net Framework 4.6.1 WebApi, Attribute routing and default routing not working
I appreciate any help on this. I'm currently working on a project where we basically have to convert an older .Net Framework MVC application into an API being utilized by a React front end. We were ...
0
votes
0
answers
130
views
Adding TLS 1.2 support in .Net applications
We have 2 tracks
Adding TLS 1.2 support to .Net 4.6.1 application
As of now we have added below line of code wherever we're making REST API calls
ServicePointManager.SecurityProtocol = ...
0
votes
1
answer
74
views
Unsupported subtype for CID font /CIDFontType0C
I'm using PdfPig to read text from a pdf:
using (var document = PdfDocument.Open(filePath))
{
var page = document.GetPage(0);
}
I'm getting an exception on document.GetPage(0);:
System....
-1
votes
1
answer
276
views
Forcefully terminate thread generated by Parallel.ForEach [duplicate]
When using Parallel.ForEach(), is there a way to forcefully execute Thread.Abort on a specific thread?
I know that Thread.Abort() is not recommended.
I'm running a Parallel.ForEach() on a collection ...
1
vote
1
answer
277
views
How can I get current value of a Windows environment variable from a different session
Using C# with .Net 4+ or Standard 2.0 or Windows API, I would like to get the value of an environment variable for all users that are logged in, let's call the variable "Identifier". The ...
1
vote
1
answer
828
views
Moq internal class and/or internal method
On my project, I set:
[assembly: InternalsVisibleTo("xyz")]
My unit tests work when my class and method are public.
public class MainController
{
public virtual void RunForm()
{
...
0
votes
0
answers
86
views
Can I run .Net 4.6 Application under .Net Core Site on IIS
I inherited a project that is a collection of WCF Services that target .Net Framework 4.6.1. I wrote a front end SPA application that targets .Net Core 2.2 not realizing that the hosting model was ...
0
votes
0
answers
231
views
MSTestV2 assemblies in GAC
Using VS2017 with mstest.testadapter 2.1.1 and mstest.testframework 2.1.1 (nugets)
When opening 'Developer command prompt", running command "vstest.console.exe my_test.dll", all tests ...
0
votes
1
answer
118
views
IsSearchable not recognized when creating azure search index
I am trying to create index for for below model.
public class Booking
{
[System.ComponentModel.DataAnnotations.Key]
[IsSearchable,IsFilterable,IsSortable]
public string ...
0
votes
1
answer
298
views
How to use asp:MenuItem NavigateUrl property to call BlazorServer app in the same solution?
How to use asp:MenuItem NavigateUrl property to call BlazorServer app in the same solution?
I have a solution. Solution has different projects with diff framework such as .net 4.6.1 and Core .3.1. ...
0
votes
2
answers
175
views
RichTextBox Text alignment issue with .NET4.8
When compared the text alignment with RichTextBox, behavior has changed from .Net4.6.1 to .Net4.8.
Any help on how the earlier behavior of .Net 4.6.1 can be achieved in .Net4.8?
public Form1()
{
...
0
votes
2
answers
134
views
Switch between multiple windows
We have a software system that should support multiple variants. Each variant should contain a customized version of one or more UI components (Windows Forms in this case).
A prototype has been ...
0
votes
0
answers
117
views
Why is .NET Framework 4.6.1 and .NET Standard 2.0 listed as dependencies in NuGet?
I found this when looking at a NuGet package.
Why are these 2 special? What about all the other .NET framework and .NET Standard versions?
2
votes
1
answer
5k
views
How to solve NuGet.targets(124,5): error : Value cannot be > null. (Parameter 'folderName') error?
On building the project I am getting this error.
Error NETSDK1004 Assets file
'J:\Test\core\fx-core\obj\project.assets.json' not found. Run a NuGet
package restore to generate this file. FxCore ...
0
votes
1
answer
2k
views
How to log outgoing HttpClient request?
I want to connect to REST Api, but it keeps returning status code 400 (Bad Request) no matter how I build the request.
HttpResponseMessage response = client.PostAsync(url, content).Result;
response....
0
votes
1
answer
43
views
EF6 code first Many to Many with additional property of the same type as the collection on one of the entities
I know this issue has many similar questions here on SO, but I couldn't find one that's exactly like mine, but I might be wrong and there exists one. So here's my question:
We have two entities (C# ...
0
votes
0
answers
60
views
What queue is NServiceBus using?
I'm trying to work out what queue this Azure webjob is listening to.
Handler class:
public class InvoiceEventsHandler: IHandleMessages<InvoiceCreatedEvent>
{
private readonly ...
2
votes
2
answers
582
views
Upload file to blob storage error get_NetworkTimeout does not have an implementation
I tried to to call TransferManager.UploadAsync but I keep getting this error:
Method 'get_NetworkTimeout' in type 'Microsoft.Azure.Storage.File.FileRequestOptions' from assembly 'Microsoft.Azure....
3
votes
0
answers
2k
views
How to make SameSite Cookie Support In ASP.NET 4.6.1 and below version
I have developed a site using asp.net M V C
we did ran a scan on site and it gives a C S R F asking to make the site cookies Same site.
tried below code in web.config but seems its works only from 4....
0
votes
1
answer
436
views
VB.NET application compiled to target 4.6.1 framework does't run successfully on Computer with only 4.8 .Net framewor
I intend to build simple Winform application just to allow user to automate their file creation and store the last filled form in a file to keep it for next run.
thus, I'm not interested in creating ...
0
votes
0
answers
360
views
HttpClient.GetAsync fails after running for some time with TaskCanceledException "A task was cancelled" [duplicate]
I am using GetAsync method to retrieve the response from the server. The following code runs fine for the first two iterations and then errors out with the message "A task was canceled". I searched ...
0
votes
1
answer
941
views
C# - Parallel.Foreach() for Service Call
I have a console application which does 3 steps as mentioned below,
Get pending notification records from db
Call service to send email (service returns email address as response)
After getting ...
0
votes
0
answers
48
views
Storing and reading custom info from app.config in .Net Framework
I have a .NET Framework 4.6 application with classes that when instatiated they need to construct a dictionary. The dictionary will have string keys and values and I would like to store them in the ...