C# - New XmlSerializer(typeof(MyClass)) Causing Memory Corruption?

Oct 28, 2010

I've got an application that loads an assembly dynamically:

Assembly asm = Assembly.Load("MyClass.DLL");
Type type = asm.GetType("MyClass");
MyClass runningAssembly = (MyClass)Activator.CreateInstance(type);

[code]...

View 1 Replies


Similar Messages:

JQuery :: $('.myClass').click(doSomething();) Versus $('.myClass').click(function(){doSomething(); });

Aug 28, 2010

why the first one is not working and second one is ok ?


if "This method is a shortcut for .bind('click', handler)" ( from jQuery documentation)

so why $('.myClass').bind('click', doSomething()); works fine ?

View 8 Replies

C# - Create And Instance Of MyClass Using The Type?

Sep 24, 2010

Bit of a puzzler, I have a generic class

public abstract class MyClass<T> : UserControl
{
}

and I have got a type like this

Type type = Type.GetType("Type From DB as String", true, true);

and I want to create and instance of MyClass using the type... But this doesn't work.

MyClass<type> control = (MyClass<type>)LoadControl("/UsercControl.ascx");

View 4 Replies

C# - Creating XMLSerializer In .net Throws Exception

Jul 22, 2010

We have an old asp application that instantiates a .NET com visible class. In this class, we do some serialization to store our object in the session.

When I call the following line of code in my test class, it works fine.

var cereal = new XmlSerializer(couponApplicator.GetType());

However, when it gets called in the website and I am debugging, it throws the following error:

{"Cannot execute a program. The command being executed was "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe" /noconfig /fullpaths @"C:\WINDOWS\TEMP\rwot-yx9.cmdline"."} System.SystemException {System.Runtime.InteropServices.ExternalException}

I thought maybe it was permissions related so I tried giving 'EVERYONE' full control to the windows/microsoft.net folder as well as the windows/temp folder. For reference, I am running this on a Windows XP machine.

View 2 Replies

How To Send A XmlSerializer Class To A WebService And Then Deserialize

May 29, 2010

