How to programmatically set COM+ Component -> Transactions to Not Supported? - windows

I am looking for a solution to programmatically modify Com+ Component Property -> Transaction Support to “Not Supported”
The manual steps are the following:
Open Component Services dialog (comexp.msc)
Expand Component Services -> Computers -> My Computer
Find and expand COM+ QC Dead Letter Queue Listener
Expand folder Components inside the opened component
Find component QC.DLQListener and open context menu for this component and select properties
On the Properties screen, select “Transactions” tab and set Transactions Support to Not Supported
Click “OK” to Save the changes

After I spent several hours on this problem, I've finally got a solution on C#.
I've got a huge insight from the following articles:
Changin the transaction atribute using COMAdminCatalog
Retrieve settings from COM+ components via C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COMAdmin;
namespace SetComPlusTransactionsToNotRequired
{
class Program
{
static void Main(string[] args)
{
COMAdminCatalog catalog;
COMAdminCatalogCollection applications;
// Get the catalog
catalog = new COMAdminCatalog();
// Get the list of all COM+ applications contained within this catalog
applications = (COMAdminCatalogCollection)catalog.GetCollection("Applications");
applications.Populate();
foreach (COMAdminCatalogObject application in applications)
{
if (application.get_Value("Name") == "COM+ QC Dead Letter Queue Listener")
{
COMAdminCatalogCollection components;
components = (COMAdminCatalogCollection)applications.GetCollection("Components", application.Key);
components.Populate();
foreach (COMAdminCatalogObject component in components)
{
Console.WriteLine("Component: " + component.Name);
component.set_Value("Transaction", COMAdminTransactionOptions.COMAdminTransactionNone);
}
components.SaveChanges();
}
}
}
}
}

Related

Unbound breakpoints when debugging in Blazor Webassembly when using certain attributes/classes

I'm developing a modular blazor application (5.0.2) using VS 2019 (16.8.4), which is structured as follows:
a "Main" Solution, which consists of
RCL
Wasm project to startup the application
several "Sub" solutions which reference the Main RCL (Base components, etc) which consist of
.net5 libraries (Models, Web-service access, etc)
RCL with components, referencing the .net5 libraries (via project reference)
All projects have a post-build event to copy the DLL and PDB files to a certain path, e.g. D:\TMP.
The SubSolution references the MainRCL library via this path.
The Main Wasm project references the SubRCL library also via this path (for adding services at startup/Program.cs).
The MainRCL does not have a reference to SubRCL (components are rendered via reflection/BuildRenderTree() according to configurable UI definition).
Debugging the Main Solution worked perfectly (IIS Express/Application Debugging).
Then I tried to debug the SubModules -> I started debugging from the MainSolution and opened files from the SubModules projects in this VS instance.
At some libraries, debugging was working, but not for the SubRCL ("Unbound Breakpoint"). Then I was able to reproduce the (very strange) issue with sample solutions:
The "MainRCL" provides 2 Attributes:
[AttributeUsage(AttributeTargets.Class)]
public sealed class TestNoEnumAttribute : Attribute
{
public string Name { get; set; }
public string Mode { get; set; }
public TestNoEnumAttribute(string name, string mode)
{
Name = name;
Mode = mode;
}
}
[AttributeUsage(AttributeTargets.Class)]
public sealed class TestEnumAttribute : Attribute
{
public string Name { get; set; }
public EventExecutionMode Mode { get; set; }
public TestEnumAttribute(string name, EventExecutionMode mode)
{
Name = name;
Mode = mode;
}
}
public enum EventExecutionMode
{
AutomaticAll = 0,
ManualConfiguration = 2
}
The SubRCL uses these attributes at a test-method:
[TestNoEnum("Test", "EventExecutionMode.ManualConfiguration")]
//[TestEnum("Test", EventExecutionMode.ManualConfiguration)]
public class Module1Test
{
public int IncreaseNum(int num)
{
var x = new Part1();
var part1Num = x.DoStuff(num);
var newNum = part1Num + 1;
return newNum;
}
}
The class "Part1()" which is called, is located at another library of the SubSolution
The breakpoint at the "DoStuff()" method in Part1 class is always hit (in separate .net5 library).
The breakpoint at the "IncreaseNum()" method is only called when the [TestEnum] attribute is NOT used.
As soon as the [TestEnum] attribute is used, there is an "Unbound Breapoint"; the breakpoint in "DoStuff()" method in another library is still hit.
Then I tried to "add existing project" to SubSolution and added the MainWasm project and started debugging directly from SubSolution -> same behavior.
Is there anything I oversee (e.g. regarding DLL-references or PDB file copy)?
This is already my second approach of trying to debug these modular-structured solutions - first I tried to debug via IIS (How to debug Blazor Webassembly on IIS with VS by attaching to Chrome?), but this was also not successful.
Found out there is an issue with debugging when using attribues with enum parameters:
https://github.com/dotnet/aspnetcore/issues/25380
-> I replaced the enum parameters and debugging is working fine now - Didn't get any feedback when this will be fixed so far
I had the same issue with my Blazor WASM not able to be debugged in VS due to 'Unbound breakpoint'. I have multiple projects running under the same solution and while initially the debugging worked for the WASM, it stopped after a while.
Eventually I was able to find a work around by waiting until all projects loaded and then I could disable the 'Unbound' breakpoint and re-select it. It then worked as expected.
It's not an ideal solution (especially if you have multiple breakpoints while troubleshooting) but it is workable.
I had this problem in .NET 6 and Visual Studio 2022.
I made a codebehind-file component.razor.cs but I also had code in the razor-file itself. Moving the code to the codebehind-file solved the issue and enabled the breakpoints.

