Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all 8156 articles
Browse latest View live

PowerShell via Managed C++: PSCmdlet vs ps command vs powershell vs Cmdlet Classes

$
0
0

Hi,

I am trying to execute PS Command(Via Managed C++ code). I found so many variants for the same.

Can someone explain me whats the difference between below 4 or more if there any any such:
PSCmdlet class vs ps command class vs powershell class vs Cmdlet Classes below:

1. https://msdn.microsoft.com/en-in/library/system.management.automation.powershell(v=vs.85).aspx

2. https://msdn.microsoft.com/en-us/library/system.management.automation.pscommand_members(v=vs.85).aspx

3. https://msdn.microsoft.com/en-us/library/ms714395(v=vs.85).aspx

Its so confusing.

Thanks !




Using Bluetooth LE GAP/GATT Services without pairing manually first.

$
0
0

We are currently developing a Windows 10 Universal App.
The target is to communicate with our industrial devices over Bluetooth LE by means of the standard GAP/GATT services.
Normally for this purpose (non Windows systems) it is not necessary to pair the device first, GAP/GATT services do not require the pairing.
Just for completeness: we have already the same app for iOS and Android, and both work fine without pairing the Bluetooth LE devices first.
Our current knowledge is that under Windows 10 one MUST pair the device before any GAP/GATT communication can take place.
There is even a second (minor) problem: pairing can be done only from Windows, not programmatically from inside our app, there are no Windows API for this.

The biggest problem is that our industrial devices do not accept pairing. There is a precise hardware reason behind, I'm not expert in this therefore I can't give more details about that.

What can we do to be able to communicate by means of GAP/GATT services (within a Windows 10 Universal App) without pairing first?

Just in case that this shall not be possible (this would be a big problem for us) I might ask, as a consequence, when shall be available API under Windows 10 that allow to pair Bluetooth LE devices programmatically within the app itself.
This would not solve our main problem, however.

I hope my question is clear enough, feel free to contact me for any question/further clarification about our problem.

SerialPort.Open() behaviour question

$
0
0

Hi,

I'm trying to figure out what is the correct way to query all my machine devices that are connected via serial com port, and get a specific one that i want to talk to.

I have to devices connected to my machine:

1. usb mouse (COM3)

2. another device (COM20)

My goal is to establish a connection to the COM20 device, but when i iterate on the available devices, when i get to COM3 and call serialPort.open() it doesn't throw an exception (something that would say "another process uses this device...") and eventually i'm afraid that the next thing that will happen is that i'll write a buffer to this WRONG port.

what is happening here? and what is the best practice?

thx


MOses

List item added as non-public

$
0
0

I'm trying to add an item to a list like so:

List<CTParticipant> currentParticipants = new List<CTParticipant>();
foreach (Participant participant in conversation.Participants)
{
    CTParticipant currentParticipant = new CTParticipant()
    {
         SipUri = participant.Contact.Uri,
         Name = "Name"
     };

     currentParticipants.Add(currentParticipant);
}


Conversation is a Microsoft.Lync.Model.Conversation.Conversation

CTParticipant is

public class CTParticipant
{
   public string SipUri { set; get; }
   public string Name { set; get; }
}

But all participants are added as non-public members. Why is that?

If I create a List<string> and add some strings, everything is ok.

VSTO Expose Addin Object in Another Solution

$
0
0

I have created One Add in for Outlook.and i want to Expose AddIn Functionality in Some Other solution in my case i want to access in Windows Application.

I use Below Code :
Outlook Addin :
    [ComVisible(true)]
    public interface IOutlookUtilities
    {
        void DoSomething();
    }


    public class AddInUtilities: StandardOleMarshalObject,IOutlookUtilities
    {
        public void DoSomething()
        {
            System.Windows.Forms.MessageBox.Show("Outlook Add in Called");
        }

    }

ThisAddIn Class:
        private AddInUtilities utilities;
        protected override object RequestComAddInAutomationService()
        {
            try
            {
                if (utilities == null)
                {
                    utilities = new AddInUtilities();
                }
                return utilities;
            }
            catch (System.Exception ex)
            {
                // Catch your ex here
            }
            return null;
        }


