This is a sample application attempting the Xamarin Forms navigation capability.
We have an event handler with this simple logic:
async void Button_Clicked(System.Object sender, System.EventArgs e)
{
await Shell.Current.GoToAsync(nameof(SchoolList));
}
We also have the route registered in App.xaml.cs as follows:
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new MainPage();
Routing.RegisterRoute(nameof(SchoolList), typeof(SchoolList));
}
However, when the corresponding button is clicked, we get the error below:
System.NullReferenceException: Object reference not set to an instance of an object.
at cross_app1.MainPage.Button_Clicked (System.Object sender, System.EventArgs e) [0x0000f] in /Users/klaus.nji/Projects/cross-app1/cross-app1/MainPage.xaml.cs:18
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:36
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Java.Lang.IRunnable.cs:84
at at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.39(intptr,intptr)
The system is Mac Catalina v10.15.7, IDE is Visual Studio 2019 for Mac and I have the Andriod SDK installed and able to see other aspects of the app.
It looks like you don’t have a Shell, so Shell.Current is null.
What Shell example did you follow?
MainPage = new MainPage(); means your app is pointing to a page of type MainPage. To use Shell (Route) navigation, it needs to be pointing to a Shell.
I would expect to see MainPage = new AppShell();.
There may be other details missing, so be sure to follow a working example, such as Xaminals.
The new AppShell line can be seen in https://github.com/xamarin/xamarin-forms-samples/blob/main/UserInterface/Xaminals/Xaminals/App.xaml.cs.
Note: Its possible to navigate in Xamarin Forms without having Shell, nor defining routes. (Personally, I dislike the Shell, so I don’t use it.) You can define MainPage as a NavigationPage (see its doc). Or you can simply set App.MainPage to different pages, to move between them, without a navigation stack.
Related
I want to redirect opened URLs to an external browser in my WebView, so I hooked its Navigated event:
webView.Navigating += (s, e) =>
{
if (IsExternalUrl(e.Url))
{
try
{
var uri = new Uri(e.Url);
Device.OpenUri(uri); // show external links in external browser
}
catch (Exception)
{
}
e.Cancel = true; // <- not having any effects on Android
}
};
Under Android, this leads to the URL being opened on Chrome and in the WebView at the same time. On iOS e.Cancel = true does work as expected.
I searched extensively on the web but found nothing that helped me, including this Xamarin forum thread: https://forums.xamarin.com/discussion/144314/using-webviewrenderer-and-webviewclient-causes-cancel-navigation-not-working
I now have a workaround, using the back navigation:
XAML:
<local:HybridWebView x:Name="webView" CanGoBack="True" WidthRequest="1000" HeightRequest="1000" />
Code behind:
webView.Navigated += (s, e) =>
{
if (e.Result == WebNavigationResult.Success)
{
if (Device.RuntimePlatform == Device.Android) // on Android, prohibit webview from mirroring urls
if (IsExternalUrl(e.Url)) // that are shown on external browser
webView.GoBack(); // this is necessary because e.Cancel = true doesn't
} // work in webView.Navigating() event
};
Note: Initially, the Navigated event wasn't firing, so I pimped my HybridWebView with a WebViewClient featuring this override:
public override void OnPageFinished(Android.Webkit.WebView view, string url)
{
RaisePageFinishedEvent(url, view.Title);
...
...
var source = new UrlWebViewSource { Url = url };
var args = new WebNavigatedEventArgs(WebNavigationEvent.NewPage, source, url, WebNavigationResult.Success);
_renderer.ElementController.SendNavigated(args);
}
I'm currently using Xamarin.Forms 4.5.
Pressing the back button programmatically is a really crude workaround. So a solution where the url open event is actually canceled is much appreciated.
Update:
I had to remove CanGoBack="True" in the XAML and hard-code the property in OnElementChanged of my WebViewRenderer:
(Element as IWebViewController).CanGoBack = true;
Setting the CanGoBack property in XAML worked fine while the VS 2019 debugger was running attached but if running stand-alone, the app shut down immediately. Can be reproduced on a simple WebView without custom renderer:
ApplyPropertiesVisitor.SetPropertyValue (System.Object xamlelement, Xamarin.Forms.Xaml.XmlName propertyName, System.Object value, System.Object rootElement, Xamarin.Forms.Xaml.INode node, Xamarin.Forms.Xaml.HydrationContext context, System.Xml.IXmlLineInfo lineInfo)
ApplyPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ValueNode node, Xamarin.Forms.Xaml.INode parentNode)
ValueNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode)
ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode)
ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode)
RootNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode)
XamlLoader.Visit (Xamarin.Forms.Xaml.RootNode rootnode, Xamarin.Forms.Xaml.HydrationContext visitorContext, System.Boolean useDesignProperties)
XamlLoader.Load (System.Object view, System.String xaml, System.Reflection.Assembly rootAssembly, System.Boolean useDesignProperties)
XamlLoader.Load (System.Object view, System.String xaml, System.Boolean useDesignProperties)
XamlLoader.Load (System.Object view, System.Type callingType)
Extensions.LoadFromXaml[TXaml] (TXaml view, System.Type callingType)
WebPageCollabora.InitializeComponent ()
CloudplanMobileClient.WebPageCollabora..ctor (System.String url) [0x00031] in <6b79d357cd4641c5bd9a69278958d871>:0
WebPage+<>c__DisplayClass9_0.<OpenNewPage>b__0 ()
Thread+RunnableImplementor.Run ()
IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this)
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.27(intptr,intptr)
I was wondering why the bug obviously has been fixed in 2020 and still I was experiencing the problem. I then noticed that the fix was applied only to FormsWebViewClient but not to the native Xamarin.Android class WebViewClient. I solved the issue just by deriving my web client used in my HybridWebViewRenderer from FormsWebViewClient instead of WebViewClient and modified the constructor a bit:
using Xamarin.Forms.Platform.Android;
...
namespace MyApp.Droid
{
// note: class was derived from 'WebViewClient' before
public class JavascriptWebViewClient : FormsWebViewClient
{
HybridWebViewRenderer _renderer;
string _javascript;
// note: now also calling base class constructor with renderer as parameter
public JavascriptWebViewClient(string javascript, HybridWebViewRenderer renderer) : base(renderer)
{
_javascript = javascript;
_renderer = renderer ?? throw new ArgumentNullException("renderer");
}
...
}
}
I have a local webapi which i use a selfsigned certificate to run on a pc.I am able to reach the webapi (written in .net core) using the browser (https://localhost:port/controller/method), but when i use httpclient on Mac OS Mojave i get an exception (High Sierra and Catalina works).
System.DllNotFoundException: libc.dylib assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) System.Net.NetworkInformation.CommonUnixIPGlobalProperties.getdomainname(byte[],int)
at System.Net.NetworkInformation.CommonUnixIPGlobalProperties.get_DomainName () [0x0000b] in <4b9a7f543fd447a3be5e54f34ee219b2>:0
at System.Net.CookieContainer..ctor () [0x0003f] in <4b9a7f543fd447a3be5e54f34ee219b2>:0
at System.Net.Http.MonoWebRequestHandler.get_CookieContainer () [0x0000a] in <e45d721af82a41d98156aeda80e9ce53>:0
at System.Net.Http.MonoWebRequestHandler.CreateWebRequest (System.Net.Http.HttpRequestMessage request) [0x000f5] in <e45d721af82a41d98156aeda80e9ce53>:0
at System.Net.Http.MonoWebRequestHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x0003e] in <e45d721af82a41d98156aeda80e9ce53>:0
at System.Net.Http.HttpClient.SendAsyncWorker (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) [0x000e8] in <e45d721af82a41d98156aeda80e9ce53>:0
at Mac_Installer.ViewController.Timer_Elapsed (System.Object sender, System.Timers.ElapsedEventArgs e) [0x000bd] in <3581d802103c47bbbf47f26a2763b24c>:0
I have read up and it seems like i need to set the DYLD_FALLBACK_LIBRARY_PATH to /usr/lib (I can see the file - libc.dylib - is there), believe i should add it in the info.plist as an environment variable, but it still fails, or i am doing it wrong.
Any help appreciciated.
If you enabled hardened runtime, try adding "Allow DYLD Environment Variables Entitlement" (com.apple.security.cs.allow-dyld-environment-variables) into your Entitlements.plist.
I just copy libc.dylib. over to the app MonoBundle or Resources folder. The Dll can be found here: https://github.com/facilityweb/Dlls/blob/master/libc.dylib
Another Solution is import the lib MainClass, like follows:
static class MainClass
{
static void Main(string[] args)
{
//solved mojave notfound dll exception
IntPtr p = Dlfcn.dlopen("/usr/lib/libc.dylib", 0);
NSApplication.Init();
NSApplication.SharedApplication.Delegate = new AppDelegate();
NSApplication.Main(args);
}
}
I recently followed Xamarin's SQLite tutorial to install SQLite-net PCL. Everything works perfectly on the simulator in Debug mode but I'm getting crashes on startup in Release mode.
The exception is as follows:
exception:
System.MissingMethodException
message:
Default constructor not found for type MyApp.iOS.FileHelper
stack trace:
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain
(int,string[],intptr,intptr) at UIKit.UIApplication.Main
(System.String[] args, System.IntPtr principal, System.IntPtr
delegate) [0x00005] in
/Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String
principalClassName, System.String delegateClassName) [0x00038] in
/Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at MyApp.iOS.Application.Main (System.String[] args) [0x00008] in
/Users/{FilePath}/iOS/Main.cs:13
What I've found
So this MyApp.iOS.FileHelper is Xamarin's code that fetches the documents directory. The implementation goes like this:
In the Forms application we just have a contract:
public interface IFileHelper
{
string GetLocalFilePath(string filename);
}
In the MyApp.iOS project we define a dependency:
[assembly: Dependency(typeof(FileHelper))]
namespace MyApp.iOS
{
public class FileHelper : IFileHelper
{
public FileHelper() { }
public string GetLocalFilePath(string filename)
{
string docFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string libFolder = Path.Combine(docFolder, "..", "Library", "Databases");
if (!Directory.Exists(libFolder))
{
Directory.CreateDirectory(libFolder);
}
return Path.Combine(libFolder, filename);
}
}
}
Here's how I am using it:
DependencyService.Get<IFileHelper>().GetLocalFilePath("MyAppDatabase.db3")
The application works as expected in Debug mode. So either the Dependency Service is behaving differently in Release or the Documents Directory is different in Release.
My Question
How can avoid this exception in release mode?
Dependency Info:
Xamarin Forms 2.3.3.193
Sqlite-net-pcl 1.2.1
update:
What I've tried:
Added a default constructor, yields no change
Tried different linker possibilities, yields no change
From Introduction to DependencyService
Note that every implementation must have a default (parameterless)
constructor in order for DependencyService to be able to instantiate
it. Parameterless constructors cannot be defined by the interface.
You need to add an empty constructor to your FileHelper class.
public FileHelper() {
}
Please note: I tried voting to close this question as a duplicate. It clearly
failed to be closed as such.
Based on comments point to this post from SushiHangover, this is what resolved my issue:
I needed to add decorate my FileHelper class in my iOS project with:
[Preserve(AllMembers = true)]
again, please go check out his original post here:
https://stackoverflow.com/a/41932246/1664443
Here are the details of my Development Environment:
Visual Studio 2012 Ultimate with Update 4
Google Chrome Version 38.0.2125.111 m
Windows 7 Professional with 32-bit Operating System
Coded UITest Builder 11.0.60315.1
Our software team is creating an ASP.NET web application, and the customer has requested that we use Microsoft Visual Studio 2012 with Microsoft CodedUI to run automated tests.
I ran our ASP.NET application in Google Chrome Version 38.0.2125.111 m
I took steps to use the Microsoft CodedUI to record some Browser-user interaction steps on our ASP.NET application which ultimately led to generating some code.
The following is the generated code based on the recorded Brower-user interaction that I conducted on our ASP.NET Web Application
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by coded UI test builder.
// Version: 11.0.0.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
namespace JigsawEMISTCodedUITestProject
{
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Input;
using Microsoft.VisualStudio.TestTools.UITest.Extension;
using Microsoft.VisualStudio.TestTools.UITesting;
using Microsoft.VisualStudio.TestTools.UITesting.WinControls;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse;
using MouseButtons = System.Windows.Forms.MouseButtons;
using Microsoft.VisualStudio.TestTools.UITesting.HtmlControls;
[GeneratedCode("Coded UITest Builder", "11.0.60315.1")]
public partial class UIMap
{
/// <summary>
/// RecordedMethod1
/// </summary>
public void RecordedMethod1()
{
#region Variable Declarations
WinClient uIChromeLegacyWindowClient = this.UIJigsawBetaEnviromentWindow.UIChromeLegacyWindowWindow.UIChromeLegacyWindowClient;
#endregion
// Click 'Chrome Legacy Window' client
Mouse.Click(uIChromeLegacyWindowClient, new Point(151, 25));
// Click 'Chrome Legacy Window' client
Mouse.Click(uIChromeLegacyWindowClient, new Point(150, 35));
// Click 'Chrome Legacy Window' client
Mouse.Click(uIChromeLegacyWindowClient, new Point(709, 90));
}
#region Properties
public UIJigsawBetaEnviromentWindow UIJigsawBetaEnviromentWindow
{
get
{
if ((this.mUIJigsawBetaEnviromentWindow == null))
{
this.mUIJigsawBetaEnviromentWindow = new UIJigsawBetaEnviromentWindow();
}
return this.mUIJigsawBetaEnviromentWindow;
}
}
#endregion
#region Fields
private UIJigsawBetaEnviromentWindow mUIJigsawBetaEnviromentWindow;
#endregion
}
[GeneratedCode("Coded UITest Builder", "11.0.60315.1")]
public class UIJigsawBetaEnviromentWindow : WinWindow
{
public UIJigsawBetaEnviromentWindow()
{
#region Search Criteria
this.SearchProperties[WinWindow.PropertyNames.Name] = "Jigsaw [Beta Enviroment] - Google Chrome";
// this.SearchProperties[WinWindow.PropertyNames.Name] = "Jigsaw";
this.SearchProperties[WinWindow.PropertyNames.ClassName] = "Chrome_WidgetWin_1";
// this.SearchProperties[WinWindow.PropertyNames.ClassName] = "Chrome";
this.WindowTitles.Add("Jigsaw [Beta Enviroment] - Google Chrome");
// this.WindowTitles.Add("Jigsaw");
#endregion
}
#region Properties
public UIChromeLegacyWindowWindow UIChromeLegacyWindowWindow
{
get
{
if ((this.mUIChromeLegacyWindowWindow == null))
{
this.mUIChromeLegacyWindowWindow = new UIChromeLegacyWindowWindow(this);
}
return this.mUIChromeLegacyWindowWindow;
}
}
#endregion
#region Fields
private UIChromeLegacyWindowWindow mUIChromeLegacyWindowWindow;
#endregion
}
[GeneratedCode("Coded UITest Builder", "11.0.60315.1")]
public class UIChromeLegacyWindowWindow : WinWindow
{
public UIChromeLegacyWindowWindow(UITestControl searchLimitContainer) :
base(searchLimitContainer)
{
#region Search Criteria
this.SearchProperties[WinWindow.PropertyNames.ControlId] = "144212160";
this.WindowTitles.Add("Jigsaw [Beta Enviroment] - Google Chrome");
// this.WindowTitles.Add("Jigsaw");
#endregion
}
#region Properties
public WinClient UIChromeLegacyWindowClient
{
get
{
if ((this.mUIChromeLegacyWindowClient == null))
{
this.mUIChromeLegacyWindowClient = new WinClient(this);
#region Search Criteria
this.mUIChromeLegacyWindowClient.SearchProperties[WinControl.PropertyNames.Name] = "Chrome Legacy Window";
// this.mUIChromeLegacyWindowClient.SearchProperties[WinControl.PropertyNames.Name] = "Chrome";
this.mUIChromeLegacyWindowClient.WindowTitles.Add("Jigsaw [Beta Enviroment] - Google Chrome");
// this.mUIChromeLegacyWindowClient.WindowTitles.Add("Jigsaw");
#endregion
}
return this.mUIChromeLegacyWindowClient;
}
}
#endregion
#region Fields
private WinClient mUIChromeLegacyWindowClient;
#endregion
}
}
Microsoft CodedUI is throwing Error because it fails to see 'Chrome Legacy Window'
I ran the code, but I get the following Error:
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException was unhandled by user code
HResult=-268111872
Message=The playback failed to find the control with the given search properties. Additional Details:
TechnologyName: 'MSAA'
ControlType: 'Client'
Name: 'Chrome Legacy Window'
Source=Microsoft.VisualStudio.TestTools.UITesting
BasicMessage=The playback failed to find the control with the given search properties.
RootElement=""
StackTrace:
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapControlNotFoundException (COMException ex, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowComException (COMException innerException, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException (SystemException exception, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException (SystemException exception, String queryId)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindFirstDescendant (String queryId, Int32 maxDepth, Int32& timeLeft)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetElement(Boolean useCache, ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.Search (ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindInternal()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindPrivate()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<Find>b__d()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.Find()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetPropertyPrivate (String propertyName)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<>c__DisplayClass11.<GetProperty>b __10()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetProperty(String propertyName)
at Microsoft.VisualStudio.TestTools.UITesting.ALUtility.GetTechElementFromUITestControl (UITestControl uiTestControl)
at Microsoft.VisualStudio.TestTools.UITesting.ActionExecutorManager.GetActionExecutor (UITestControl uiControl)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.ClickImplementation (UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point relativeCoordinate)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.<>c__DisplayClass6.<Click>b__5()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point relativeCoordinate)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, Point relativeCoordinate)
at JigsawEMISTCodedUITestProject.UIMap.RecordedMethod1() in d:\EMIS\JigsawEMISTCodedUITestProject\JigsawEMISTCodedUITestProject\UIMap.cs:line 42
at JigsawEMISTCodedUITestProject.CodedUITest1.CodedUITestMethod1() in d:\EMIS\JigsawEMISTCodedUITestProject\JigsawEMISTCodedUITestProject\CodedUITest1.cs:line 30
InnerException: System.Runtime.InteropServices.COMException
HResult=-2147467259
Message=Error HRESULT E_FAIL has been returned from a call to a COM component.
Source=Microsoft.VisualStudio.TestTools.UITest.Playback
ErrorCode=-2147467259
StackTrace:
at Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.IScreenElement.FindAllDescendants (String bstrQueryId, Object& pvarResKeys, Int32 cResKeys, Int32 nMaxDepth)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindAllScreenElement(String queryId, Int32 depth, Boolean singleQueryId, Boolean throwException, Boolean resetSkipStep)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindScreenElement(String queryId, Int32 depth, Boolean resetSkipStep)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindScreenElement(String queryId, Int32 depth)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft)
InnerException:
Do I need to install some drivers for popular browsers ( i.e Google Chrome, Mozilla Firefox, IE, etc.) ?
I restarted my development computer a couple times, but still have same problem.
Please help me.
There's actually a Selenium framework that was ported to run with Coded UI by a developer at Microsoft, which you can find here, that will use the Selenium components to run the tests in Chrome or Firefox. IE is handled by the Coded UI itself, so if your BrowserWindow.BrowserType is "IE", then it'll just run the vanilla Coded UI that's shipped with your Visual Studio.
The Q&A section of that page is where you'll find the most support for questions about the tool itself, but if you have trouble getting started, this blog was very helpful.
I have configured Ninject 2 in an ASP.NET 4.0 project (not MVC) however when I deploy the project to an IIS host it crashes with the following:
System.NullReferenceException: Object reference not set to an instance of an object.
[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.PipelineModuleStepContainer.GetEventCount(RequestNotification notification, Boolean isPostEvent) +30
System.Web.PipelineStepManager.ResumeSteps(Exception error) +1481
System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb) +132
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +709
I have tested this again with a vanilla ASP.net Web Application and get the same crash with the following code:
protected override IKernel CreateKernel()
{
return Container;
}
private IKernel Container
{
get
{
IKernel kernel = new StandardKernel(new SiteModule());
var module = new OnePerRequestModule();
module.Init(this);
return kernel;
}
}
Has anyone else got Ninject working with ASP.net 4?
[UPDATE: 2010.11.03]
After doing some research it appears it may be something to do with the OnePerRequestModule() module, removing this however doesn't seem to resolve the problem I added it due at the suggestion of this question.
In Ninject 2, you use the Ninject.Web extension (see the complete set here) and dont do any explicit config as you have here around OnePerRequestModule etc.
You don't do any web.config stuff either IIRC (I'm using the MVC one and you don't there)