473,416 Members | 1,888 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,416 software developers and data experts.

GUID isn't unique?

The following is called each time an event is triggered. The generated GUID
is the same for 3 of 4 calls. Is there a way to ensure it is different for
each call?

this.PrintMessage(System.Guid.NewGuid().ToString() +
this.MessageImageFileExtension, RootImageFileDirectory + "\\" +
DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString() + "\\");

Thanks,
Brett
Nov 17 '05 #1
4 1645
a GUID is alway unique (at least theoretically), there must be an error in
your code.
"Brett" <no@spam.com> schrieb im Newsbeitrag
news:eM**************@tk2msftngp13.phx.gbl...
The following is called each time an event is triggered. The generated
GUID is the same for 3 of 4 calls. Is there a way to ensure it is
different for each call?

this.PrintMessage(System.Guid.NewGuid().ToString() +
this.MessageImageFileExtension, RootImageFileDirectory + "\\" +
DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString() + "\\");

Thanks,
Brett

Nov 17 '05 #2
for(int i=0;i<10;i++)

{

Console.WriteLine(System.Guid.NewGuid().ToString() );

}

No dups. If you are somehow consistently finding dups, that would be very
interesting to many folks. Need to show more code to find this issue with
the output.

--
William Stacey [MVP]

"Brett" <no@spam.com> wrote in message
news:eM**************@tk2msftngp13.phx.gbl...
The following is called each time an event is triggered. The generated
GUID is the same for 3 of 4 calls. Is there a way to ensure it is
different for each call?

this.PrintMessage(System.Guid.NewGuid().ToString() +
this.MessageImageFileExtension, RootImageFileDirectory + "\\" +
DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString() + "\\");

Thanks,
Brett

Nov 17 '05 #3
Hi,
Are your sure that GUID are the same Atleast 1 char should differ!!!!!!.
If whatever ur saying is true then it would be the issue of the century for
developers!!!!!

"William Stacey [MVP]" wrote:
for(int i=0;i<10;i++)

{

Console.WriteLine(System.Guid.NewGuid().ToString() );

}

No dups. If you are somehow consistently finding dups, that would be very
interesting to many folks. Need to show more code to find this issue with
the output.

--
William Stacey [MVP]

"Brett" <no@spam.com> wrote in message
news:eM**************@tk2msftngp13.phx.gbl...
The following is called each time an event is triggered. The generated
GUID is the same for 3 of 4 calls. Is there a way to ensure it is
different for each call?

this.PrintMessage(System.Guid.NewGuid().ToString() +
this.MessageImageFileExtension, RootImageFileDirectory + "\\" +
DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString() + "\\");

Thanks,
Brett


Nov 17 '05 #4
Here's what happens with the dups:

04dc3412-6150-43ce-80a5-a11093e6e2ec(1)
04dc3412-6150-43ce-80a5-a11093e6e2ec(2)

Isn't it Windows that's actually appending the trailing numeric in
parentheses rather than GUID?

Now that I think about it, I see what is probably happening. The above
files are JPGs. They are generated from a printer driver that prints an
image of a webpage for example The printing of a unique page occurs each
time the event is fires. If the webpage goes beyond my predefined length,
page 2 is generated as a seperate image file. It could be the printer
driver appending the numeric rather than windows. It knows which page is
being printed for the current image. To differentiate pages, it is probably
appending the numeric. I noticed this behavior when doing a stand alone
(non code) print.

In summary, I'm sure now GUID is fine. Each time the event is triggered,
which occurs after a print is complete, I get a new GUID. However, if the
printed image is larger than one page, The same GUID is used because another
is not created (no event fired). Once that currrent print completes, a new
page loads, fires the event and a new GUID is cretaed. Does that make
sense?

Thanks,
Brett

"Ravi" <Ra**@discussions.microsoft.com> wrote in message
news:1A**********************************@microsof t.com...
Hi,
Are your sure that GUID are the same Atleast 1 char should
differ!!!!!!.
If whatever ur saying is true then it would be the issue of the century
for
developers!!!!!

"William Stacey [MVP]" wrote:
for(int i=0;i<10;i++)

{

Console.WriteLine(System.Guid.NewGuid().ToString() );

}

No dups. If you are somehow consistently finding dups, that would be
very
interesting to many folks. Need to show more code to find this issue
with
the output.

--
William Stacey [MVP]

"Brett" <no@spam.com> wrote in message
news:eM**************@tk2msftngp13.phx.gbl...
> The following is called each time an event is triggered. The generated
> GUID is the same for 3 of 4 calls. Is there a way to ensure it is
> different for each call?
>
> this.PrintMessage(System.Guid.NewGuid().ToString() +
> this.MessageImageFileExtension, RootImageFileDirectory + "\\" +
> DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString() +
> "\\");
>
> Thanks,
> Brett
>


Nov 17 '05 #5

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

Similar topics

6
by: BigDadyWeaver | last post by:
I am using the following code in asp to define a unique and unpredictable record ID in Access. <% 'GENERATE UNIQUE ID Function genguid() Dim Guid guid =...
4
by: Louis Frolio | last post by:
Greetings All, I have read many upon many articles here regarding GUID data types and uniqueness. There have been many opinions regarding the effectiveness of GUID's and when they should/should...
10
by: www.dir | last post by:
Hi, The following is from MSDN. "A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a...
26
by: John Grandy | last post by:
Is it possible to generate a 20 byte integer from a GUID that is "unique enough" ( just like a GUID is not truly unique , but is "unique enough" ). We identify transactions with GUIDs , but a...
5
by: rcolby | last post by:
Evening, Wondering if someone can point me in the right direction, on how I would compare a system.guid with a system.byte. system.guid (pulled from sql server table with a data type of...
11
by: Tarren | last post by:
Hi: I need to get the unique GUID for a file, so I am using API calls through System.InteropServices I am using BY_HANDLE_FILE_INFORMATION and
1
by: Jeff | last post by:
ASP.NET 2.0 This problem occur using the basic version of SQL Server 2005 which get installed when installing Visual Studio 2005! I have inserted a record in the Test table. But when I try to...
5
by: Davinder | last post by:
Hi, I'm trying to find out how unique a GUID is? Basically I have two web applications and I need to pass a couple of session variables between them using a table in a database. I have set...
8
by: Jack Brown | last post by:
Hi there, I need to create a unique identifier for my own internal needs and am happy to rely on "Guid.NewGuid()" to pull this off. I'd like to know if .NET offers any competing alternative...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.