Windows Application :


    Outlook.Application outLook = new Outlook.Application();
    object addinName = "OutlookAddIn3";

    COMAddIn addin = outLook.COMAddIns.Item(ref addinName);

    var utilities = (IOutlookUtilities)addin.Object;                                                                                                utilities.DoSomething();

I have also check Add in successfully register in Registry.and Addin Name.

in ABove Code utilities object is always null.

can you please help

          

How does SignalR associate clients to their authenticated username that enables this server side: context.Clients.User(username)

$
0
0

Hello, I have code that was written by someone else. It is using a signalR hub design and when the server side c# code needs to notify the correct connected client, it accesses the IHubContext's Clients.User() method and passes in the username:

_context.Clients.User(msg.UserId).notify(msg);
...msg.UserId is a string respresenting the user's username. msg is just an object with 

I just don't understand how, and I can't find the code that ties each client to their authenticated identity's name to enable signalR server side to find them.

Can someone shed some light on this?

thanks

Trouble Getting SignedXml.CheckSignature() to work

$
0
0
I'm trying to verify a message that arrives at the method below as an XmlDocument. The document is created with PreserverWhitespace=true and is created from a base64 decoded string recieved from an HTTP Post. The error I'm getting is: Malformed Reference Element. I get the basic idea of what the error is saying but I'm not sure where to go to figure out what needs to be done to fix this so it validates. I have very limited control of the incoming xml so a fix that doesn't require modifying that would be best. I'll take links to articles or anything that will help if you can't see the solution at a glance.
thanks for any help.
Code Snippet

private void VerifySAML(System.Xml.XmlDocument docToVerify)
        {
            try
            {
                SignedXml sXml = new SignedXml(docToVerify);
                sXml.LoadXml((XmlElement)docToVerify.GetElementsByTagName("ds:Signature")[0]);
                if (sXml == null)
                    throw new SsoException("Could not locate signature in assertion");

                //assertion must be correctly verified against itself
                if (!sXml.CheckSignature())
                    throw new SsoException("Assertion failed verification");
               ...
            }
            catch (Exception ex)
            {
                AprimoEventLog.Instance.LogError(ex);
                throw new SsoException("SAML Verification failed.", ex);
            }
        }



