473,401 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Is it a microsoft Bug ????

Nir
Hello .

We have a strange problem in our site .

The aspnet_wp process stop to response and his memory start to grow
dramatically,
always after we got an error in one module in our application this
module generate
an jpg file ,randomly this module have this exception :
"The object is currently in use elsewhere.Object Namemscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

This is the module Code :

************************************************** *********

Dim width As Integer
Dim height As Integer
Dim size As SizeF
Dim img As New Bitmap(10, 10)
Dim sFileName As String
Dim fnt As Font

'BuildScript()

'define font
If FontFromFile Then
Dim privateFontCollection As New
System.Drawing.Text.PrivateFontCollection()
privateFontCollection.AddFontFile("C:\FontToBMP\Fo nts\" &
ImageFontName)
Dim thisFont As FontFamily = privateFontCollection.Families(0)
fnt = New Font(thisFont, ImageFontSize)

Else
fnt = New Font(ImageFontName, ImageFontSize)
End If

Dim gr As Graphics = Graphics.FromImage(img)
'calc image size
size = gr.MeasureString(ImageText, fnt)

width = CInt(size.Width) + 1
height = CInt(size.Height) + 1

Dim bmp As New Bitmap(width, height)
Dim g As Graphics = Graphics.FromImage(bmp)
'create image background
width = width + 1000

Dim pPen As New Pen(Drawing.Color.White, width)

Dim point1 As New Point(0, 0)
Dim point2 As New Point(0, width)
Dim point3 As New Point(height, width)
Dim point4 As New Point(height, 0)
Dim enc As Encoder = Encoder.Quality
Dim myEncoderParameter As New EncoderParameter(enc, 2000)
Dim myEncoderParameters As EncoderParameters
Dim imgCodecInfo As ImageCodecInfo

imgCodecInfo = GetEncoderInfo("image/jpeg")
myEncoderParameters = New EncoderParameters(1)
myEncoderParameters.Param(0) = myEncoderParameter

Dim curvePoints As Point() = {point1, point2, point3, point4}

g.DrawPolygon(pPen, curvePoints)

'draw text on image
g.DrawString(ImageText, fnt, Brushes.Black, 0, 0)

fnt.Dispose()
g.Dispose()

'define filename
sFileName = Session.SessionID & Rnd() & ".jpg"

bmp.Save(ConfigurationSettings.AppSettings("BarCod eFolder") &
sFileName, imgCodecInfo, myEncoderParameters)
************************************************** *****************

The exception occurs in this line "g.DrawString(ImageText, fnt,
Brushes.Black, 0, 0)"

Anybody have an idea why error in this code may cause the
aspnet_wp.exe crash ?
And why the error occurs ???

Thank U all.
Jul 21 '05 #1
0 1066

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Karuppasamy | last post by:
H I am trying to use the Logging Module provided by Microsoft Application Blocks for .Net I installed everything as per the Instructions given in the 'Development Using the Logging Block' ...
1
by: Novice | last post by:
Hi all, I am a C++ and Java developer with over 3 years of industry experience. I've written low level C++ code, in addition to web clients that use web services. I've just recently installed the...
99
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a...
476
by: Xah Lee | last post by:
Microsoft Hatred, FAQ Xah Lee, 20020518 Question: U.S. Judges are not morons, and quite a few others are not morons. They find MS guilty, so it must be true. Answer: so did the German...
16
by: ShadowOfTheBeast | last post by:
Hi all, is there any one who have developed an application in c# using a text-speech engine using the Microsoft Speech SDK 5.1 especially using visual studio.net IDE 2003 (v7.1) I seem to get an...
182
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
0
by: mateipuiu | last post by:
When a try to run a client build on 2005, which uses the Microsoft.ApplicationBlocks.Cache.dll reference, when using a Microsoft.ApplicationBlocks.Cache.dll created on Debug mode, the client works...
2
by: JC | last post by:
Anybody knows what problem has this code? I think, in the Garbage Collector? You know the Solution? The program in the test's case, whit 350 contacts, run OK before number 86. The error is a...
7
by: clintonG | last post by:
To all Microsoft partners and customers who have been unable to download recently or access ASP.NET documentation from the msdn2 website and for all of those customers who have been lied to and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.