Getting AppID for Windows Phone in Unity3d

I am developing game for windows phone in unity3d, I have inserted Rate me button in game but on run time in windows phone it didn't work, is there any method to access AppID for the current application running in windows phone developed in Unity3d. I need code in unity3d CSharp for getting AppID.
I tried this C# code in Unity but It didn't work and having error no keywork found windows.
string appId = Windows.ApplicationModel.Store.CurrentApp.AppId.ToString();
LinkUri = new Uri("http://www.windowsphone.com/s?appid=" + appId, UriKind.Absolute)
Here I needed AppID to complete my link for rate me.
As far as i know Unity can not access the Windows namespace but you can make use of EventHandler to call 'Review Task' from Unity. You can do this by following below steps(visit Unity Expert for detailed explanation).
In Unity Game Engine-
Create Event -
using UnityEngine;
using System;
public static class events
{
//Create a new event
public static event EventHandler RateUs;
public static void FireRateUs()
{
Debug.Log ("Opening Rate Task......");
//If event is subscribed than fire it
if(RateUs!=null)
RateUs(null,null);
}
}
Fire Event -
using UnityEngine;
public class RateUs : MonoBehaviour
{
void OnMouseDown()
{
events.FireRateUs();
}
}
In Visual Studio IDE
Subscribe Event -
public MainPage()
{
.
.
.
.
events.RateUs += events_RateUs;
}
Call Function -
void events_RateUs(object sender, EventArgs e)
{
String AppId = Windows.ApplicationModel.Store.CurrentApp.AppId.ToString();
Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:reviewapp?appid=" + AppId));
}
You have to get your AppID from your developer's portal on Microsoft Create's web page. You can then hardcode it into your app or save it as a static/globally available variable for accessing purposes. This would mean you would have to begin the process of creating your app entry prior to the programming of the rating game feature. Just create the entry, and don't submit it! Or create it, and add Rate app as an update. I'd choose the former method, personally!
For Apple and Google rating/submit information you have to create the entry ahead of time to get a SKU number. Also in iTunes/Apple/iOS/OSX you have to create the app and give it a unique name, etc in the developer's portal/certificate store.

BasicHttpBinding Error - Xamarin

Problem is not calling the wcf function using basichttpBinding and showing an error.
No host to route error comes up on Visual Studio.
Unhandled Exception:
System.Net.WebException: Error: ConnectFailure (No route to host)
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using HelloWorld_App4.localhost;
namespace HelloWorld_App4
{
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
localhost.Service1 obj = new localhost.Service1();
obj.GetData(32, true);
UIApplication.Main(args, null, "AppDelegate");
}
}
}
What license have you got?
If you only have the Indie license you wont be allowed to access web/wcf services and have to rely on rest services.
I found that out the hard way but then just switched ot using ASP.Net Web API to create my services. Simple and much cheaper that to buy the business license.