The string of Xml after decoding looks like:
Code Snippet
<Response xmlns="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" IssueInstant="2008-02-29T13:31:55.050Z" MajorVersion="1" MinorVersion="1" Recipient="http://208.40.237.98/aprimomarketing" ResponseID="_95754da531d7d92a7f287242eca5c9da"><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:CanonicalizationMethod>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod>
<ds:Reference URI="#_95754da531d7d92a7f287242eca5c9da">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="code ds kind rw saml samlp typens #default xsd xsi"></ec:InclusiveNamespaces></ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod>
<ds:DigestValue>OxUFDbe2eXnxbtjNFz2P2+9uYYM=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
L/cUk4QluOiNtzu8ffiG/TSVm3D8Z6JjUSZi6jqJLwzGT9ApsjhvUbDqJZLSRaDQFT1y0SBM0p+p
sbtDTkiWKGtQfQ2D7Ta40ZIJUNgDsC+d2/m1iUKXg3m0ff/yKxH1hz9OV4Tx1RO4DlVOmKbSgRR0
pKL0YxNE7UqmoFggvlo=
</ds:SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>
MIICkzCCAfygAwIBAgIER2aoYzANBgkqhkiG9w0BAQUFADCBjTELMAkGA1UEBhMCVVMxCzAJBgNV
BAgTAk5KMQ8wDQYDVQQHEwZOZXdhcmsxHTAbBgNVBAoTFFBydWRlbnRpYWwgRmluYW5jaWFsMS8w
LQYDVQQLEyZBcmNoaXRlY3R1cmUgYW5kIFRlY2hub2xvZ3kgRW5hYmxlbWVudDEQMA4GA1UEAxMH
ZmltdGVzdDAeFw0wNzEyMTcxNjQ4MzVaFw0xMDEyMTYxNjQ4MzVaMIGNMQswCQYDVQQGEwJVUzEL
MAkGA1UECBMCTkoxDzANBgNVBAcTBk5ld2FyazEdMBsGA1UEChMUUHJ1ZGVudGlhbCBGaW5hbmNp
YWwxLzAtBgNVBAsTJkFyY2hpdGVjdHVyZSBhbmQgVGVjaG5vbG9neSBFbmFibGVtZW50MRAwDgYD
VQQDEwdmaW10ZXN0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCB996Ig5Wxoxwn3zwu7h1Z
N60UtQ9Ijff4v44457Zsh+mTxl6fCmOtc44bPkEeP1P75FQBVxUKBXQJ8mSm4luEA3lZuraDtkYB
PpjgKy2bQMllNPmWu6VbfEYP4T8lqHbFAdSZXLzOd3IFoNtbEbMzTmJnCuR00A7v5BlxFZoyqwID
AQABMA0GCSqGSIb3DQEBBQUAA4GBABhJIOE8D9bIVRJ+R7KhRGb6I0rENe9PwF85Uk5MVme+F1ny
OXhsP3NHT0L24fbRW7kdp6eHPIMftFlaN8OTMjfSgSKdrRS7i1+hARZ7HcYxqT+HFXag3mH2G7GL
brQifLzzWQoPxwbtyJ/DJP+zChYt2nKjUXDMcB2GYghZg+PA
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo></ds:Signature><Status><StatusCode Value="samlp:Success"></StatusCode></Status><Assertion xmlns="urn:oasis:names:tc:SAML:1.0:assertion" AssertionID="_d815953e87678d0ba2aab2c167c06640" IssueInstant="2008-02-29T13:31:55.069Z" Issuer="http://www.prudential.com/samlassertingparty/AP" MajorVersion="1" MinorVersion="1"><Conditions NotBefore="2008-02-29T13:31:55.051Z" NotOnOrAfter="2008-02-29T13:33:55.051Z"><AudienceRestrictionCondition><Audience>http://208.40.237.98/aprimomarketing</Audience></AudienceRestrictionCondition></Conditions><AuthenticationStatement AuthenticationInstant="2008-02-29T13:31:55.051Z" AuthenticationMethod="urn:oasis:names:tc:SAML:1.0:am:password"><Subject><NameIdentifier Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName" NameQualifier="aprimo.com">X150740</NameIdentifier><SubjectConfirmation><ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:bearer</ConfirmationMethod></SubjectConfirmation></Subject></AuthenticationStatement><AttributeStatement><Subject><NameIdentifier Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName" NameQualifier="aprimo.com">X150740</NameIdentifier><SubjectConfirmation><ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:bearer</ConfirmationMethod></SubjectConfirmation></Subject><Attribute AttributeName="username" AttributeNamespace="aprimo.com"><AttributeValue>X150740</AttributeValue></Attribute><Attribute AttributeName="datasource" AttributeNamespace="aprimo.com"><AttributeValue>LeadManagement</AttributeValue></Attribute></AttributeStatement><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:CanonicalizationMethod>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod>
<ds:Reference URI="#_d815953e87678d0ba2aab2c167c06640">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="code ds kind rw saml samlp typens #default xsd xsi"></ec:InclusiveNamespaces></ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod>
<ds:DigestValue>hpGN3B+fS8bt2Bbxg/ySEqKb+M4=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
c5ik97ieGD4JYWjBaD3H9z9HalEwAghn3EDeo56hbf2sG3Xtw01vSIVl+MZQwF7W3LlaTCphGnSf
qrbNjVQWDcEUmwaJ1E6kjgHITJJLYGqPacYzGddqgs+KXuhaSot1WgEhyEUBqDvvcPKhGh0UcYFe
VlA8OQCC6H1yfOqW7i0=
</ds:SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>
MIICkzCCAfygAwIBAgIER2aoYzANBgkqhkiG9w0BAQUFADCBjTELMAkGA1UEBhMCVVMxCzAJBgNV
BAgTAk5KMQ8wDQYDVQQHEwZOZXdhcmsxHTAbBgNVBAoTFFBydWRlbnRpYWwgRmluYW5jaWFsMS8w
LQYDVQQLEyZBcmNoaXRlY3R1cmUgYW5kIFRlY2hub2xvZ3kgRW5hYmxlbWVudDEQMA4GA1UEAxMH
ZmltdGVzdDAeFw0wNzEyMTcxNjQ4MzVaFw0xMDEyMTYxNjQ4MzVaMIGNMQswCQYDVQQGEwJVUzEL
MAkGA1UECBMCTkoxDzANBgNVBAcTBk5ld2FyazEdMBsGA1UEChMUUHJ1ZGVudGlhbCBGaW5hbmNp
YWwxLzAtBgNVBAsTJkFyY2hpdGVjdHVyZSBhbmQgVGVjaG5vbG9neSBFbmFibGVtZW50MRAwDgYD
VQQDEwdmaW10ZXN0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCB996Ig5Wxoxwn3zwu7h1Z
N60UtQ9Ijff4v44457Zsh+mTxl6fCmOtc44bPkEeP1P75FQBVxUKBXQJ8mSm4luEA3lZuraDtkYB
PpjgKy2bQMllNPmWu6VbfEYP4T8lqHbFAdSZXLzOd3IFoNtbEbMzTmJnCuR00A7v5BlxFZoyqwID
AQABMA0GCSqGSIb3DQEBBQUAA4GBABhJIOE8D9bIVRJ+R7KhRGb6I0rENe9PwF85Uk5MVme+F1ny
OXhsP3NHT0L24fbRW7kdp6eHPIMftFlaN8OTMjfSgSKdrRS7i1+hARZ7HcYxqT+HFXag3mH2G7GL
brQifLzzWQoPxwbtyJ/DJP+zChYt2nKjUXDMcB2GYghZg+PA
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo></ds:Signature></Assertion></Response>

