.net

Find all variables that point to the same memory in Visual Studio

拈花ヽ惹草 提交于 2021-02-11 14:25:12
问题 In Visual Studio 2008, is there a way of finding all the variables that point to the same object as another variable? So in the example below I would want to find out that ref1 and ref2 both point to the same object as original . var original = new List<string>() { "Some Data" }; var ref1 = original; var ref2 = ref1; Essentially I want to be able to call ReferenceEquals() on all the variables in memory and then see all the ones that are equal. Except I want to be able to do this in the VS2008

How do you run a variable number of concurrent parametrizable infinite loop type of threads in C#?

随声附和 提交于 2021-02-11 14:23:00
问题 I am creating my first multithreading C#/.NET based app that will run on a Azure Service Fabric cluster. As the title says, I wish to run a variable number of concurrent parametrizable infinite-loop type of threads, that will utilize the RunAsync method. Each child thread looks something like this: public async Task childThreadCall(...argument list...) { while (true) { try { //long running code //do something useful here //sleep for an independently parameterizable period, then wake up and

Cannot register device in Azure NotificationHub on iOS, no callbacks

浪尽此生 提交于 2021-02-11 14:21:52
问题 I'm trying to set up push notifications via Azure NotificationHub (using these guides). Android went fine, but iOS... No matter what I do, I do not receive any callbacks from RegisterNative / RegisterTemplate methods of SBNotificationHub , and no registrations appear in the hub. My code (pretty straightforward): public static void SubscribeToAzure(NSData deviceToken, string[] subscriptionTags = null, bool bUnsubscribe = false) { try { var Hub = new SBNotificationHub(AppConstants

Can't get GetPositionFromPoint to work well (WPF, C#)

我的未来我决定 提交于 2021-02-11 14:19:37
问题 I am trying to use the GetPositionFromPoint, and in the documentation it talks about the snapToText bool which, if false, "returns null if point is not inside a character's bounding box" . Anyway, I am receiving always a null TextPointer, even when my Point is on a character. I leave my code here, I am using a checkbox (called "check") to see if the TextPointer is null or not, and it is always unchecked: Point posicion = Mouse.GetPosition(Application.Current.MainWindow); TextPointer posAhora

.NET Service System.Net.Sockets.SocketException: 'No such host is known'

风流意气都作罢 提交于 2021-02-11 14:19:29
问题 I deployed a .NET Windows Service on Azure Virtual Machine running Windows Server with an opened port that allow me to connect to it, this service is like a server using socket. The problem is that when I try to connect from my PC to that hosted server it doesn't work and I get this exception: System.Net.Sockets.SocketException: 'No such host is known' . The port is opened and visible from my PC. Can someone tell me why I get that exception? If I run locally all works ok. 回答1: The Exception

Subscribing to a IBM MQ Topic from a .net client

ぐ巨炮叔叔 提交于 2021-02-11 14:16:53
问题 How to subscribe a IBM MQ topic from .net client in a subscriber model I have already a working copy of the code which is able to get message from the topic. string qmName = "Q1"; string hostName = "MyHost"; string strPort = "1114"; string channelName = "MyCh"; string transport = TRP; Hashtable connectionProperties = new Hashtable(); connectionProperties.Add(MQC.HOST_NAME_PROPERTY, hostName); connectionProperties.Add(MQC.PORT_PROPERTY, strPort); connectionProperties.Add(MQC.CHANNEL_PROPERTY,

How can I identify if a .exe file is 32-bit or 64-bit from C#

冷暖自知 提交于 2021-02-11 14:15:09
问题 How can I determine if an .EXE file (not my application, not another running application, not a .NET application) is 32-bit or 64-bit in C#? The best I found is this and I'm guessing there's a native .NET call. 来源: https://stackoverflow.com/questions/59911610/how-can-i-identify-if-a-exe-file-is-32-bit-or-64-bit-from-c-sharp

Powershell and winapi SystemParametersInfo function

狂风中的少年 提交于 2021-02-11 14:02:28
问题 I was trying this: $f=@' [DllImport("user32.dll")]public static extern int SystemParametersInfo( int uAction, int uParam, int lpvParam, int fuWinIni ); '@ $mSpeed = Add-Type -memberDefinition $f -name "mSpeed" -namespace Win32Functions -passThru $get = 0x0070 $set = 0x0071 $srcSpeed = $mSpeed::SystemParametersInfo($get, 0, 0, 0) $newSpeed = $srcSpeed + 1 $mSpeed::SystemParametersInfo($set, 0, $newSpeed, 0) but the mouse speed does not return. How do I write this down correctly? 回答1: According

User Secrets in .NET 4.7 connectionstrings format

拜拜、爱过 提交于 2021-02-11 13:55:48
问题 I have been digging for hours and keep coming up with information about .NET Core, yet hardly anything about .NET 4.7 full framework. I figured out how to add User Secrets to the main project of my Web API solution. I get the basic secrets.xml file where I need to to either store my database username and password or my connection string. Every post I find talks about the changes you need to make to web.config. However nothing shows what to do with my connection string, how to format it, in

After archiving xamarin forms app to apk, it does not work

江枫思渺然 提交于 2021-02-11 13:47:48
问题 I have my xamarin app, when i start it form VS2019 in Release or Debug mode it works great. If i archive it with visual studio, sign and install to mine or other android phone, it crashes. 回答1: APK can't get SQLite table, because i truncated that at start. Logcat helped me understand what the problem is. 来源: https://stackoverflow.com/questions/61630822/after-archiving-xamarin-forms-app-to-apk-it-does-not-work