Windows bluetooth autopairing or disable authentication

I need windows to automatically pair with bluetooth devices. I don't want the user to have to click anything on the windows side. The server will be physically located somewhere the user cannot get to. Having to pair on the user side is fine. Windows just needs to accept any requests that come in without user input.
How can I accomplish this? Registry hacks? Replace a dll? A Hardware change (autopairing dongle or something)?
Is there any SDK that will give me the tools take care of this?
Currently I am using bluecove on the windows machine on top of Microsoft stack. I tried the Widcomm stack also with no luck.
The primary protocol that devices will use to connect is RFCOMM.
EDIT:
using the accepted answer below I came up with this code, that auto-pairs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InTheHand.Net.Bluetooth;
using System.Threading;
namespace BT
{
class BluetoothAutoSSP
{
public static void Main()
{
BluetoothAutoSSP c = new BluetoothAutoSSP();
EventHandler<BluetoothWin32AuthenticationEventArgs> handler = new EventHandler<BluetoothWin32AuthenticationEventArgs>(c.handleRequests);
BluetoothWin32Authentication authenticator = new BluetoothWin32Authentication(handler);
while (true)
{
Thread.Sleep(10);
}
}
public void handleRequests(Object thing, BluetoothWin32AuthenticationEventArgs args)
{
args.Confirm = true;
}
}
}
For the Microsoft Bluetooth stack: To support both traditional Bluetooth pairing as well as v2.1's Secure Simple Pairing use the BluetoothRegisterForAuthenticationEx function and in your callback function respond by calling BluetoothSendAuthenticationResponseEx.
See more at BluetoothWin32Authentication 32feet.NET docs which describes the way to handle that in the 32feet.NET Bluetooth library for .NET, my doc Bluetooth in Windows 7, and MSDN e.g. BluetoothRegisterForAuthenticationEx etc.
BTW Widcomm does not have a programatic way to respond to pairing (it does have a method to initiate pairing). BlueSoleil does have an API apparently.

PROBLEM :An error message cannot be displayed because an optional resource assembly containing it cannot be found

I created Windows Mobile Application and I loaded web service that contain one method (GetNumber). When I call this method from my emulator I got a following exception
An error message cannot be displayed because an optional resource assembly containing it cannot be found.
Can anyone help me. This is my code from WM Application, it is very siple.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MobileClientApp;
namespace MobileClientApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MobileClientApp.localhost.WebService m = new MobileClientApp.localhost.WebService();
int result;
bool resbool;
m.GetNumber(10, true, out result, out resbool);
label1.Text = result.ToString();
}
}
}
For a very good explanation:
http://blogs.msdn.com/b/netcfteam/archive/2004/08/06/210232.aspx
(excerpt from above)
There has been some confusion about the error message: "Could not find resource assembly". Basically, this means that there is some exception that has happened in the program. The error did not happen because it could not find the resource assembly. The resource assembly that it is searching for contains exception messages (strings) that would be helpful in debugging what went wrong with the program.
Since the user is never expected to see this error message if the program works as expected and all exceptions are handled appropriately, it was decided (due to size constraints) that the resource assembly that has these error strings are never put on a user's device. Thus the main target audience of these error strings are developers who would like to debug issues. Hence, when you do an F5 deploy onto the device, the System.SR.dll assembly which have these error strings are copied to the device and the developer can see the error messages. But in case .Net Compact Framework is installed from a redistributable or you are using .Net Compact Framework that come with the device (as a user of the device would be doing), the System.SR.dll is not present on the device. Hence, if the application did come upon an exceptional condition that wasn't handled by the application, this "Could not find resource assembly" message would be shown to the user.
If you are not using Visual Studio F5 deploy to the device and would still like to see the exception messages, you can achieve this by taking the System_SR_[Language].CAB where [Language] corresponds to the language in which you want to see the error message to appear and clicking on the cab file to install it
Sounds like you are missing an assembly in your deployment.

Resources