Problems loading the correct DependencyInjection Assembly

$
0
0

Please redirect me to the correct forum if this is not the place to post this issue.

I am having problems with my Asp.Net 5 MVC6 DNX 4.5.1 & DNX Core 5.0 project. It was created with Visual Studio 2015 Update 1 and then upgraded Visual Studio 2015 Update 2.

When I go to Startup.cs, ConfigureServices() and try to add Services.TryAdd....() I get the following error:

CS1061 'IServiceCollection' does not contain a definition for 'TryAddScoped' and no extension method 'TryAddScoped' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)

If I create a new Asp.Net 5 MVC6 project all the Services.TryAdd...() methods show up and compiles correctly.

I know the 'IServiceCollection' is defined in Microsoft.Extensions.DependencyInjection.Abstractions.dll.

I researched most of a day only to find out the TryAdd...() methods were added back in Nov 2015.

I located all the Microsoft.Extensions.DependencyInjection.Abstractions.dll files on my system and they all contain the TryAdd...() methods.

I have tried the following without any success:

I delete all the package folders from:
    %USERPROFILE%\.dnx\packages
    %USERPROFILE%\.nuget\packages

Uninstalled Microsoft Web Tools

Removed "C:\Program Files (x86)\Microsoft Web Tools" folder and files

Re-Ininstalled Microsoft Web Tools

I cleared out all unlocked files and folders from
    %temp%

I deleted all the folders and files from
    C:\Windows\Microsoft.NET\Framework/v4.0.30319\Temporary ASP.NET Files\

Performed a Visual Studio 2015 Repair

I have deleted most everything I could find in the Solution Folder and hidden folders that was not project or source code related.

I am at a total loss about what is causing this. It defies basic logic and presents big concerns about how to maintain and upgrade projects to newer releases of packages and assemblies.

Any help and/or guidance will be greatly appreciated.

Brooks


unexpected failures while processing files that contain SignedXml, after application of security update 3141780 (MS16-035)

$
0
0

Hello,

I'm currently exactly in the situation described by Microsoft at kb/3148821

I modified registry keys as described by Microsoft, but I still have error while processing signed xml.

