System.ApplicationException - c#

I am trying to rum my application and I am getting the following error as :
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown.
The exception is thrown near the ** line of code:
public void LoadFromEntity(bool editable, string TabKey)
{
//Getting the FormMaster collection
**FormTemplate formTemplate = PolicyClassCollection.CachedPolicyClasses.FindBy((int)EnumPolicyClasses.PNI).FormTemplateCo**llection.Find(ft => ft.PolicyClassId == Utility.GetCurrentPolicyClassId() && ft.DocumentType.DocumentTypeId == (int)EnumDocumentTypes.Coverage_Summary && ft.PolicyTypeId == Utility.GetCurrentAccount().CurrentRisk.PolicyTypeId);
if (formTemplate != null)
{
//Set context string with current option number
this._Account.CurrentRisk.FormContextData = this.OptionNum.ToString();
//getting FormMasterID
Guid vsDatabaseId = formTemplate.FormFilingHistoryId;
string accountXmlString = this._Account.ToXML();
//Setting the parameters in PDFServiceParms class that are to be used in "PDFService.aspx" page.
PDFServiceParms pdfParams = new PDFServiceParms(FORM_MODE_EDIT, vsDatabaseId.ToString(), Model.AppConstants.FORM_TYPE_SELECTED_FORM, accountXmlString);
//Saving the parameters in the session. PDFService.aspx page reads the parameters from the session. Session key is passed in the
//query string when calling the PDFService.aspx page.
Session[AppConstants.SK_SUMMARY_PDF_PARAMS] = pdfParams;
//Setting the iFrame's source to PDFService.aspx page. The PDF document generated in this page is displayed in the iFrame.
this.iframePdf.Attributes["src"] = ResolveClientUrl(AppConstants.PAGE_NAME_PDFSERVICE) + "?datakey=" + AppConstants.SK_SUMMARY_PDF_PARAMS;
}
else
throw new ApplicationException("FormMaster not found for PolicyClass = " + Utility.GetCurrentPolicyClassId().ToString() + " and DocumentType = " + ((int)EnumDocumentTypes.Coverage_Summary).ToString());
}
Exception thrown:
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ApplicationException: FormMaster not found for PolicyClass = 2 and DocumentType = 27
at PNI_SqbpeCovInfoPNISummary.LoadFromEntity(Boolean editable, String TabKey) in C:\TFS\Navigate Development\NavigateWebApp\PNI\SqbpeCovInfoPNISummary.aspx.cs:line 95
at SQBPECoverageInformationMasterPNI.LoadFromEntity() in C:\TFS\Navigate Development\NavigateWebApp\PNI\SQBPECoverageInformationMasterPNI.master.cs:line 188
at SQBPE.Page_Load(Object sender, EventArgs e) in C:\TFS\Navigate Development\NavigateWebApp\SQBPE.master.cs:line 55
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
--- End of inner exception stack trace ---
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.pni_sqbpecovinfopnisummary_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\navigatewebapp\253cae21\57ec5e1d\App_Web_sqbpecovinfopnisummary.aspx.41d7eb59.1z9y4p0a.0.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
can some one please let me know what need to be done for this.

Sorry, edit of whole answer, previous was only halfway correct
The parent exception is a HttpUnhandledException. The internal exception seems quite clear and says:
FormMaster not found for PolicyClass = 2 and DocumentType = 27
That error is in your own code. The ApplicationException is not happening on the line you are referring to. The result of that line is that formTemplateis null and your code throws this exception.
This is the line throwing the exception:
throw new ApplicationException("FormMaster not found for PolicyClass = "
+ Utility.GetCurrentPolicyClassId().ToString()
+ " and DocumentType = "
+ ((int)EnumDocumentTypes.Coverage_Summary).ToString());
(a friendly tip, use string.Format instead)
And this is the line returning null:
FormTemplate formTemplate = PolicyClassCollection.CachedPolicyClasses
.FindBy((int)EnumPolicyClasses.PNI).FormTemplateCollection
.Find(ft => ft.PolicyClassId == Utility.GetCurrentPolicyClassId()
&& ft.DocumentType.DocumentTypeId == (int)EnumDocumentTypes.Coverage_Summary
&& ft.PolicyTypeId == Utility.GetCurrentAccount().CurrentRisk.PolicyTypeId);
(a friendly tip: write it out over multiple lines. That helps with setting breakpoints and with readability)
Your next question should be: why is it returning null? The answer, I don't know. In my previous attempt of answering I said something about third party code. And that's exactly what this is, as the class PolicyClassCollection is not a well-known class, there's no documentation on the internet on it. So either it is your own, in which case you can try stepping through (set a breakpoint) or it is someone else's in which case you can try calling the vendor or try stepping through after removing the "just my code" setting.