to be able to send a XmlSerializer class (which is generated obvious in remote C# application) over a WebService that will then deserialize it into a class. (I didnt know it its possible either)
XmlSerializer mySerializer = new XmlSerializer(typeof(SystemInfo));
StreamWriter myWriter = new StreamWriter(textBox1.Text);
mySerializer.Serialize(myWriter, sysinfo);
[WebMethod]
public void Reports(XmlSerializer xmlSerializer)

View 1 Replies

C# - Changing Where XmlSerializer Outputs Temporary Assemblies?

Jul 21, 2010

I am trying to change where XmlSerializer Outputs Temporary Assemblies so I am following this sort of tutorial

[URL]

yet when I add

<system.xml.serialization>
<xmlSerializer tempFilesLocation="c:\foo"/>
</system.xml.serialization>

I get tempFileLocation is not a valid attribute. I am using .net 4.0

View 1 Replies

Error Occurring When Using Wcf To Run Query - Memory Gates Checking Failed Because Of The Free Memory

May 21, 2010

I am building an asp.net application, using II6 on windows server 2003 (vps hosting).

I am confronted with an error I didn't receive on my development machine (windows 7, iis 7.5, 64 bit).

When my wcf service tries launching my query running against a local sql server this is the error I receive:

Memory gates checking failed because the free memory (43732992 bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.

View 1 Replies

Error: Attempted To Read Or Write Protected Memory. This Is Often An Indication That Other Memory Is Corrupt?

Oct 11, 2010

I have both VS 2005 and 2008 installed on my machine. 2005 is fine. For 2008, literally any asp.net project I try to create gets this eror. I try stepping into the code, and the error occurs apparently before anything that I can trap is loaded. There is no information written to the event log. I have tried this with a "Hello World" webpage with nothing else going on. Seems unique to my Windows Server 2003 machine.

View 3 Replies

Attempted To Read Or Write Protected Memory. This Is Often An Indication That Other Memory Is Corrupt

Jul 30, 2010

I am getting a weird error in asp.net while using leadtools imaging api. Here's the stack trace.

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at SetThreadData(_THREADDATA* )
at Leadtools.Codecs.CodecsOptions.Use()
at Leadtools.Codecs.RasterCodecs.DoSave(SaveParams saveParams)
at Leadtools.Codecs.RasterCodecs.Save(RasterImage image, Stream stream, RasterImageFormat format, Int32 bitsPerPixel)........

View 1 Replies

Class In App_Code Not Accessible By Global.asax.cs Error - Namespace Name 'MyClass' Could Not Be Found

Nov 18, 2010

I've created a new class in App_Code

namespace Site {
public class MyClass {
public MyClass() {
}
}
}

this is my Global.asax.cs

[code]....

The error is in: MyClass myClass = new MyClass();

The type or namespace name 'MyClass' could not be found (are you missing a using directive or an assembly reference?)

View 1 Replies

Attempted To Read Or Write Protected Memory. This Is Often An Indication That Other Memory?

Jan 26, 2011

I am maintaining C# .NET code written by somebody else, I get following exception few times,Attempted to read or write protected memory. This is often an indication that other memory is corruptThe code structure where I get the above exception is somethign like this,- it is using ref variables in following sequence,Variable-1 and variable-2 are local variables in App1, - App1: func1() which passes these variables reference to func2(), - App1: func2() passes same variables reference via .net remoting to another application (App2).-App2: does the same passes same received reference to another call 2 times.- The execption is occured while returning from App2.

(App1:func1(ref Var1, ref Var2) --> App1:func2(ref Var1, ref Var2) <---App1 .net remoting to App2--> App2:func3(ref Var1, ref Var2)--> App2:func4(ref Var1, ref Var2)-->variables getting updated and function returned to original caller)

My doubts are ,1. Is passing reference variables in such chain is correct? will it cause such exeption? Does .net support ref variable call directly?

View 1 Replies

C# - Get The "typeof" Of A Custom User Control?

Feb 9, 2011

I have a custom user control DatePicker.cs. Inside of another piece of code I have a collection of controls where I am checking the type of the control and doing some logic based on the type. My problem is the following: typeof(DatePicker) Evalutes to:

{Name = "DatePicker" FullName = "cusitecore.cedarsc.UserControls.DatePicker"}

But when I run the debugger and look at the type of the control that is on my web form it is:

{Name = "cedarsc_usercontrols_datepicker_ascx" FullName = "ASP.cedarsc_usercontrols_datepicker_ascx"}

These two things aren't equal so the correct logic isn't getting evaluated. I've tried using Type.GetType("ASP.cedarsc_usercontrols_datepicker_ascx") but this returns null.

Here's what I'm trying to do:

private readonly Dictionary<Type, ControlType?> _controlTypes = new Dictionary<Type, ControlType?>
{
{typeof(CheckBox), ControlType.CheckBox},
{typeof(CheckBoxList), ControlType.CheckBoxList},
{typeof(DropDownList), ControlType.DropDownList},
{typeof(HiddenField), ControlType.HiddenField},
{typeof(ListBox), ControlType.ListBox},
{typeof(RadioButton), ControlType.RadioButton},
{typeof(RadioButtonList), ControlType.RadioButtonList},
{typeof(TextBox), ControlType.TextBox},
{typeof(Label), ControlType.Label},
{typeof(DatePicker), ControlType.DatePicker},
{typeof(CustomSelect), ControlType.CustomSelect}
};................

View 4 Replies

"Too Much Recursion" Error When Using Intanceof Over Typeof?

Jan 20, 2010

I was making a function to convert all dates in an object to strings and when I used the following function I got a error in FF "too much recursion". (It also fails in IE and chrome)

function datesToString(obj) {
if (obj instanceof Object) {
if (obj instanceof Date) {

[code]...

View 1 Replies

DataSource Controls :: Memory Leak - Server Will Crash - Log A Ton Of SQL Errors Stating That It Is "out Of Memory"

Jul 27, 2010

I have a memory leak somewhere that I cant find. Every few days my server will crash, and just before that I log a ton of SQL errors stating that it is "out of memory".

I cant find it anywhere, all of my connections are being disposed like so:

[Code]....
Then I call the connection from my pages like so:[Code]....

That is all pretty straight forward. The connection is disposed because it is implementing the USING clause. I am opening the connection in my connection manager class, and not where it is being utilized?Or, could the problem be in the below method I am using to populate a SqlDataReader:[Code]....

Now, at first it appears as though this could be the problem because the Connection isn't part of a USING clause, however doesn't the 'Data.CommandBehavior.CloseConnection' pretty much do the same thing. This makes sure that the connection is closed when the reader is closed, right? Here is how I call that above reader from my login page code behind:[Code]....

So the DataReader will get closed even without the .Close() because it is in the USING, and the connection should get closed because I specified it in the ExecuteReader paramters right?

View 8 Replies

ANTS Memory Profiler - Which Memory Should Be Looking At?

Aug 24, 2010

I have a memory issue on my websites and am trying to get to the bottom of it. I have downloaded the 14 day trial of ANTS Memory Profiler and have been playing with it to get a grip of what it's telling me. In the memory options on the timeline, I can see Bytes in All Heaps and Private Bytes etc but I am not sure which ones I should be focusing on to see where the memory spikes and doesn't go back down.I am profiling a ASP.NET website using ASP.NET 2.0.

View 1 Replies

MasterPageFile Causing Error?

Aug 12, 2010

I'm trying to use a master page in my website. I created a page and then created the master. I then added the tag MasterPageFile="~/master". I'm guessing that I need to do something to my main page, because I've now started getting the error:

The page contains markup that is not valid when attached to a master page

My main page is as follows:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" MasterPageFile="~/my.master" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>

I tried deleting the tag thinking that this might be the issue. Can anyone point me in the right direction?

View 2 Replies

Sql - Why Causing A Runtime Error

Jul 15, 2010

I am trying to connect to a database on my local server. The database is called "dbtest." Of course, I have left off my actual password and replaced it with "password."

This is the typical code I see on every tutorial, but it doesn't work at all. Please help.

<%
Dim con, rs
con = Server.CreateObject("ADODB.Connection") 'I think it is something to do with this line
con.Open "Provider=sqloledb;SERVER=localhost;DATABASE=dbtest;UID=administrator; PWD=password;"
rs = Server.CreateObject("ADODB.Recordset")
%>

View 2 Replies

C# - What Could Be Causing Different Behaviour Remotely On .net Site

Jan 25, 2011

I have a site that i have developed in asp.net. On debugging the site now hosted using iis7 i noticed a bug, i cannot reproduce this when i run it locally in vs, meaning i can't see the error. The bug occurs on the check box changed event of a devexpress check box. It connects to the database using devart.postgres sql component and linq. However, this is the same connection as anywhere else in the project. The same code works elsewhere in the project. The error i get is:

the requested name is valid, but no data of the requested type was found.

part of my code is in an if statement that checks if a textbox is blank if so it does not run the code within the if statement, interestingly enough if the text box is blank the code runs, so it must be in the if statement? i commented out all of the code and tried again and it still would not run. B

View 1 Replies

MVC2 And MVC Futures Causing RedirectToAction?

Apr 12, 2010

I've been trying to get the strongly typed version of RedirectToAction from the MVC Futures project to work, but I've been getting no where. Below are the steps I've followed, and the errors I've encountered.

I created a new MVC2 app and changed the About action on the HomeController to redirect to the Index page.

Return RedirectToAction("Index")

However, I wanted to use the strongly typed extensions, so I downloaded the MVC Futures from CodePlex and added a reference to Microsoft.Web.Mvc to my project.

I addded the following "import" statement to the top of HomeContoller.vb

Imports Microsoft.Web.Mvc

I commented out the above RedirectToAction and added the following line:

Return RedirectToAction(Of HomeController)(Function(c) c.Index())

So far, so good. However, I noticed if I uncomment out the first (non Generic) RedirectToAction, it was now causing the following compile error:

Error 1 Overload resolution failed because no accessible 'RedirectToAction' can be called with these arguments:
Extension method 'Public Function RedirectToAction(Of TController)(action As System.Linq.Expressions.Expression(Of System.Action(Of TController))) As System.Web.Mvc.RedirectToRouteResult' defined in 'Microsoft.Web.Mvc.ControllerExtensions': Data type(s) of the type parameter(s) cannot be >inferred from these arguments. Specifying the data type(s) explicitly might correct this error.
Extension method 'Public Function RedirectToAction(action As System.Linq.Expressions.Expression(Of System.Action(Of HomeController))) As System.Web.Mvc.RedirectToRouteResult' defined in 'Microsoft.Web.Mvc.ControllerExtensions': Value of type 'String' cannot be converted to 'System.Linq.Expressions.Expression(Of System.Action(Of mvc2test1.HomeController))'.

Even though intelli-sense was showing 8 overloads (the original 6 non-generic overloads, plus the 2 new generic overloads from the Futures assembly), it seems when trying to complie the code, the compiler would only 'find' the 2 non-gneneric extension methods from the Futures assessmbly.

I thought this might be an issue that I was using conflicting versions of the MVC2 assembly, and the futures assembly, so I added MvcDiaganotics.aspx from the Futures download to my project and everytyhing looked correct:

ASP.NET MVC Assembly Information (System.Web.Mvc.dll)

Assembly version: ASP.NET MVC 2 RTM (2.0.50217.0)
Full name: System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Code base: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Web.Mvc/2.0.0.0__31bf3856ad364e35/System.Web.Mvc.dll
Deployment: GAC-deployed

ASP.NET MVC Futures Assembly Information (Microsoft.Web.Mvc.dll)

Assembly version: ASP.NET MVC 2 RTM Futures (2.0.50217.0)
Full name: Microsoft.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null
Code base: file:///xxxx/bin/Microsoft.Web.Mvc.DLL
Deployment: bin-deployed

This is driving me crazy! Becuase I thought this might be some VB issue, I created a new MVC2 project using C# and tried the same as above.

I added the following "using" statement to the top of HomeController.cs

using Microsoft.Web.Mvc;

This time, in the About action method, I could only manage to call the non-generic RedirectToAction by typing the full commmand as follows:

return Microsoft.Web.Mvc.ControllerExtensions.RedirectToAction<HomeController>(this, c => c.Index());

Even though I had a "using" statement at the top of the class, if I tried to call the non-generic RedirectToAction as follows:

return RedirectToAction<HomeController>(c => c.Index());

I would get the following compile error:

Error 1 The non-generic method 'System.Web.Mvc.Controller.RedirectToAction(string)' cannot be used with type arguments

What gives? It's not like I'm trying to do anything out of the ordinary.It's a simple vanilla MVC2 project with only a reference to the Futures assembly.

I'm hoping that I've missed out something obvious, but I've been scratching my head for too long, so I figured I'd seek some assisstance.

If anyone's managed to get this simple scenario working (in VB and/or C#)

View 1 Replies

What Is Causing Error On Ajax Call

Jun 21, 2010

I can't figure out why I might be getting this error. It happens on an ajax call.This is the full error text:

-- 6/21/2010 6:09:10 PM -- System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Web.HttpException (0x80004005): OutputStream is not available when a custom TextWriter is used.
at System.Web.HttpResponse.get_OutputStream()
at AjaxControlToolkit.ToolkitScriptManager.OutputCombinedScriptFile(HttpContext context) in C:AjaxBuildAjaxServerAjaxControlToolkitToolkitScriptManagerToolkitScriptManager.cs:line 286
at AjaxControlToolkit.ToolkitScriptManager.OnInit(EventArgs e) in C:AjaxBuildAjaxServerAjaxControlToolkitToolkitScriptManagerToolkitScriptManager.cs:line 246
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
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.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.Mvc.ViewPage.ProcessRequest(HttpContext context).......................

View 2 Replies

C# - Server.transfer Causing HttpException

Apr 15, 2010

I am developing a C#/SQL ASP.NET web application in VS 2008. Currently I am using the Server.Transfer method to transfer control from one ASPX.CS file to another ASPX file. The first time through, this works. But after control is transferred to this new file it encounters a condition:

if (restart == false)
{

where "restart" is a boolean variable. After this statement it immediately transfers control back to the same ASPX.CS file and tries to reexecute the Server.Transfer method. This time it gives me the following exception and stack trace. Do you know what is causing this? I tried to read this but it didn't make much sense to me.

System.Web.HttpException was unhandled by user code
Message="Error executing child request for DataMatch.aspx."
Source="System.Web"
ErrorCode=-2147467259
StackTrace:
at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)
at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)
at System.Web.HttpServerUtility.Transfer(String path)
at AddFileToSQL._Default.btnAppend_Click(Object sender, EventArgs e) in C:Documents and SettingsAdminMy DocumentsVisual Studio 2008ProjectsAddFileToSQLAddFileToSQLDefault.aspx.cs:line 109

View 1 Replies

Web Forms :: 2.0 Causing IE8 To Reload Once Closed?

Oct 22, 2010

I am using asp.net 2.0 with Windows 7 and IE8. I am also using the IIS on the same laptop as the server. I create a web page and when I run it, it browses fine. The problem is when I close the page either by clicking on the cancel button or the 'X' in the upper right hand corner, the page reloads. I have to close it again. This is very annoying!However, when I run the debugger the page closes once and no reload happens.Anyone know how to stop the page from reloading once I close it?

View 5 Replies

DataAnnotations Automatic Handling Of Int Is Causing A Roadblock?

Jun 2, 2010

Summary: DataAnnotation's automatic handling of an "int?" is making me rethink using them at all.Maybe I'm missing something and an easy fix but I can't get DataAnnotations to cooperate. I have a public property with my own custom validation attribute:

[MustBeNumeric(ErrorMessage = "Must be a number")]
public int? Weight { get; set; }

The point of the custom validation attribute is do a quick check to see if the input is numeric and display an appropriate error message. The problem is that when DataAnnotations tries to bind a string to the int? is automatically doesn't validate and displays a "The value 'asdf' is not valid for Weight."For the life of me I can't get DataAnnotations to stop handling that so I can take care of it in my custom attribute.This seems like it would be a popular scenario (to validate that the input in numeric) and I'm guessing there's an easy solution but I didn't find it anywhere.

View 1 Replies

SQL Reporting :: Web Report Causing An Infinite Loop?

Aug 3, 2010

I am having problems moving my reports from VS2008 to VS2010. I have made several WEB reports in VS2008 that use the code below on the load event of the WEB page to provide a data for the report and they all work correctly. I have to use this method of providing data because I am using several complicated queries that brake the VS2008 and VS2010 wizard.

When I try to convert over to VS2010, the report loading message flashes on the screen and the report never loads. I have run this code in debug and found that it is causing an infinite loop. After the code runs, the load event fires again. I tried adding an exit sub at the end of the code for a test but it has no effect.Below is a sample of the code that I am using with a simplified query and names.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Declare connection string.
Dim cnString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString.ToString [code]...

View 2 Replies

AJAX :: MultiHandleSliderExtender Not Causing Event Trigger?

Feb 4, 2010

I created a MultiHandleSliderExtender on a web form. All works well with updating the two textboxes with the value. The problem is that when I switch to designer mode, I get the following error:

The code is as follows:

[Code]....

[Code]....

[Code]....

The control works and the 2 text boxes get updated, but I tried putting in an update panel with a trigger on mh_1_BoundControl but it never fired. I removed it thinking that was the cause of the error, but no luck.

Now when I add another sliderextender below it for a different value, the code throws an error:

Microsoft JScript runtime error: Sys.InvalidOperationException: Type AjaxControlToolkit.SliderOrientation has already been registered. The type may be defined multiple times or the script file that defines it may have already been loaded. A possible cause is a change of settings during a partial update.

I found this example on this site and tried implementing it but to no avail.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved