CDHtmlDialog OnInitDialog throws exception when loaded in context of CredentialUIBroker.exe - windows

My credentialprovider has a CDHtmlDialog which throws an exception only when the credprov dll is loaded by credentialuibroker.exe (the UAC like prompt with the title Windows Security, when you do remote or access a network folder).The credential provider displays the CDHtmlDialog successfully during Windows logon (logonui.exe) or accessing a network resource (explorer.exe).
Note that the exception is inside MFC's implementation of CDHtmlDialog.
File - dlgdhtml.cpp.
BOOL CDHtmlDialog::OnInitDialog()
{......
m_wndBrowser.CreateControl(CLSID_WebBrowser, NULL, WS_VISIBLE | WS_CHILD, rectClient, this, AFX_IDC_BROWSER);
lpUnk = m_wndBrowser.GetControlUnknown();
// The next line throws exception that - Unhandled exception at 0x6be243d8 (mfc100.dll) in CredentialUIBroker.exe: 0xC000041D: An unhandled exception was encountered during a user callback.
if (FAILED(lpUnk->QueryInterface(IID_IWebBrowser2, (void**) &m_pBrowserApp)))
{......
}
}
I have tried with same results, the sample credential provider available in MS SDK. I have tried Visual Studio 2010 and Visual Studio 2015. I have tried adding CoInitialize, AfxOleInit to InitInstance.
Let me know if anybody has suggestions on what could be wrong.
Thank you

Related

visual studio doesnt catch ThreadAbortException

I've set up ThreadAbortException in the VS debug exceptions dialog, but it never breaks, even if I Thread.Abort() explicitly in my code.
I can see entries in the console such as:
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in System.dll
An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code
Is there any way to get VS to break on these exceptions? (I'm using VS Express 2012 for desktop, but have access to the full VS if needed)
Redirect() calls End() which throws a ThreadAbortException exception upon completion. This is one source of such exceptions.
To break on exceptions select
Debug->Exceptions and for the Common Language Runtime Exceptions place a check in the Thrown column.
You can verify your settings are correct by running this sample code in a console application. The debugger should halt at the point where the thread is aborted.
using System.Threading;
using System.Threading.Tasks;
namespace AbortThread
{
class Program
{
static void Main( string[] args )
{
Task.Run( () => Thread.CurrentThread.Abort() );
}
}
}

advertising Ad control disappear and Throws Exception in windows phone 7

i am getting exception from Adcontrol as
"A first chance exception of type 'Microsoft.Advertising.Mobile.Shared.AdException' occurred in Microsoft.Advertising.Mobile.dll".
my ad control is disappear and throw this kind of exception so what should i do for this kind of problem please Tell me if anybody known
The exception is probably thrown because there isn't any ad served.
Your app will only receive ads if they are available. If it is not the case, the control disappears. You get that exception while you are debugging the app, but when deployed and executed in a real device, it doesn't make the app break.
Anyway, just to make sure that this is what causes the exception you can subscribe to the ErrorOccurred event of the ad control, and check what happens:
private void AdControl_ErrorOccurred(object sender, Microsoft.Advertising.AdErrorEventArgs e)
{
System.Diagnostics.Debug.WriteLine("Ad Error : ({0}) {1}", e.ErrorCode, e.Error);
}

what is the cause of 'System.IO.IsolatedStorage.IsolatedStorageException'?

Exceptions:
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.dll
public static IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
private void GetScoreData()
{
if (settings.Contains(dataItem2.Name))
{
this.textBlock2.Text = settings[dataItem2.Name].ToString();
}
else
{
settings.Add(dataItem2.Name, "N/A");
this.textBlock2.Text = "N/A";
}
settings.Save();
}
now in the other page
i am updating its value by doing this
ScorePage.settings["MyKey"] = moves.ToString();
so everytime i restart my emulator and run my project this exception comes.
any reason why?
The isolated storage in the emulator is not persisted after you close it.
Reference: Windows Phone Emulator: (see features)
Isolated storage is available while the emulator is running. Data in isolated storage does not persist after the emulator closes. This includes files stored in a local database, as these files reside in isolated storage.
I suggest you to use site settings over application settings.
One more thing, dont worry the windows phone is persistent.(only the emulator is not!)
After restarting the emulator (or reinstallign the app), the contents on IsolatedStorage will be deleted. If you're trying to update a setting, first check that the key exists.
Showing the line where the exception occurs and the exact text of the exception will also help with identifying the issue.

Sharepoint 2010 Client Object Model Remote Access via HTTPS

I was encouraged to learn that the Sharepoint 2010 Client Object Model essentially wraps remote calls to the server. So, I copied the Microsoft.Sharepoint.Client.Silverlight.dll and Microsoft.Sharepoint.Client.Silverlight.Runtime.dll from my Sharepoint 2010 server to my development machine (without Sharepoint). I assumed the Silverlight code I tested on the Sharepoint 2010 server would also work on my development machine. Naturally, I don't use the "ApplicationContext.Current.Url" because I am not executing in Sharepoint, so I manually add sharepoint server name as follows (kept anonymous for the post):
//ClientContext context = new ClientContext(ApplicationContext.Current.Url);
ClientContext context = new ClientContext("https://[servername]");
_web = context.Web;
context.Load(_web);
context.Load(_web.Lists);
context.ExecuteQueryAsync(new ClientRequestSucceededEventHandler (OnRequestSucceeded), new ClientRequestFailedEventHandler(OnRequestFailed));
When I execute the code, I am prompted by a Windows Authentication window (Sharepoint is configured to use Windows Authentication), I add my domain/user and password. However, I am getting the following error:
Note: I was able to get Sharepoint 2010 web services working given a similar error by changing the binding security mode="Transport" and including a clientAccessPolicy.xml file on the Sharepoint root website. Do I need to configure another Sharepoint directory for thje Client Object Model endpoint?
Exception {System.Security.SecurityException ---> System.Security.SecurityException: Security error.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.b__0(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryGetResponseAsyncCallback(IAsyncResult asyncResult)} System.Exception {System.Security.SecurityException}
Please look in to the below blog post, you need to add clientaccesspolicy.xml file in your sharepoint website root folder.
http://vangalvenkat.blogspot.com/2011/08/sharepoint-2010-getting-list-item.html
Aha, I found it. You can set the security on the client context to use the default windows authentication like so:
using (Microsoft.Sharepoint.Client.ClientContext ctx = new Microsoft.Sharepoint.Client.ClientContext("http://sharepointserver")){
ctx.AuthenticationMode = Microsoft.Sharepoint.Client.ClientAuthenticationMode.Default
}
This should also prevent any windows authentication pop-ups

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