Related

SagePay Direct Payment Integration C#

I am trying to implement a credit card payment solution on my website using SagePay, where I can take payment on my website. I am using ASP.NET Web forms and C#. Here is my code:
var objSagePay = new SagePayIntegration();
var request = objSagePay.DirectPaymentRequest();
if ((request != null)) {
request.Vendor = "testVendor";
request.CardHolder = "Customer Name";
request.CardNumber = "4900000000000";
request.CardType = CardType.VISA;
request.ExpiryDate = "0119";
request.Cv2 = "123";
request.Currency = "GBP";
request.Amount = 10.0;
request.BillingAddress1 = "Test Address 1";
request.BillingAddress2 = "";
request.BillingPostCode = "412";
request.BillingCountry = "";
}
var result = objSagePay.ProcessDirectPaymentRequest(request, "https://test.sagepay.com/gateway/service/vspdirect-register.vsp");
When the result object call is executed, I get Object reference is Null.
Any idea where i am doing things wrong?
Stack Trace
[NullReferenceException: Object reference not set to an instance of an object.]
SagePay.IntegrationKit.SagePayIntegration.GetPropertyTextValue(Object request, String propertyName) in C:\dev\dotnet\VspDotNetKitAPI\SagePayIntegration.cs:93
SagePay.IntegrationKit.SagePayIntegration.ProcessDirectPaymentRequest(IDirectPayment paymentRequest, String directPaymentUrl) in C:\dev\dotnet\VspDotNetKitAPI\SagePayIntegration.cs:449
orders_payment_Default.btnProceedCreditCard_Click(Object sender, EventArgs e) in Default.aspx.cs:93
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9692746
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3562
You aren't setting enough properties on your payment request so it is throwing the NullReferenceException when trying to build the request object internally.
You can check if you have set at least the minimum values by calling the Validation method:
var errors = objSagePay.Validation(SagePay.IntegrationKit.ProtocolMessage.DIRECT_PAYMENT,
typeof(SagePay.IntegrationKit.Messages.IDirectPayment),
request,
SagePay.IntegrationKit.ProtocolVersion.V_300);
The errors object in this case will tell you that you are missing the following value:
VendorTxCode
This is your transaction identifier, for example, an order number. It needs to be a unique value for every payment you make. If you set that value, the error should go away.
Bonus: If you get really stuck with the SagePay Integration Kit for .Net, you can see the source code for it in my GitHub repository.

Prevent out of memory error when writing too much to the browser