Below is the StackTrace

   à MS.Internal.IO.Packaging.CustomSignedXml.RequireNCNameIdentifier()
   à MS.Internal.IO.Packaging.CustomSignedXml.GetIdElement(XmlDocument document, String idValue)
   à System.Security.Cryptography.Xml.Reference.CalculateHashValue(XmlDocument document, CanonicalXmlNodeList refList)
   à System.Security.Cryptography.Xml.SignedXml.CheckDigestedReferences()
   à System.Security.Cryptography.Xml.SignedXml.CheckSignature(X509Certificate2 certificate, Boolean verifySignatureOnly)
   à MS.Internal.IO.Packaging.XmlDigitalSignatureProcessor.Verify(X509Certificate2 signer)
   à System.IO.Packaging.PackageDigitalSignature.Verify(X509Certificate signingCertificate)

Microsoft proposed no registry key in relation to RequireNCNameIdentifier to modify.

I also applied complementary registry modification proposed by Anders Abel (breaking-changes-to-signedxml-in-ms16-035), but I still have the same error.

Did somebody else encounter this issue? any idea how to solve it (without uninstall the security update)?


Best Regards,


Prosper

MVC HttpPost ActionResult issue

$
0
0

Hello dear MSDN and thank you for going through this post,


As described in title my problem is about MVC and ActionResult.


Whatwe want:

Its a recipe website , where you can submit a recipe and search for recipes.

On the submit form we want that ifan itemis clickedfrom the dropdownListFor(list of ingredients) that is linked with aIngredientModel, the selected item should be inserted intoa listbox (selected ingredients).


Whatwe have:


A Controllerand HttpPostActionResult method that is called Submit.

The whole formsubmitrecipeis divided into 3forms(1 HtmlBeginForm & 2 Html.Partial)


1stformisthe addnewingredient(to addnewingredient)txtBox and button.(partial view)
2nd form isaddToListBox(where theselected items fromdropdownListforshouldcome intolistbox)(partial view)

3rdformis the rest(title, description, steps,imgetc ... andtherecipe Submitbutton.(main view)

@using (Html.BeginForm())
{<div class="recipes-home-body inner-page"><div class="container"><div class="row"><div class="col-md-12 col-lg-9"><div class="recipe-set submit-recipe-set"><h2>Submit Recipe</h2><p>
                        Food Recipe theme include a Recipe Submit Template. It allow users to submit a recipe with featured image and related details. A user
                        should be logged in to submit a recipe.</p><div class="submit-recipe-form">
                        @Html.Partial("AddIngredientX");

                        @Html.Partial("CreateIngredientX");
                       @using (Html.BeginForm()) {



                           @Html.LabelFor(model => model.Recipe.Title, "Recipe Title")
                            @Html.EditorFor(model => model.Recipe.Title)<br />

                            @Html.LabelFor(model => model.Recipe.Description, "Description")
                            @Html.TextAreaFor(model => model.Recipe.Description)<br />

                            @Html.LabelFor(model => model.Recipe.Image, "Upload Image")
                            @*<label for="upload-image">Upload Image</label>*@<input type = "file" name = "fileUpload" id = "upload-image" /><br /><div><fieldset class="ingredient-set">
                                    @Html.ListBoxFor(model => model.Ingredients, new MultiSelectList(Model.SelectedIngredients), new { style = "width:50%;" })</fieldset></div>

                            @*<div><button type="submit" id="hiddenButton" class="recipe-submit-btn" onclick="loadScriptAndInit();"></button></div>*@<fieldset class="ingredient-set">
                                    @Html.LabelFor(model => model.Recipe.Preparation, "Steps")<ul class="list-sortable steps"><li><div class="add-fields"><span class="handler-list"><i class="fa fa-arrows"></i></span>
                                                @Html.TextAreaFor(model => model.Recipe.Preparation)<span class="del-list"><i class="fa fa-trash"></i></span></div></li></ul><span class="add-button add-steps"><i class="fa fa-plus"></i></span></fieldset><div class="text-center"><button type="submit" class="recipe-submit-btn">Submit Your Recipe</button></div>
                        }

Inthe RecipeController there isa httpPost ActionResult Submit(which servesto put entirerecipe into DataBase)that works, butbefore we want to putrecipe inDB we want to have :

- An httpPostActionResult AddIngredientToListBox to putthe selectedItems from the dropdownListForin a List<SelectedItem>  andeach time a item is clicked from the dropdownlistfor show that "updated"list <SelectedItem> in the listbox withtheselecteditems.

-An  httpPost ActionResult AddNewIngredient that adds an new ingredient into DB (or listbox and afterwards in DB)


PROBLEM IS :

When theselecteditemchanges from thedropdownList, we're goinginto theSubmitActionResult and not in theAddIngredientToListBoxActionResult ...

I have searched an entire afternoon with my teacher (im student) and he didn't find the reason neither...

Thank you for your time !

Kind regards.



Determining the actual maximum size of a shared-memory MemoryMappedFile in an IPC scenario

$
0
0

I am using MemoryMappedFile.CreateOrOpen() to create a new or open a previously-created named memory map from concurrent threads and processes. Occasionally, there will be a re-creation of the memory map, so I need to know when a request to create a differently-sized map is placed (e.g., to explicitly change its size) whether there was an existing map of the given name that was opened (with the old and potentially wrong size) or a new one, with the correct size. The class does not have any members to help and determine the mapped maximum size, so I need a way to do this myself. I could keep track of it separately, but that would be redundant if the information is already available.

I could live without knowing the exact size as long as it would fit (i.e., whether the actual size is same or larger), but I'd prefer to know the actual maximum size so that I know - in case it is smaller - when I need to release and re-create the mapping. What is an efficient and elegant way to do that? A non-elegant way would be to use OpenExisting() to check explicitly, but I still need to keep track of the old size (in case it is the same), and I also don't like running into exceptions.

Kamen


Currently using Visual Studio 2013 U5, native C&#43;&#43; (Windows API) and C# (.Net, WPF), on Windows 7 64-bit; Mountain Time zone.

Microsoft.PowerBI.Api.Beta Namespace

$
0
0

hi , i would like to see some c# code examle for api rest power Bi  in  Microsoft.PowerBI.Api.Beta functions .

like how to create new dataSet with tables and how to add new Rows in some Table/s.

theres functions like PostRows(param..)  or PostDataset(param..) that i dot undestand..

please help me. thank you.

Add Reference to OpenXML package in c# console application

$
0
0
I want to use OpenXML functions in my c# code. For this downloaded the OpenXMLSDKv2.msi and

OpenXMLSDKTool.msi sdk.

And for adding this to my console application I am trying to add reference to my application from:-

Project>Add Reference > Browse.

But when I try to browse the above downloaded .msi files, it throws error of incorrect type. What is the correct way to add and use the OpenXml functions?


Thanks.


Unwanted syntax changes to FxCop file

$
0
0

Firstly, I hope this forum is appropriate for this question. I originally posted it in the "Where is the forum for...?" forum, and two possibilities, including this one, were suggested to me. The other one, Visual Studio Code Analysis and Code Metrics, does seem more relevant but it has been archived.

We use FxCop on our project. All of our code is in C#.

When some developers make FxCop changes (e.g. remove suppressions) many unwanted changes are made to the FxCop file. For other developers, this does not happen.

This is an example of a portion of the file before making changes (this portion is unrelated to the changes we wanted to make):

<MemberName="#Bar`1(!!0,!!0)"><Messages><MessageId="Bar"TypeName="IdentifiersShouldBeCasedCorrectly"Category="Microsoft.Naming"CheckId="CA1709"Status="Excluded"><IssueName="Member"><Item>Bar</Item><Item>Foo.Bar&lt;T&gt;(T, T)'</Item><Item>Bar</Item></Issue></Message></Messages></Member><MemberName="#Bar(System.Int32,System.Int32)"><Messages><MessageId="Bar"TypeName="IdentifiersShouldBeCasedCorrectly"Category="Microsoft.Naming"CheckId="CA1709"Status="Excluded"><IssueName="Member"><Item>Bar</Item><Item>Foo.Bar(int, int)'</Item><Item>Bar</Item></Issue></Message></Messages></Member>

Afterwards, the same section looks like this:

<MemberName="#Bar`1(!!0,!!0)"><Messages><MessageId="Bar"TypeName="IdentifiersShouldBeCasedCorrectly"Category="Microsoft.Naming"CheckId="CA1709"Status="Excluded"><IssueName="Member"><Item>Bar</Item><Item>Foo.Bar(Of T)(T, T)'</Item><Item>Bar</Item></Issue></Message></Messages></Member><MemberName="#Bar(System.Int32,System.Int32)"><Messages><MessageId="Bar"TypeName="IdentifiersShouldBeCasedCorrectly"Category="Microsoft.Naming"CheckId="CA1709"Status="Excluded"><IssueName="Member"><Item>Bar</Item><Item>Foo.Bar(Integer, Integer)'</Item><Item>Bar</Item></Issue></Message></Messages></Member>

So it looks like C# syntax is being changed to VB.NET syntax throughout (e.g. becomes (Of T), int becomes Integer).

The number of changes makes it almost impossible to see what changes were actually made when looking at the diff.

We are all on the same version of FxCop. We've looked through the settings and found nothing we could change, tried re-installing, Googled aplenty... does anyone have any suggestions on what might be causing this?

Compare two word documents c# and get differences

$
0
0

We are trying to build a console application in c#. The application needs to open a word document convert it to XML and then compare the XML against an another XML that is also generated from a word doc. The app is then supposed to generate the differences in the two documents. We are trying to achieve this using OpenXML api and some of the code samples provided there such as:-

using (WordprocessingDocument doc = WordprocessingDocument.Open("Test.docx", false)) {    XElement root = doc.MainDocumentPart.GetXDocument().Root;    XElement paragraph = root.Descendants(W.p).First();    Console.WriteLine(paragraph.Value); }

For implementing the above sample we have included the following references:-

using System.Xml.Linq;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Wordprocessing;
using DocumentFormat.OpenXml.Packaging;

But we are just not able to test the above mentioned code, as it throws error on the line below:-

    XElement root = doc.MainDocumentPart.GetXDocument().Root;

"'DocumentFormat.OpenXml.Packaging.MainDocumentPart' does not contain a definition for 'GetXDocument' and no extension method 'GetXDocument' accepting a first argument of type 'DocumentFormat.OpenXml.Packaging.MainDocumentPart' could be found (are you missing a using directive or an assembly reference?)"

Is there something that we are missing here? Or any other documentation or tutorial that shows the complete steps with the help of an example to show the use of WordprocessingDocument?

Thanks.








new license terms for NuGet package Microsoft.Diagnostics.Tracing.EventSource

$
0
0

I've been using the following NuGet packages in a few services I maintain:

I was going to upgrade these to version 1.1.28 today, but Visual Studio wanted me to accept a license first. The license now contains a clause that was not included in the "License-Stable.rtf" files installed by version 1.1.25 of these packages:

2.    DATA. The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to improve our products and services. You can learn more about data collection and use in the help documentation and the privacy statement at http://go.microsoft.com/fwlink/?LinkId=528096. Your use of the software operates as your consent to these practices.

The license web page has the "Last-Modified: Mon, 11 Apr 2016 20:21:39 GMT" header. Perhaps the license terms were modified on that date.

The NuGet Gallery pages for version 1.1.25 also refer to the same license web page. Perhaps that means the current license terms will apply to new downloads of the old version, too.

Issue with nlssorting.dll

$
0
0

We are facing issue with nlssorting.dll. Windows service is crashing after sometime of start with below message.

Faulting application name: FreeusListenerService.exe, version: 1.0.8.7, time stamp: 0x56fbcf1a
Faulting module name: nlssorting.dll, version: 4.0.30319.17929, time stamp: 0x4ffa5787
Exception code: 0xc00000fd
Fault offset: 0x00000000000012e2
Faulting process id: 0x81a4
Faulting application start time: 0x01d18e3fe1e9220b
Faulting application path: C:\Program Files\spectraforce technologies\FreeusListenerService4.0\FreeusListenerService.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\nlssorting.dll
Report Id: 52b6b3df-fa36-11e5-88ac-bc764e05b632

I have collected this information from "Event Log Viewer". Please correct me if we are doing wrong in our codding part regarding this DLL.  But I am sure that nowhere we are using this DLL. We are creating my setup file using "Orca" tool and it was working fine from last 2-3 years. We just saw this issue from last 2 weeks only.

Is there any version issue with this DLL or any support has been stopped from Microsoft for this DLL?

Thanks in Advance.


i try but i could not publish my web site because this error

$
0
0
this is the error that arose with in my website, please how i can fix this...

i really dont know how to solve this issue.



The System.Management namespace is no longer supported

$
0
0

In this link I am reading "The System.Management namespace is no longer supported"<o:p></o:p>

on other hand, if I check the namespace description (link),I don't see that it is deprecated or obsolete.<o:p></o:p>

Can you explain? What is roadmap for WMI? if it is deprecated should I use microsoft.management namespace and winRM?<o:p></o:p>


Architect

Getting (impossible!) ArgumentNullException from EnsureStrongCryptoSettingsInitialized() in System.Net.Http when sending email

$
0
0

I have a WPF app running on the 4.6.1 framework.

I am trying to send an email. It works perfectly on other PCs, but not two that I am aware of. One is Windows 10 - the other 8.1. Both have 4.6.1 framework installed.

Here is my email-sending code:

var messageContents = "Some Body";
var message = new MailMessage(
                    @"an.email.address@gmail.com","different.address@microsoft.com.au",
                    $"🐞 Fatal errors from AppName",
                    messageContents)
                {
                    From = new MailAddress(@"an.email.address@gmail.com", "A Display Name"),
                    ReplyToList = {@"random@gmail.com"},
                    Sender = new MailAddress(@"an.email.address@gmail.com", "Sender Display"),
                };

var attach = new Attachment(file); // Create  the file attachment for this e-mail message.
message.Attachments.Add(attach); // Add the file attachment to this e-mail message.
var client = new SmtpClient
{
    EnableSsl = true,
    Host = @"smtp.gmail.com",
    Port = 587,
    Credentials = new NetworkCredential(@"an.email.address@gmail.com", @"*AppropriatePassword*"),
};

client.Send(message);

When this executes, in the client.Send method, I get a

Exception thrown: 'System.ArgumentNullException' in mscorlib.dll

Additional information: Value cannot be null.

With the resulting callstack:

     mscorlib.dll!System.Enum.TryParseEnum(System.Type enumType, string value, bool ignoreCase, ref System.Enum.EnumResult parseResult)    Unknown

     mscorlib.dll!System.Enum.Parse(System.Type enumType, string value, bool ignoreCase)    Unknown
     System.dll!System.Net.ServicePointManager.EnsureStrongCryptoSettingsInitialized()    Unknown
     System.dll!System.Net.ServicePointManager.SecurityProtocol.get()    Unknown
     System.dll!System.Net.TlsStream.ProcessAuthentication(System.Net.LazyAsyncResult result)    Unknown
     System.dll!System.Net.TlsStream.Write(byte[] buffer, int offset, int size)    Unknown
     System.dll!System.Net.PooledStream.Write(byte[] buffer, int offset, int size)    Unknown
     System.dll!System.Net.Mail.SmtpConnection.Flush()    Unknown
     System.dll!System.Net.Mail.ReadLinesCommand.Send(System.Net.Mail.SmtpConnection conn)    Unknown
     System.dll!System.Net.Mail.EHelloCommand.Send(System.Net.Mail.SmtpConnection conn, string domain)    Unknown
     System.dll!System.Net.Mail.SmtpConnection.GetConnection(System.Net.ServicePoint servicePoint)    Unknown
     System.dll!System.Net.Mail.SmtpTransport.GetConnection(System.Net.ServicePoint servicePoint)    Unknown
     System.dll!System.Net.Mail.SmtpClient.GetConnection()    Unknown
     System.dll!System.Net.Mail.SmtpClient.Send(System.Net.Mail.MailMessage message)    Unknown
     name.dll!name.FatalExceptionHandler.EmailZipfile(string file) Line 196    C#

According to the documentation on line 690 @ http://referencesource.microsoft.com/#System/net/System/Net/ServicePointManager.cs,3528c78e8b71ece2,references

It should swallow any parse exceptions, including ArgumentNullException.

So - What's going on? What am I looking at? How do I sort this out?


Viewing all 8156 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>