I got assigned the task of resolving a problem where I suspect too much data is attempting to be written to the browser. I.e Building tables to display on 2,000+ records.
$exception {"Exception of type 'System.OutOfMemoryException' was thrown."} System.Exception {System.OutOfMemoryException}
Exception is thrown on Page_PreRender
What is the easiest way to troubleshoot the problem?
What is the easiest way to test/resolve it?
Thanks
[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
System.String.Concat(String str0, String str1, String str2, String str3) +76
ProgramName.File.GetData() in C:\inetpub\wwwroot\ProgramName\File.aspx.cs:137
ProgramName.File.Page_PreRender(Object sender, EventArgs e) in C:\inetpub\wwwroot\ProgramName\File.aspx.cs:18
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnPreRender(EventArgs e) +8775110
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
With the stack trace I think I know your problem.
In your Page_PreRender method you are concatenating strings (you mention that you are constructing a table - it's likely that it's the code doing this).
If you concatenate 2 strings together, memory get's allocated to create a new string to hold the result, but the memory to store the first two strings does not get reclaimed because those strings are still in scope. I'm guessing that you are concatenating a lot of strings (in a loop), and thus are running out of memory.
The fix is to use a StringBuilder.
Find the code that looks something like this:
public void GetData()
{
string myTableString = "";
foreach (var row in MyRows)
{
myTableString += "<tr><td>" + row.someProperty + "</td></tr>"
}
to the following
using System.Text // This goes at the top of the file, with the other using statements.
...
public void GetData()
{
StringBuilder sb = new StringBuilder();
foreach (var row in MyRows)
{
sb.Append("<tr><td>" + row.someProperty + "</td></tr>");
}
string myTableString = sb.ToString();
Note that the code I've given above is just my best guess at what your code looks like - it would be much easier if you posted your code!!

NullReferenceException on 2nd Page_Load

At first I'd like to say: Yes I know that there are many Questions that are similar to mine, but not the same.
When I start one of my 12 sites on my developer-machine everything works wonderful, and also on the server 11 of them work without a problem.
When I start the 12th site it first works fine, but when it cause a postback (Button, DropDownList with AutoPostBack, etc... ) I get the following error:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Infoscreen.Anzeigeeinstellungen.Page_Load(Object sender, EventArgs e) in C:\Users\Krusty\Desktop\Schule\Diplomarbeit\Infoscreen\Infoscreen\Anzeigeeinstellungen.aspx.cs:97
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +24
System.Web.UI.Control.LoadRecursive() +70
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3047
the path (C:\Users\Krusty\Desktop\Schule\Diplomarbeit\Infoscreen\Infoscreen\Anzeigeeinstellungen.aspx.cs) is the one where the file was on my developer-machine.
but why??
I never hardcoded any path in my program, and even recreating the site didn't work.
What shall i do? Any tips/hints would be appreciated.
EDIT:
91 if (!Page.IsPostBack)
92 {
93 Response.Cookies["Infoscreen_Anzeigeeinstellungen_Ausgewählte_Abteilung"].Value = ausgewählte_Abteilung.ToString();
94 }
95 else
96 {
97 ausgewählte_Abteilung = Request.Cookies["Infoscreen_Anzeigeeinstellungen_Ausgewählte_Abteilung"].Value;
98 }
EDIT:
Yes, IIS is configured to use Cookies
EDIT:
SOLVED!
in VisualStudio2010 Server the char 'ä' works...
in IIS7 it doesn't...
so the cookie never gets set propperly and the get request hangs up
named the cookie "Infoscreen_Anzeigeeinstellungen_Ausgewaehlte_Abteilung" and it works fine now
can be closed
As you already found out your self but just for future reference:
In your code for handling the cookie the 'name' is allowed in c# (using a-umlaut) but as per RFC2616 the token for a cookie MUST contain a subset of US-ASCII chars.
if (!Page.IsPostBack)
{
Response.Cookies["Infoscreen_Anzeigeeinstellungen_Ausgewählte_Abteilung"].Value = ausgewählte_Abteilung.ToString();
}
else
{
ausgewählte_Abteilung = Request.Cookies["Infoscreen_Anzeigeeinstellungen_Ausgewählte_Abteilung"].Value;
}
So a way to have a safe Cookies key in case your cookiekey is generated based on form/controlnames could be:
static string TokenRFC2616(string key)
{
const string separators = "()|<>#,;:\\\"/[]?={} ";
var chars = from ch in key.Normalize(NormalizationForm.FormD)
where CharUnicodeInfo.GetUnicodeCategory(ch)
!= UnicodeCategory.NonSpacingMark &&
separators.IndexOf(ch)==-1
select ch;
return String.Concat(chars);
}
string cookiekey = TokenRFC2616(
"Infoscreen_Anzeigeeinstellungen_Ausgewählte_Abteilung");
if (!Page.IsPostBack)
{
Response.Cookies[cookieKey].Value = ausgewählte_Abteilung.ToString();
}
else
{
ausgewählte_Abteilung = Request.Cookies[cookieKey].Value;
}
(in the above sample the cookie name will be Infoscreen_Anzeigeeinstellungen_Ausgewahlte_Abteilung
)

'Object reference not set to an instance of an object' after Server.Transfer

I have a search control, when the user clicking on search the query is passing in the url (get mode) with the following line from the code behind:
Server.Transfer("portfolio_search_results.aspx?search=" + query);
now i have a very strange problem, if the user is clicking on the search button the search works fine, but if the user click search again the error
Object reference not set to an instance of an object.
is raising. going to other page after the search and searching again works fine, this is happening only when clicking search button twice in a row.
the search control is in the top of the page inside the master.
the code in the search function:
SqlCommand cmd = new SqlCommand("something", _mainConnection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("ID", SessionManager.Session[SessionParam.ID].ToString()));
cmd.Parameters.Add(new SqlParameter("Type", type));
return _mainDb.ExecuteDataSet(cmd).Tables[0];
and the error is in the session.
If i am using Response.Redirect instead of Server.Transfer it's not working at all and getting the above error even in the first time searching.
edit: adding stack trace.
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
[No relevant source lines]
Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\e76777bb\bf0abb72\App_Web_portfolio_search_results.aspx.cdcab7d2.jiztmxz2.0.cs Line: 0
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Appeals.GetAppeals(String typeAppeals) +104
search.make_dt() +21
search..ctor() +311
portfolio_search_results..ctor() +26
ASP.portfolio_search_results_aspx..ctor() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\e76777bb\bf0abb72\App_Web_portfolio_search_results.aspx.cdcab7d2.jiztmxz2.0.cs:0
__ASP.FastObjectFactory_app_web_portfolio_search_results_aspx_cdcab7d2_jiztmxz2.Create_ASP_portfolio_search_results_aspx() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\e76777bb\bf0abb72\App_Web_portfolio_search_results.aspx.cdcab7d2.jiztmxz2.1.cs:0
System.Web.Compilation.BuildResultCompiledType.CreateInstance() +32
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +119
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Version Information: Microsoft .NET Framework Version:2.0.50727.3634; ASP.NET Version:2.0.50727.3634
I suggest you diagnose line by line your objects in debug mode. For example:
if (_mainConnection == null)
{
throw new Exception("_mainConnection is null");
}
SqlCommand cmd = new SqlCommand("something", _mainConnection);
cmd.CommandType = CommandType.StoredProcedure;
if (string.IsNullOrEmpty(SessionParam.ID))
{
throw new Exception("SessionParam.ID is null or empty");
}
else if (SessionManager.Session[SessionParam.ID] == null)
{
throw new Exception("SessionManager.Session[SessionParam.ID] is null or empty");
}
cmd.Parameters.Add(new SqlParameter("ID", SessionManager.Session[SessionParam.ID].ToString()));
if (type == null)
{
throw new Exception("type is null")
}
cmd.Parameters.Add(new SqlParameter("Type", type));
var res = _mainDb.ExecuteDataSet(cmd);
if (res == null)
{
throw new Exception("res is null")
}
if ((res.Tables == null) || (res.Tables.Length == 0))
{
throw new Exception("tables is null or = 0")
}
return res.Tables[0];
So, this way you should receive detailed information about your error.
Not sure if I type well my code - I didn't check spell errors. I think main idea is understandable.
Regards.
I solve it by passing the session as parameter to my classes in App_code directory in my project instead using the session parameter inside the App_code classes.
so the study is that session wouln't be use in the app_code directory .

Subsonic 3.0.0.4 ActiveRecord Template for MySQL error on inserting new record

public void Add(IDataProvider provider){
var key=KeyValue();
if(key==null){
var newKey=_repo.Add(this,provider);
this.SetKeyValue(newKey);
}else{
_repo.Add(this,provider); //NullReferenceException was unhandled by user code
}
SetIsNew(false);
OnSaved();
}
'this' contains
this
{Geocine}
_age: null
_birthday: null
_church_id: null
_db: {Seminary.Data.SeminaryDB}
_dirtyColumns: Count = 0
_finalgrade: null
_finalgrade_equivalent: null
_first_name: "Geocine"
_gender: null
_isLoaded: false
_isNew: true
_last_name: "Cruz"
_level: null
_middle_name: "Reilly"
_repo: {SubSonic.Repository.SubSonicRepository<Seminary.Data.student>}
_semester_enrolled: null
_seminary_id: null
_student_id: 0
_year_enrolled: null
age: null
birthday: null
church_id: null
Columns: Count = 14
finalgrade: null
finalgrade_equivalent: null
first_name: "Geocine"
gender: null
last_name: "Cruz"
level: null
middle_name: "Reilly"
semester_enrolled: null
seminary_id: null
student_id: 0
tbl: {student}
TestMode: false
year_enrolled: null
provider contains
provider
{SubSonic.DataProviders.DbDataProvider}
[SubSonic.DataProviders.DbDataProvider]: {SubSonic.DataProviders.DbDataProvider}
Client: MySqlClient
ConnectionString: "Data Source=localhost;Database=school;User Id=root;Password=123456;Port=3306;"
CurrentSharedConnection: null
DbDataProviderName: "MySql.Data.MySqlClient"
Factory: {MySql.Data.MySqlClient.MySqlClientFactory}
Log: null
Name: "MySql.Data.MySqlClient"
ParameterPrefix: "#"
Schema: {SubSonic.Schema.DatabaseSchema}
SchemaGenerator: {SubSonic.SqlGeneration.Schema.MySqlSchema}
Here is the stacktrace
[NullReferenceException: Object reference not set to an instance of an object.]
MySql.Data.MySqlClient.MySqlConnection.get_ServerThread() +6
MySql.Data.MySqlClient.MySqlConnection.Abort() +54
MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) +839
MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +4
System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10
SubSonic.DataProviders.DbDataProvider.ExecuteReader(QueryCommand qry) +175
SubSonic.Repository.SubSonicRepository`1.Add(T item, IDataProvider provider) +165
Seminary.Data.student.Add(IDataProvider provider) in C:\Users\SomeUser\Documents\Visual Studio 2008\Projects\Seminary\ActiveRecord\ActiveRecord.cs:2490
Seminary.Data.student.Save(IDataProvider provider) in C:\Users\SomeUser\Documents\Visual Studio 2008\Projects\Seminary\ActiveRecord\ActiveRecord.cs:2505
Seminary.Data.student.Save() in C:\Users\SomeUser\Documents\Visual Studio 2008\Projects\Seminary\ActiveRecord\ActiveRecord.cs:2499
Seminary.Default.btnAdd_Click(Object sender, EventArgs e) in C:\Users\SomeUser\Documents\Visual Studio 2008\Projects\Seminary\Default.aspx.cs:34
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Here is the code that called the error:
student studentObject = new student();
studentObject.first_name = txtFirstName.Text;
studentObject.middle_name = txtMiddleName.Text;
studentObject.last_name = txtLastName.Text;
studentObject.Save();
That is a bit tricky. This exceptions happens with the current version of mysql.connector.net.
Normally an exception would be trown at this point, but the connector seems to have an NullReferenceException itself before it can throw the actual exception.
The "real" exception could be anything from "DUPLICATE KEY ..." to "Field XYZ does not have a default value" or "You have an error in your SQL Syntax near ..."
I haven't had time yet to figure out why this happens (debug the Connector.Net or try a newer one) but in the mean time I would suggest you do the following as I do:
Download unix tools for windows: http://unxutils.sourceforge.net/ and put them in the path (we need the tail command)
Configure mysql to write a query.log to c:\temp
[mysqld]
log=c:/temp/query.log
Start a console and type
tail -f c:\temp\query.log
Now you see every statement that is executed against your local database and if you get the NullReferenceException copy the last statement form the console window to a mysql query browser instance and execute it there.
Hope that helps, I will update this post if I figured out how to fix this issue.

Categories

Resources